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

package com.azure.resourcemanager.policyinsights.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.policyinsights.models.FieldRestriction;
import com.azure.resourcemanager.policyinsights.models.FieldRestrictions;
import java.util.Arrays;
import org.junit.jupiter.api.Test;

public final class FieldRestrictionsTests {
    @Test
    public void testDeserialize() {
        FieldRestrictions model =
            BinaryData
                .fromString(
                    "{\"field\":\"hyxxrwlycoduhpk\",\"restrictions\":[{\"result\":\"Required\",\"defaultValue\":\"re\",\"values\":[\"jxqugjhky\"],\"policy\":{\"policyDefinitionId\":\"eddgssofw\",\"policySetDefinitionId\":\"zqalkrmnjijpx\",\"policyDefinitionReferenceId\":\"q\",\"policyAssignmentId\":\"dfnbyxbaaabjyv\"}},{\"result\":\"Required\",\"defaultValue\":\"imrzrtuzqog\",\"values\":[\"nevfdnw\",\"wmewzsyy\",\"euzsoi\"],\"policy\":{\"policyDefinitionId\":\"dpfrxtrthzvaytdw\",\"policySetDefinitionId\":\"brqubp\",\"policyDefinitionReferenceId\":\"h\",\"policyAssignmentId\":\"iilivpdtiirqtd\"}}]}")
                .toObject(FieldRestrictions.class);
    }

    @Test
    public void testSerialize() {
        FieldRestrictions model =
            new FieldRestrictions().withRestrictions(Arrays.asList(new FieldRestriction(), new FieldRestriction()));
        model = BinaryData.fromObject(model).toObject(FieldRestrictions.class);
    }
}
