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

package com.azure.resourcemanager.mediaservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mediaservices.models.IpAccessControl;
import com.azure.resourcemanager.mediaservices.models.LiveEventEndpoint;
import com.azure.resourcemanager.mediaservices.models.LiveEventPreview;
import com.azure.resourcemanager.mediaservices.models.LiveEventPreviewAccessControl;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class LiveEventPreviewTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        LiveEventPreview model =
            BinaryData
                .fromString(
                    "{\"endpoints\":[{\"protocol\":\"gj\",\"url\":\"bldtlww\"},{\"protocol\":\"kdmtncvokotll\",\"url\":\"yhgsy\"},{\"protocol\":\"ogjltdtbnnhad\",\"url\":\"crkvcikhnv\"}],\"accessControl\":{\"ip\":{\"allow\":[]}},\"previewLocator\":\"qqu\",\"streamingPolicyName\":\"ik\",\"alternativeMediaId\":\"ggxkallatmelwuip\"}")
                .toObject(LiveEventPreview.class);
        Assertions.assertEquals("gj", model.endpoints().get(0).protocol());
        Assertions.assertEquals("bldtlww", model.endpoints().get(0).url());
        Assertions.assertEquals("qqu", model.previewLocator());
        Assertions.assertEquals("ik", model.streamingPolicyName());
        Assertions.assertEquals("ggxkallatmelwuip", model.alternativeMediaId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        LiveEventPreview model =
            new LiveEventPreview()
                .withEndpoints(
                    Arrays
                        .asList(
                            new LiveEventEndpoint().withProtocol("gj").withUrl("bldtlww"),
                            new LiveEventEndpoint().withProtocol("kdmtncvokotll").withUrl("yhgsy"),
                            new LiveEventEndpoint().withProtocol("ogjltdtbnnhad").withUrl("crkvcikhnv")))
                .withAccessControl(
                    new LiveEventPreviewAccessControl().withIp(new IpAccessControl().withAllow(Arrays.asList())))
                .withPreviewLocator("qqu")
                .withStreamingPolicyName("ik")
                .withAlternativeMediaId("ggxkallatmelwuip");
        model = BinaryData.fromObject(model).toObject(LiveEventPreview.class);
        Assertions.assertEquals("gj", model.endpoints().get(0).protocol());
        Assertions.assertEquals("bldtlww", model.endpoints().get(0).url());
        Assertions.assertEquals("qqu", model.previewLocator());
        Assertions.assertEquals("ik", model.streamingPolicyName());
        Assertions.assertEquals("ggxkallatmelwuip", model.alternativeMediaId());
    }
}
