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

package com.azure.resourcemanager.managementgroups.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner;
import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo;
import org.junit.jupiter.api.Assertions;

public final class SubscriptionUnderManagementGroupInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SubscriptionUnderManagementGroupInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"tenant\":\"ipheoflokeyyien\",\"displayName\":\"dlwtgrhpdj\",\"parent\":{\"id\":\"masxazjpqyegu\"},\"state\":\"hb\"},\"id\":\"xhejjzzvdud\",\"name\":\"wdslfhotwmcy\",\"type\":\"pwlbjnpg\"}")
                .toObject(SubscriptionUnderManagementGroupInner.class);
        Assertions.assertEquals("ipheoflokeyyien", model.tenant());
        Assertions.assertEquals("dlwtgrhpdj", model.displayName());
        Assertions.assertEquals("masxazjpqyegu", model.parent().id());
        Assertions.assertEquals("hb", model.state());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SubscriptionUnderManagementGroupInner model =
            new SubscriptionUnderManagementGroupInner()
                .withTenant("ipheoflokeyyien")
                .withDisplayName("dlwtgrhpdj")
                .withParent(new DescendantParentGroupInfo().withId("masxazjpqyegu"))
                .withState("hb");
        model = BinaryData.fromObject(model).toObject(SubscriptionUnderManagementGroupInner.class);
        Assertions.assertEquals("ipheoflokeyyien", model.tenant());
        Assertions.assertEquals("dlwtgrhpdj", model.displayName());
        Assertions.assertEquals("masxazjpqyegu", model.parent().id());
        Assertions.assertEquals("hb", model.state());
    }
}
