// 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.models.EntityHierarchyItem;
import com.azure.resourcemanager.managementgroups.models.Permissions;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class EntityHierarchyItemTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EntityHierarchyItem model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"displayName\":\"xwtctyqiklbbovpl\",\"permissions\":\"view\",\"children\":[{\"id\":\"yuguosvmkfssx\",\"name\":\"ukkfplgmgs\",\"type\":\"nkjzkdeslpvlop\"},{\"id\":\"yighxpk\",\"name\":\"wzbaiue\",\"type\":\"baumnyqupedeoj\"}]},\"id\":\"a\",\"name\":\"ckhsmtxpsieb\",\"type\":\"fhvpesaps\"}")
                .toObject(EntityHierarchyItem.class);
        Assertions.assertEquals("xwtctyqiklbbovpl", model.displayName());
        Assertions.assertEquals(Permissions.VIEW, model.permissions());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EntityHierarchyItem model =
            new EntityHierarchyItem()
                .withDisplayName("xwtctyqiklbbovpl")
                .withPermissions(Permissions.VIEW)
                .withChildren(Arrays.asList(new EntityHierarchyItem(), new EntityHierarchyItem()));
        model = BinaryData.fromObject(model).toObject(EntityHierarchyItem.class);
        Assertions.assertEquals("xwtctyqiklbbovpl", model.displayName());
        Assertions.assertEquals(Permissions.VIEW, model.permissions());
    }
}
