// 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.ContainerResourceRequirements;
import com.azure.resourcemanager.machinelearning.models.ContainerResourceSettings;
import org.junit.jupiter.api.Assertions;

public final class ContainerResourceRequirementsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ContainerResourceRequirements model =
            BinaryData
                .fromString(
                    "{\"containerResourceLimits\":{\"cpu\":\"wllcolsr\",\"gpu\":\"apte\",\"memory\":\"excgjokjljnhvl\"},\"containerResourceRequests\":{\"cpu\":\"ek\",\"gpu\":\"eksnbksdqhjvyk\",\"memory\":\"eslk\"}}")
                .toObject(ContainerResourceRequirements.class);
        Assertions.assertEquals("wllcolsr", model.containerResourceLimits().cpu());
        Assertions.assertEquals("apte", model.containerResourceLimits().gpu());
        Assertions.assertEquals("excgjokjljnhvl", model.containerResourceLimits().memory());
        Assertions.assertEquals("ek", model.containerResourceRequests().cpu());
        Assertions.assertEquals("eksnbksdqhjvyk", model.containerResourceRequests().gpu());
        Assertions.assertEquals("eslk", model.containerResourceRequests().memory());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ContainerResourceRequirements model =
            new ContainerResourceRequirements()
                .withContainerResourceLimits(
                    new ContainerResourceSettings().withCpu("wllcolsr").withGpu("apte").withMemory("excgjokjljnhvl"))
                .withContainerResourceRequests(
                    new ContainerResourceSettings().withCpu("ek").withGpu("eksnbksdqhjvyk").withMemory("eslk"));
        model = BinaryData.fromObject(model).toObject(ContainerResourceRequirements.class);
        Assertions.assertEquals("wllcolsr", model.containerResourceLimits().cpu());
        Assertions.assertEquals("apte", model.containerResourceLimits().gpu());
        Assertions.assertEquals("excgjokjljnhvl", model.containerResourceLimits().memory());
        Assertions.assertEquals("ek", model.containerResourceRequests().cpu());
        Assertions.assertEquals("eksnbksdqhjvyk", model.containerResourceRequests().gpu());
        Assertions.assertEquals("eslk", model.containerResourceRequests().memory());
    }
}
