// 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.fluent.models.DatadogAgreementResourceInner;
import com.azure.resourcemanager.datadog.models.DatadogAgreementProperties;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class DatadogAgreementResourceInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatadogAgreementResourceInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"publisher\":\"u\",\"product\":\"nryrtihf\",\"plan\":\"ijbpzvgnwzsymgl\",\"licenseTextLink\":\"fcyzkohdbihanufh\",\"privacyPolicyLink\":\"bj\",\"retrieveDatetime\":\"2021-10-05T18:31:22Z\",\"signature\":\"ithxqhabifpi\",\"accepted\":false},\"id\":\"zb\",\"name\":\"scnpqxuhivy\",\"type\":\"n\"}")
                .toObject(DatadogAgreementResourceInner.class);
        Assertions.assertEquals("u", model.properties().publisher());
        Assertions.assertEquals("nryrtihf", model.properties().product());
        Assertions.assertEquals("ijbpzvgnwzsymgl", model.properties().plan());
        Assertions.assertEquals("fcyzkohdbihanufh", model.properties().licenseTextLink());
        Assertions.assertEquals("bj", model.properties().privacyPolicyLink());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-05T18:31:22Z"), model.properties().retrieveDatetime());
        Assertions.assertEquals("ithxqhabifpi", model.properties().signature());
        Assertions.assertEquals(false, model.properties().accepted());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatadogAgreementResourceInner model =
            new DatadogAgreementResourceInner()
                .withProperties(
                    new DatadogAgreementProperties()
                        .withPublisher("u")
                        .withProduct("nryrtihf")
                        .withPlan("ijbpzvgnwzsymgl")
                        .withLicenseTextLink("fcyzkohdbihanufh")
                        .withPrivacyPolicyLink("bj")
                        .withRetrieveDatetime(OffsetDateTime.parse("2021-10-05T18:31:22Z"))
                        .withSignature("ithxqhabifpi")
                        .withAccepted(false));
        model = BinaryData.fromObject(model).toObject(DatadogAgreementResourceInner.class);
        Assertions.assertEquals("u", model.properties().publisher());
        Assertions.assertEquals("nryrtihf", model.properties().product());
        Assertions.assertEquals("ijbpzvgnwzsymgl", model.properties().plan());
        Assertions.assertEquals("fcyzkohdbihanufh", model.properties().licenseTextLink());
        Assertions.assertEquals("bj", model.properties().privacyPolicyLink());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-05T18:31:22Z"), model.properties().retrieveDatetime());
        Assertions.assertEquals("ithxqhabifpi", model.properties().signature());
        Assertions.assertEquals(false, model.properties().accepted());
    }
}
