// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.databoxedge.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.databoxedge.fluent.models.OperationInner;
import com.azure.resourcemanager.databoxedge.models.OperationDisplay;
import com.azure.resourcemanager.databoxedge.models.ServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"fogknygjofjdde\",\"display\":{\"provider\":\"deupewnwrei\",\"resource\":\"zyf\",\"operation\":\"sarhmofc\",\"description\":\"smy\"},\"origin\":\"kdtmlxhekuk\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[]}}}")
                .toObject(OperationInner.class);
        Assertions.assertEquals("fogknygjofjdde", model.name());
        Assertions.assertEquals("deupewnwrei", model.display().provider());
        Assertions.assertEquals("zyf", model.display().resource());
        Assertions.assertEquals("sarhmofc", model.display().operation());
        Assertions.assertEquals("smy", model.display().description());
        Assertions.assertEquals("kdtmlxhekuk", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationInner model =
            new OperationInner()
                .withName("fogknygjofjdde")
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("deupewnwrei")
                        .withResource("zyf")
                        .withOperation("sarhmofc")
                        .withDescription("smy"))
                .withOrigin("kdtmlxhekuk")
                .withServiceSpecification(new ServiceSpecification().withMetricSpecifications(Arrays.asList()));
        model = BinaryData.fromObject(model).toObject(OperationInner.class);
        Assertions.assertEquals("fogknygjofjdde", model.name());
        Assertions.assertEquals("deupewnwrei", model.display().provider());
        Assertions.assertEquals("zyf", model.display().resource());
        Assertions.assertEquals("sarhmofc", model.display().operation());
        Assertions.assertEquals("smy", model.display().description());
        Assertions.assertEquals("kdtmlxhekuk", model.origin());
    }
}
