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

package com.azure.resourcemanager.hdinsight.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hdinsight.models.IpConfiguration;
import com.azure.resourcemanager.hdinsight.models.PrivateLinkConfiguration;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class PrivateLinkConfigurationTests {
    @Test
    public void testDeserialize() {
        PrivateLinkConfiguration model =
            BinaryData
                .fromString(
                    "{\"id\":\"tymw\",\"name\":\"sdkf\",\"type\":\"wxmnteiwao\",\"properties\":{\"groupId\":\"vkmijcmmxdcuf\",\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"id\":\"ymzidn\",\"name\":\"ezcxtbzsgfyccsne\",\"type\":\"dwzjeiach\"},{\"id\":\"sflnrosfqp\",\"name\":\"eeh\",\"type\":\"vypyqrimzinpv\"},{\"id\":\"dkirsoodqxhcr\",\"name\":\"nohjt\",\"type\":\"whdsoifiyip\"}]}}")
                .toObject(PrivateLinkConfiguration.class);
        Assertions.assertEquals("sdkf", model.name());
        Assertions.assertEquals("vkmijcmmxdcuf", model.groupId());
        Assertions.assertEquals("ezcxtbzsgfyccsne", model.ipConfigurations().get(0).name());
    }

    @Test
    public void testSerialize() {
        PrivateLinkConfiguration model =
            new PrivateLinkConfiguration()
                .withName("sdkf")
                .withGroupId("vkmijcmmxdcuf")
                .withIpConfigurations(
                    Arrays
                        .asList(
                            new IpConfiguration().withName("ezcxtbzsgfyccsne"),
                            new IpConfiguration().withName("eeh"),
                            new IpConfiguration().withName("nohjt")));
        model = BinaryData.fromObject(model).toObject(PrivateLinkConfiguration.class);
        Assertions.assertEquals("sdkf", model.name());
        Assertions.assertEquals("vkmijcmmxdcuf", model.groupId());
        Assertions.assertEquals("ezcxtbzsgfyccsne", model.ipConfigurations().get(0).name());
    }
}
