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

package com.azure.resourcemanager.dynatrace.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.dynatrace.fluent.models.LinkableEnvironmentResponseInner;
import com.azure.resourcemanager.dynatrace.models.PlanData;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class LinkableEnvironmentResponseInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        LinkableEnvironmentResponseInner model =
            BinaryData
                .fromString(
                    "{\"environmentId\":\"u\",\"environmentName\":\"thfuiuaodsfcpkvx\",\"planData\":{\"usageType\":\"uozmyzydagfua\",\"billingCycle\":\"ezyiuokktwhrdxw\",\"planDetails\":\"wqsmbsur\",\"effectiveDate\":\"2021-08-23T03:52:49Z\"}}")
                .toObject(LinkableEnvironmentResponseInner.class);
        Assertions.assertEquals("u", model.environmentId());
        Assertions.assertEquals("thfuiuaodsfcpkvx", model.environmentName());
        Assertions.assertEquals("uozmyzydagfua", model.planData().usageType());
        Assertions.assertEquals("ezyiuokktwhrdxw", model.planData().billingCycle());
        Assertions.assertEquals("wqsmbsur", model.planData().planDetails());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-23T03:52:49Z"), model.planData().effectiveDate());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        LinkableEnvironmentResponseInner model =
            new LinkableEnvironmentResponseInner()
                .withEnvironmentId("u")
                .withEnvironmentName("thfuiuaodsfcpkvx")
                .withPlanData(
                    new PlanData()
                        .withUsageType("uozmyzydagfua")
                        .withBillingCycle("ezyiuokktwhrdxw")
                        .withPlanDetails("wqsmbsur")
                        .withEffectiveDate(OffsetDateTime.parse("2021-08-23T03:52:49Z")));
        model = BinaryData.fromObject(model).toObject(LinkableEnvironmentResponseInner.class);
        Assertions.assertEquals("u", model.environmentId());
        Assertions.assertEquals("thfuiuaodsfcpkvx", model.environmentName());
        Assertions.assertEquals("uozmyzydagfua", model.planData().usageType());
        Assertions.assertEquals("ezyiuokktwhrdxw", model.planData().billingCycle());
        Assertions.assertEquals("wqsmbsur", model.planData().planDetails());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-23T03:52:49Z"), model.planData().effectiveDate());
    }
}
