// 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.HttpD2CMessagesNotInAllowedRange;
import java.time.Duration;
import org.junit.jupiter.api.Assertions;

public final class HttpD2CMessagesNotInAllowedRangeTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        HttpD2CMessagesNotInAllowedRange model =
            BinaryData
                .fromString(
                    "{\"ruleType\":\"HttpD2CMessagesNotInAllowedRange\",\"timeWindowSize\":\"PT111H55M28S\",\"minThreshold\":1174525778,\"maxThreshold\":184797601,\"displayName\":\"jkqev\",\"description\":\"rmmwiuawvcmj\",\"isEnabled\":true}")
                .toObject(HttpD2CMessagesNotInAllowedRange.class);
        Assertions.assertEquals(true, model.isEnabled());
        Assertions.assertEquals(1174525778, model.minThreshold());
        Assertions.assertEquals(184797601, model.maxThreshold());
        Assertions.assertEquals(Duration.parse("PT111H55M28S"), model.timeWindowSize());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        HttpD2CMessagesNotInAllowedRange model =
            new HttpD2CMessagesNotInAllowedRange()
                .withIsEnabled(true)
                .withMinThreshold(1174525778)
                .withMaxThreshold(184797601)
                .withTimeWindowSize(Duration.parse("PT111H55M28S"));
        model = BinaryData.fromObject(model).toObject(HttpD2CMessagesNotInAllowedRange.class);
        Assertions.assertEquals(true, model.isEnabled());
        Assertions.assertEquals(1174525778, model.minThreshold());
        Assertions.assertEquals(184797601, model.maxThreshold());
        Assertions.assertEquals(Duration.parse("PT111H55M28S"), model.timeWindowSize());
    }
}
