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

package com.azure.resourcemanager.frontdoor.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.frontdoor.models.ManagedRuleExclusion;
import com.azure.resourcemanager.frontdoor.models.ManagedRuleExclusionMatchVariable;
import com.azure.resourcemanager.frontdoor.models.ManagedRuleExclusionSelectorMatchOperator;
import org.junit.jupiter.api.Assertions;

public final class ManagedRuleExclusionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ManagedRuleExclusion model =
            BinaryData
                .fromString(
                    "{\"matchVariable\":\"RequestBodyJsonArgNames\",\"selectorMatchOperator\":\"EndsWith\",\"selector\":\"amiheognarxz\"}")
                .toObject(ManagedRuleExclusion.class);
        Assertions.assertEquals(ManagedRuleExclusionMatchVariable.REQUEST_BODY_JSON_ARG_NAMES, model.matchVariable());
        Assertions.assertEquals(ManagedRuleExclusionSelectorMatchOperator.ENDS_WITH, model.selectorMatchOperator());
        Assertions.assertEquals("amiheognarxz", model.selector());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ManagedRuleExclusion model =
            new ManagedRuleExclusion()
                .withMatchVariable(ManagedRuleExclusionMatchVariable.REQUEST_BODY_JSON_ARG_NAMES)
                .withSelectorMatchOperator(ManagedRuleExclusionSelectorMatchOperator.ENDS_WITH)
                .withSelector("amiheognarxz");
        model = BinaryData.fromObject(model).toObject(ManagedRuleExclusion.class);
        Assertions.assertEquals(ManagedRuleExclusionMatchVariable.REQUEST_BODY_JSON_ARG_NAMES, model.matchVariable());
        Assertions.assertEquals(ManagedRuleExclusionSelectorMatchOperator.ENDS_WITH, model.selectorMatchOperator());
        Assertions.assertEquals("amiheognarxz", model.selector());
    }
}
