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

public final class WebPubSubHubListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        WebPubSubHubList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"eventHandlers\":[],\"eventListeners\":[],\"anonymousConnectPolicy\":\"rmcqiby\"},\"id\":\"nojvknmefqsg\",\"name\":\"vah\",\"type\":\"pjyzhpv\"},{\"properties\":{\"eventHandlers\":[],\"eventListeners\":[],\"anonymousConnectPolicy\":\"rvxdjzlmw\"},\"id\":\"xkvugfhzov\",\"name\":\"wjvzunluthnn\",\"type\":\"rnxipei\"},{\"properties\":{\"eventHandlers\":[],\"eventListeners\":[],\"anonymousConnectPolicy\":\"aejxd\"},\"id\":\"ltskzbbtd\",\"name\":\"umveekgpwozuhkf\",\"type\":\"bsjyofdx\"},{\"properties\":{\"eventHandlers\":[],\"eventListeners\":[],\"anonymousConnectPolicy\":\"ttouwaboekqvkel\"},\"id\":\"smv\",\"name\":\"xwyjsflhhc\",\"type\":\"aln\"}],\"nextLink\":\"xisxyawjoyaqcsl\"}")
                .toObject(WebPubSubHubList.class);
        Assertions.assertEquals("rmcqiby", model.value().get(0).properties().anonymousConnectPolicy());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        WebPubSubHubList model =
            new WebPubSubHubList()
                .withValue(
                    Arrays
                        .asList(
                            new WebPubSubHubInner()
                                .withProperties(
                                    new WebPubSubHubProperties()
                                        .withEventHandlers(Arrays.asList())
                                        .withEventListeners(Arrays.asList())
                                        .withAnonymousConnectPolicy("rmcqiby")),
                            new WebPubSubHubInner()
                                .withProperties(
                                    new WebPubSubHubProperties()
                                        .withEventHandlers(Arrays.asList())
                                        .withEventListeners(Arrays.asList())
                                        .withAnonymousConnectPolicy("rvxdjzlmw")),
                            new WebPubSubHubInner()
                                .withProperties(
                                    new WebPubSubHubProperties()
                                        .withEventHandlers(Arrays.asList())
                                        .withEventListeners(Arrays.asList())
                                        .withAnonymousConnectPolicy("aejxd")),
                            new WebPubSubHubInner()
                                .withProperties(
                                    new WebPubSubHubProperties()
                                        .withEventHandlers(Arrays.asList())
                                        .withEventListeners(Arrays.asList())
                                        .withAnonymousConnectPolicy("ttouwaboekqvkel"))));
        model = BinaryData.fromObject(model).toObject(WebPubSubHubList.class);
        Assertions.assertEquals("rmcqiby", model.value().get(0).properties().anonymousConnectPolicy());
    }
}
