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

package com.azure.resourcemanager.servicefabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.servicefabric.models.ArmRollingUpgradeMonitoringPolicy;
import com.azure.resourcemanager.servicefabric.models.ArmUpgradeFailureAction;
import org.junit.jupiter.api.Assertions;

public final class ArmRollingUpgradeMonitoringPolicyTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ArmRollingUpgradeMonitoringPolicy model =
            BinaryData
                .fromString(
                    "{\"failureAction\":\"Rollback\",\"healthCheckWaitDuration\":\"vgqzcjrvxd\",\"healthCheckStableDuration\":\"lmwlxkvugfhzo\",\"healthCheckRetryTimeout\":\"wjvzunluthnn\",\"upgradeTimeout\":\"nxipeil\",\"upgradeDomainTimeout\":\"zuaejxd\"}")
                .toObject(ArmRollingUpgradeMonitoringPolicy.class);
        Assertions.assertEquals(ArmUpgradeFailureAction.ROLLBACK, model.failureAction());
        Assertions.assertEquals("vgqzcjrvxd", model.healthCheckWaitDuration());
        Assertions.assertEquals("lmwlxkvugfhzo", model.healthCheckStableDuration());
        Assertions.assertEquals("wjvzunluthnn", model.healthCheckRetryTimeout());
        Assertions.assertEquals("nxipeil", model.upgradeTimeout());
        Assertions.assertEquals("zuaejxd", model.upgradeDomainTimeout());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ArmRollingUpgradeMonitoringPolicy model =
            new ArmRollingUpgradeMonitoringPolicy()
                .withFailureAction(ArmUpgradeFailureAction.ROLLBACK)
                .withHealthCheckWaitDuration("vgqzcjrvxd")
                .withHealthCheckStableDuration("lmwlxkvugfhzo")
                .withHealthCheckRetryTimeout("wjvzunluthnn")
                .withUpgradeTimeout("nxipeil")
                .withUpgradeDomainTimeout("zuaejxd");
        model = BinaryData.fromObject(model).toObject(ArmRollingUpgradeMonitoringPolicy.class);
        Assertions.assertEquals(ArmUpgradeFailureAction.ROLLBACK, model.failureAction());
        Assertions.assertEquals("vgqzcjrvxd", model.healthCheckWaitDuration());
        Assertions.assertEquals("lmwlxkvugfhzo", model.healthCheckStableDuration());
        Assertions.assertEquals("wjvzunluthnn", model.healthCheckRetryTimeout());
        Assertions.assertEquals("nxipeil", model.upgradeTimeout());
        Assertions.assertEquals("zuaejxd", model.upgradeDomainTimeout());
    }
}
