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

package com.azure.resourcemanager.mixedreality.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mixedreality.fluent.models.OperationInner;
import com.azure.resourcemanager.mixedreality.models.OperationDisplay;
import com.azure.resourcemanager.mixedreality.models.OperationProperties;
import com.azure.resourcemanager.mixedreality.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\":\"itjz\",\"display\":{\"provider\":\"lusarh\",\"resource\":\"ofcqhsm\",\"operation\":\"urkdtmlx\",\"description\":\"ekuksjtx\"},\"isDataAction\":false,\"origin\":\"mparcryuanzw\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[],\"metricSpecifications\":[]}}}")
                .toObject(OperationInner.class);
        Assertions.assertEquals("itjz", model.name());
        Assertions.assertEquals("lusarh", model.display().provider());
        Assertions.assertEquals("ofcqhsm", model.display().resource());
        Assertions.assertEquals("urkdtmlx", model.display().operation());
        Assertions.assertEquals("ekuksjtx", model.display().description());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("mparcryuanzw", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationInner model =
            new OperationInner()
                .withName("itjz")
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("lusarh")
                        .withResource("ofcqhsm")
                        .withOperation("urkdtmlx")
                        .withDescription("ekuksjtx"))
                .withIsDataAction(false)
                .withOrigin("mparcryuanzw")
                .withProperties(
                    new OperationProperties()
                        .withServiceSpecification(
                            new ServiceSpecification()
                                .withLogSpecifications(Arrays.asList())
                                .withMetricSpecifications(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(OperationInner.class);
        Assertions.assertEquals("itjz", model.name());
        Assertions.assertEquals("lusarh", model.display().provider());
        Assertions.assertEquals("ofcqhsm", model.display().resource());
        Assertions.assertEquals("urkdtmlx", model.display().operation());
        Assertions.assertEquals("ekuksjtx", model.display().description());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("mparcryuanzw", model.origin());
    }
}
