// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.datadog.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datadog.models.DatadogAgreementProperties;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class DatadogAgreementPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatadogAgreementProperties model =
            BinaryData
                .fromString(
                    "{\"publisher\":\"b\",\"product\":\"rkxvdum\",\"plan\":\"rtfw\",\"licenseTextLink\":\"k\",\"privacyPolicyLink\":\"audccsnhs\",\"retrieveDatetime\":\"2021-10-29T04:44:12Z\",\"signature\":\"ejhkry\",\"accepted\":true}")
                .toObject(DatadogAgreementProperties.class);
        Assertions.assertEquals("b", model.publisher());
        Assertions.assertEquals("rkxvdum", model.product());
        Assertions.assertEquals("rtfw", model.plan());
        Assertions.assertEquals("k", model.licenseTextLink());
        Assertions.assertEquals("audccsnhs", model.privacyPolicyLink());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T04:44:12Z"), model.retrieveDatetime());
        Assertions.assertEquals("ejhkry", model.signature());
        Assertions.assertEquals(true, model.accepted());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatadogAgreementProperties model =
            new DatadogAgreementProperties()
                .withPublisher("b")
                .withProduct("rkxvdum")
                .withPlan("rtfw")
                .withLicenseTextLink("k")
                .withPrivacyPolicyLink("audccsnhs")
                .withRetrieveDatetime(OffsetDateTime.parse("2021-10-29T04:44:12Z"))
                .withSignature("ejhkry")
                .withAccepted(true);
        model = BinaryData.fromObject(model).toObject(DatadogAgreementProperties.class);
        Assertions.assertEquals("b", model.publisher());
        Assertions.assertEquals("rkxvdum", model.product());
        Assertions.assertEquals("rtfw", model.plan());
        Assertions.assertEquals("k", model.licenseTextLink());
        Assertions.assertEquals("audccsnhs", model.privacyPolicyLink());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T04:44:12Z"), model.retrieveDatetime());
        Assertions.assertEquals("ejhkry", model.signature());
        Assertions.assertEquals(true, model.accepted());
    }
}
