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

package com.azure.resourcemanager.storagecache.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.storagecache.models.CacheSecuritySettings;
import com.azure.resourcemanager.storagecache.models.NfsAccessPolicy;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class CacheSecuritySettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CacheSecuritySettings model =
            BinaryData
                .fromString(
                    "{\"accessPolicies\":[{\"name\":\"cq\",\"accessRules\":[]},{\"name\":\"xolzdahzx\",\"accessRules\":[]}]}")
                .toObject(CacheSecuritySettings.class);
        Assertions.assertEquals("cq", model.accessPolicies().get(0).name());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CacheSecuritySettings model =
            new CacheSecuritySettings()
                .withAccessPolicies(
                    Arrays
                        .asList(
                            new NfsAccessPolicy().withName("cq").withAccessRules(Arrays.asList()),
                            new NfsAccessPolicy().withName("xolzdahzx").withAccessRules(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(CacheSecuritySettings.class);
        Assertions.assertEquals("cq", model.accessPolicies().get(0).name());
    }
}
