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

package com.azure.resourcemanager.hdinsight.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hdinsight.models.Autoscale;
import com.azure.resourcemanager.hdinsight.models.AutoscaleCapacity;
import com.azure.resourcemanager.hdinsight.models.AutoscaleConfigurationUpdateParameter;
import com.azure.resourcemanager.hdinsight.models.AutoscaleRecurrence;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class AutoscaleConfigurationUpdateParameterTests {
    @Test
    public void testDeserialize() {
        AutoscaleConfigurationUpdateParameter model =
            BinaryData
                .fromString(
                    "{\"autoscale\":{\"capacity\":{\"minInstanceCount\":421254098,\"maxInstanceCount\":661393497},\"recurrence\":{\"timeZone\":\"lhspkdee\",\"schedule\":[]}}}")
                .toObject(AutoscaleConfigurationUpdateParameter.class);
        Assertions.assertEquals(421254098, model.autoscale().capacity().minInstanceCount());
        Assertions.assertEquals(661393497, model.autoscale().capacity().maxInstanceCount());
        Assertions.assertEquals("lhspkdee", model.autoscale().recurrence().timeZone());
    }

    @Test
    public void testSerialize() {
        AutoscaleConfigurationUpdateParameter model =
            new AutoscaleConfigurationUpdateParameter()
                .withAutoscale(
                    new Autoscale()
                        .withCapacity(
                            new AutoscaleCapacity().withMinInstanceCount(421254098).withMaxInstanceCount(661393497))
                        .withRecurrence(
                            new AutoscaleRecurrence().withTimeZone("lhspkdee").withSchedule(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(AutoscaleConfigurationUpdateParameter.class);
        Assertions.assertEquals(421254098, model.autoscale().capacity().minInstanceCount());
        Assertions.assertEquals(661393497, model.autoscale().capacity().maxInstanceCount());
        Assertions.assertEquals("lhspkdee", model.autoscale().recurrence().timeZone());
    }
}
