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

public final class ProbeSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ProbeSettings model =
            BinaryData
                .fromString(
                    "{\"failureThreshold\":1906628483,\"initialDelay\":\"PT113H32M27S\",\"period\":\"PT148H10M\",\"successThreshold\":619019093,\"timeout\":\"PT78H24M37S\"}")
                .toObject(ProbeSettings.class);
        Assertions.assertEquals(1906628483, model.failureThreshold());
        Assertions.assertEquals(Duration.parse("PT113H32M27S"), model.initialDelay());
        Assertions.assertEquals(Duration.parse("PT148H10M"), model.period());
        Assertions.assertEquals(619019093, model.successThreshold());
        Assertions.assertEquals(Duration.parse("PT78H24M37S"), model.timeout());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ProbeSettings model =
            new ProbeSettings()
                .withFailureThreshold(1906628483)
                .withInitialDelay(Duration.parse("PT113H32M27S"))
                .withPeriod(Duration.parse("PT148H10M"))
                .withSuccessThreshold(619019093)
                .withTimeout(Duration.parse("PT78H24M37S"));
        model = BinaryData.fromObject(model).toObject(ProbeSettings.class);
        Assertions.assertEquals(1906628483, model.failureThreshold());
        Assertions.assertEquals(Duration.parse("PT113H32M27S"), model.initialDelay());
        Assertions.assertEquals(Duration.parse("PT148H10M"), model.period());
        Assertions.assertEquals(619019093, model.successThreshold());
        Assertions.assertEquals(Duration.parse("PT78H24M37S"), model.timeout());
    }
}
