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

public final class SharedPrivateLinkResourceListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SharedPrivateLinkResourceList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"groupId\":\"hpxlktwkuziycs\",\"privateLinkResourceId\":\"evufuztck\",\"provisioningState\":\"Unknown\",\"requestMessage\":\"tqedcgzulwm\",\"status\":\"Timeout\"},\"id\":\"z\",\"name\":\"rr\",\"type\":\"vpglydz\"},{\"properties\":{\"groupId\":\"rvqeevtoepryutn\",\"privateLinkResourceId\":\"ytp\",\"provisioningState\":\"Succeeded\",\"requestMessage\":\"vzvfvaawzqadfl\",\"status\":\"Rejected\"},\"id\":\"riglaec\",\"name\":\"ndtic\",\"type\":\"kpvzmlq\"}],\"nextLink\":\"ld\"}")
                .toObject(SharedPrivateLinkResourceList.class);
        Assertions.assertEquals("hpxlktwkuziycs", model.value().get(0).groupId());
        Assertions.assertEquals("evufuztck", model.value().get(0).privateLinkResourceId());
        Assertions.assertEquals("tqedcgzulwm", model.value().get(0).requestMessage());
        Assertions.assertEquals("ld", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SharedPrivateLinkResourceList model =
            new SharedPrivateLinkResourceList()
                .withValue(
                    Arrays
                        .asList(
                            new SharedPrivateLinkResourceInner()
                                .withGroupId("hpxlktwkuziycs")
                                .withPrivateLinkResourceId("evufuztck")
                                .withRequestMessage("tqedcgzulwm"),
                            new SharedPrivateLinkResourceInner()
                                .withGroupId("rvqeevtoepryutn")
                                .withPrivateLinkResourceId("ytp")
                                .withRequestMessage("vzvfvaawzqadfl")))
                .withNextLink("ld");
        model = BinaryData.fromObject(model).toObject(SharedPrivateLinkResourceList.class);
        Assertions.assertEquals("hpxlktwkuziycs", model.value().get(0).groupId());
        Assertions.assertEquals("evufuztck", model.value().get(0).privateLinkResourceId());
        Assertions.assertEquals("tqedcgzulwm", model.value().get(0).requestMessage());
        Assertions.assertEquals("ld", model.nextLink());
    }
}
