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

public final class AccessControlTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AccessControl model =
            BinaryData
                .fromString("{\"defaultAction\":\"Deny\",\"ipAllowList\":[\"igdtopbob\",\"og\",\"m\",\"w\"]}")
                .toObject(AccessControl.class);
        Assertions.assertEquals(DefaultAction.DENY, model.defaultAction());
        Assertions.assertEquals("igdtopbob", model.ipAllowList().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AccessControl model =
            new AccessControl()
                .withDefaultAction(DefaultAction.DENY)
                .withIpAllowList(Arrays.asList("igdtopbob", "og", "m", "w"));
        model = BinaryData.fromObject(model).toObject(AccessControl.class);
        Assertions.assertEquals(DefaultAction.DENY, model.defaultAction());
        Assertions.assertEquals("igdtopbob", model.ipAllowList().get(0));
    }
}
