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

package com.azure.resourcemanager.security.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.security.models.AutomationTriggeringRule;
import com.azure.resourcemanager.security.models.Operator;
import com.azure.resourcemanager.security.models.PropertyType;
import org.junit.jupiter.api.Assertions;

public final class AutomationTriggeringRuleTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AutomationTriggeringRule model =
            BinaryData
                .fromString(
                    "{\"propertyJPath\":\"nbaeqphchqn\",\"propertyType\":\"Integer\",\"expectedValue\":\"x\",\"operator\":\"LesserThan\"}")
                .toObject(AutomationTriggeringRule.class);
        Assertions.assertEquals("nbaeqphchqn", model.propertyJPath());
        Assertions.assertEquals(PropertyType.INTEGER, model.propertyType());
        Assertions.assertEquals("x", model.expectedValue());
        Assertions.assertEquals(Operator.LESSER_THAN, model.operator());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AutomationTriggeringRule model =
            new AutomationTriggeringRule()
                .withPropertyJPath("nbaeqphchqn")
                .withPropertyType(PropertyType.INTEGER)
                .withExpectedValue("x")
                .withOperator(Operator.LESSER_THAN);
        model = BinaryData.fromObject(model).toObject(AutomationTriggeringRule.class);
        Assertions.assertEquals("nbaeqphchqn", model.propertyJPath());
        Assertions.assertEquals(PropertyType.INTEGER, model.propertyType());
        Assertions.assertEquals("x", model.expectedValue());
        Assertions.assertEquals(Operator.LESSER_THAN, model.operator());
    }
}
