// 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.NfsAccessRule;
import com.azure.resourcemanager.storagecache.models.NfsAccessRuleAccess;
import com.azure.resourcemanager.storagecache.models.NfsAccessRuleScope;
import org.junit.jupiter.api.Assertions;

public final class NfsAccessRuleTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        NfsAccessRule model =
            BinaryData
                .fromString(
                    "{\"scope\":\"network\",\"filter\":\"bpybsrfbjf\",\"access\":\"no\",\"suid\":false,\"submountAccess\":true,\"rootSquash\":true,\"anonymousUID\":\"pvjzbe\",\"anonymousGID\":\"l\"}")
                .toObject(NfsAccessRule.class);
        Assertions.assertEquals(NfsAccessRuleScope.NETWORK, model.scope());
        Assertions.assertEquals("bpybsrfbjf", model.filter());
        Assertions.assertEquals(NfsAccessRuleAccess.NO, model.access());
        Assertions.assertEquals(false, model.suid());
        Assertions.assertEquals(true, model.submountAccess());
        Assertions.assertEquals(true, model.rootSquash());
        Assertions.assertEquals("pvjzbe", model.anonymousUid());
        Assertions.assertEquals("l", model.anonymousGid());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        NfsAccessRule model =
            new NfsAccessRule()
                .withScope(NfsAccessRuleScope.NETWORK)
                .withFilter("bpybsrfbjf")
                .withAccess(NfsAccessRuleAccess.NO)
                .withSuid(false)
                .withSubmountAccess(true)
                .withRootSquash(true)
                .withAnonymousUid("pvjzbe")
                .withAnonymousGid("l");
        model = BinaryData.fromObject(model).toObject(NfsAccessRule.class);
        Assertions.assertEquals(NfsAccessRuleScope.NETWORK, model.scope());
        Assertions.assertEquals("bpybsrfbjf", model.filter());
        Assertions.assertEquals(NfsAccessRuleAccess.NO, model.access());
        Assertions.assertEquals(false, model.suid());
        Assertions.assertEquals(true, model.submountAccess());
        Assertions.assertEquals(true, model.rootSquash());
        Assertions.assertEquals("pvjzbe", model.anonymousUid());
        Assertions.assertEquals("l", model.anonymousGid());
    }
}
