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

public final class ScaleSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ScaleSettings model =
            BinaryData
                .fromString(
                    "{\"maxNodeCount\":978941807,\"minNodeCount\":1532421493,\"nodeIdleTimeBeforeScaleDown\":\"PT119H2M26S\"}")
                .toObject(ScaleSettings.class);
        Assertions.assertEquals(978941807, model.maxNodeCount());
        Assertions.assertEquals(1532421493, model.minNodeCount());
        Assertions.assertEquals(Duration.parse("PT119H2M26S"), model.nodeIdleTimeBeforeScaleDown());
    }

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