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

package com.azure.resourcemanager.machinelearning.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.machinelearning.models.ScaleSettings;
import com.azure.resourcemanager.machinelearning.models.ScaleSettingsInformation;
import java.time.Duration;
import org.junit.jupiter.api.Assertions;

public final class ScaleSettingsInformationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ScaleSettingsInformation model =
            BinaryData
                .fromString(
                    "{\"scaleSettings\":{\"maxNodeCount\":2089644825,\"minNodeCount\":582953019,\"nodeIdleTimeBeforeScaleDown\":\"PT83H47M42S\"}}")
                .toObject(ScaleSettingsInformation.class);
        Assertions.assertEquals(2089644825, model.scaleSettings().maxNodeCount());
        Assertions.assertEquals(582953019, model.scaleSettings().minNodeCount());
        Assertions.assertEquals(Duration.parse("PT83H47M42S"), model.scaleSettings().nodeIdleTimeBeforeScaleDown());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ScaleSettingsInformation model =
            new ScaleSettingsInformation()
                .withScaleSettings(
                    new ScaleSettings()
                        .withMaxNodeCount(2089644825)
                        .withMinNodeCount(582953019)
                        .withNodeIdleTimeBeforeScaleDown(Duration.parse("PT83H47M42S")));
        model = BinaryData.fromObject(model).toObject(ScaleSettingsInformation.class);
        Assertions.assertEquals(2089644825, model.scaleSettings().maxNodeCount());
        Assertions.assertEquals(582953019, model.scaleSettings().minNodeCount());
        Assertions.assertEquals(Duration.parse("PT83H47M42S"), model.scaleSettings().nodeIdleTimeBeforeScaleDown());
    }
}
