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

public final class OnlineRequestSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OnlineRequestSettings model =
            BinaryData
                .fromString(
                    "{\"maxConcurrentRequestsPerInstance\":1659306080,\"maxQueueWait\":\"PT185H26M24S\",\"requestTimeout\":\"PT152H42M33S\"}")
                .toObject(OnlineRequestSettings.class);
        Assertions.assertEquals(1659306080, model.maxConcurrentRequestsPerInstance());
        Assertions.assertEquals(Duration.parse("PT185H26M24S"), model.maxQueueWait());
        Assertions.assertEquals(Duration.parse("PT152H42M33S"), model.requestTimeout());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OnlineRequestSettings model =
            new OnlineRequestSettings()
                .withMaxConcurrentRequestsPerInstance(1659306080)
                .withMaxQueueWait(Duration.parse("PT185H26M24S"))
                .withRequestTimeout(Duration.parse("PT152H42M33S"));
        model = BinaryData.fromObject(model).toObject(OnlineRequestSettings.class);
        Assertions.assertEquals(1659306080, model.maxConcurrentRequestsPerInstance());
        Assertions.assertEquals(Duration.parse("PT185H26M24S"), model.maxQueueWait());
        Assertions.assertEquals(Duration.parse("PT152H42M33S"), model.requestTimeout());
    }
}
