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

package com.azure.resourcemanager.webpubsub.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.webpubsub.fluent.models.PrivateLinkResourceInner;
import com.azure.resourcemanager.webpubsub.models.ShareablePrivateLinkResourceType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PrivateLinkResourceInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PrivateLinkResourceInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"groupId\":\"dbzm\",\"requiredMembers\":[\"fznudaodvxzb\",\"cblylpstdbhhxsr\",\"dzu\"],\"requiredZoneNames\":[\"scdntnevf\"],\"shareablePrivateLinkResourceTypes\":[{\"name\":\"ygtdsslswt\"},{\"name\":\"riofzpyqse\"},{\"name\":\"bnetshh\"},{\"name\":\"edplvwiwubmw\"}]},\"id\":\"esl\",\"name\":\"nkww\",\"type\":\"pp\"}")
                .toObject(PrivateLinkResourceInner.class);
        Assertions.assertEquals("dbzm", model.groupId());
        Assertions.assertEquals("fznudaodvxzb", model.requiredMembers().get(0));
        Assertions.assertEquals("scdntnevf", model.requiredZoneNames().get(0));
        Assertions.assertEquals("ygtdsslswt", model.shareablePrivateLinkResourceTypes().get(0).name());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateLinkResourceInner model =
            new PrivateLinkResourceInner()
                .withGroupId("dbzm")
                .withRequiredMembers(Arrays.asList("fznudaodvxzb", "cblylpstdbhhxsr", "dzu"))
                .withRequiredZoneNames(Arrays.asList("scdntnevf"))
                .withShareablePrivateLinkResourceTypes(
                    Arrays
                        .asList(
                            new ShareablePrivateLinkResourceType().withName("ygtdsslswt"),
                            new ShareablePrivateLinkResourceType().withName("riofzpyqse"),
                            new ShareablePrivateLinkResourceType().withName("bnetshh"),
                            new ShareablePrivateLinkResourceType().withName("edplvwiwubmw")));
        model = BinaryData.fromObject(model).toObject(PrivateLinkResourceInner.class);
        Assertions.assertEquals("dbzm", model.groupId());
        Assertions.assertEquals("fznudaodvxzb", model.requiredMembers().get(0));
        Assertions.assertEquals("scdntnevf", model.requiredZoneNames().get(0));
        Assertions.assertEquals("ygtdsslswt", model.shareablePrivateLinkResourceTypes().get(0).name());
    }
}
