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

package com.azure.resourcemanager.deploymentmanager.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.deploymentmanager.models.RestHealthCheck;
import com.azure.resourcemanager.deploymentmanager.models.RestHealthCheckStepAttributes;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class RestHealthCheckStepAttributesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        RestHealthCheckStepAttributes model =
            BinaryData
                .fromString(
                    "{\"type\":\"REST\",\"properties\":{\"healthChecks\":[{\"name\":\"eun\"}]},\"waitDuration\":\"hgyxzkonoc\",\"maxElasticDuration\":\"oklyaxuconuq\",\"healthyStateDuration\":\"zf\"}")
                .toObject(RestHealthCheckStepAttributes.class);
        Assertions.assertEquals("hgyxzkonoc", model.waitDuration());
        Assertions.assertEquals("oklyaxuconuq", model.maxElasticDuration());
        Assertions.assertEquals("zf", model.healthyStateDuration());
        Assertions.assertEquals("eun", model.healthChecks().get(0).name());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        RestHealthCheckStepAttributes model =
            new RestHealthCheckStepAttributes()
                .withWaitDuration("hgyxzkonoc")
                .withMaxElasticDuration("oklyaxuconuq")
                .withHealthyStateDuration("zf")
                .withHealthChecks(Arrays.asList(new RestHealthCheck().withName("eun")));
        model = BinaryData.fromObject(model).toObject(RestHealthCheckStepAttributes.class);
        Assertions.assertEquals("hgyxzkonoc", model.waitDuration());
        Assertions.assertEquals("oklyaxuconuq", model.maxElasticDuration());
        Assertions.assertEquals("zf", model.healthyStateDuration());
        Assertions.assertEquals("eun", model.healthChecks().get(0).name());
    }
}
