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

package com.azure.resourcemanager.hdinsight.generated;

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

public final class OperationInnerTests {
    @Test
    public void testDeserialize() {
        OperationInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"vgrvkffo\",\"display\":{\"provider\":\"hpjbib\",\"resource\":\"mfxumvfcluyovw\",\"operation\":\"bkfezzxscyhwzdgi\",\"description\":\"jbzbomvzzbtdcq\"},\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[]}}}")
                .toObject(OperationInner.class);
        Assertions.assertEquals("vgrvkffo", model.name());
        Assertions.assertEquals("hpjbib", model.display().provider());
        Assertions.assertEquals("mfxumvfcluyovw", model.display().resource());
        Assertions.assertEquals("bkfezzxscyhwzdgi", model.display().operation());
        Assertions.assertEquals("jbzbomvzzbtdcq", model.display().description());
    }

    @Test
    public void testSerialize() {
        OperationInner model =
            new OperationInner()
                .withName("vgrvkffo")
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("hpjbib")
                        .withResource("mfxumvfcluyovw")
                        .withOperation("bkfezzxscyhwzdgi")
                        .withDescription("jbzbomvzzbtdcq"))
                .withProperties(
                    new OperationProperties()
                        .withServiceSpecification(
                            new ServiceSpecification().withMetricSpecifications(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(OperationInner.class);
        Assertions.assertEquals("vgrvkffo", model.name());
        Assertions.assertEquals("hpjbib", model.display().provider());
        Assertions.assertEquals("mfxumvfcluyovw", model.display().resource());
        Assertions.assertEquals("bkfezzxscyhwzdgi", model.display().operation());
        Assertions.assertEquals("jbzbomvzzbtdcq", model.display().description());
    }
}
