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

public final class TableVerticalLimitSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        TableVerticalLimitSettings model =
            BinaryData
                .fromString(
                    "{\"enableEarlyTermination\":false,\"exitScore\":93.94093189506944,\"maxConcurrentTrials\":976047571,\"maxCoresPerTrial\":1086162181,\"maxTrials\":943881137,\"timeout\":\"PT74H46M4S\",\"trialTimeout\":\"PT5H4M5S\"}")
                .toObject(TableVerticalLimitSettings.class);
        Assertions.assertEquals(false, model.enableEarlyTermination());
        Assertions.assertEquals(93.94093189506944D, model.exitScore());
        Assertions.assertEquals(976047571, model.maxConcurrentTrials());
        Assertions.assertEquals(1086162181, model.maxCoresPerTrial());
        Assertions.assertEquals(943881137, model.maxTrials());
        Assertions.assertEquals(Duration.parse("PT74H46M4S"), model.timeout());
        Assertions.assertEquals(Duration.parse("PT5H4M5S"), model.trialTimeout());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        TableVerticalLimitSettings model =
            new TableVerticalLimitSettings()
                .withEnableEarlyTermination(false)
                .withExitScore(93.94093189506944D)
                .withMaxConcurrentTrials(976047571)
                .withMaxCoresPerTrial(1086162181)
                .withMaxTrials(943881137)
                .withTimeout(Duration.parse("PT74H46M4S"))
                .withTrialTimeout(Duration.parse("PT5H4M5S"));
        model = BinaryData.fromObject(model).toObject(TableVerticalLimitSettings.class);
        Assertions.assertEquals(false, model.enableEarlyTermination());
        Assertions.assertEquals(93.94093189506944D, model.exitScore());
        Assertions.assertEquals(976047571, model.maxConcurrentTrials());
        Assertions.assertEquals(1086162181, model.maxCoresPerTrial());
        Assertions.assertEquals(943881137, model.maxTrials());
        Assertions.assertEquals(Duration.parse("PT74H46M4S"), model.timeout());
        Assertions.assertEquals(Duration.parse("PT5H4M5S"), model.trialTimeout());
    }
}
