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

package com.azure.resourcemanager.maps.generated;

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

public final class OperationDetailInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationDetailInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"jbp\",\"isDataAction\":true,\"display\":{\"provider\":\"n\",\"resource\":\"v\",\"operation\":\"jrwzox\",\"description\":\"tfell\"},\"origin\":\"fziton\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[]}}}")
                .toObject(OperationDetailInner.class);
        Assertions.assertEquals("jbp", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("n", model.display().provider());
        Assertions.assertEquals("v", model.display().resource());
        Assertions.assertEquals("jrwzox", model.display().operation());
        Assertions.assertEquals("tfell", model.display().description());
        Assertions.assertEquals("fziton", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationDetailInner model =
            new OperationDetailInner()
                .withName("jbp")
                .withIsDataAction(true)
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("n")
                        .withResource("v")
                        .withOperation("jrwzox")
                        .withDescription("tfell"))
                .withOrigin("fziton")
                .withServiceSpecification(new ServiceSpecification().withMetricSpecifications(Arrays.asList()));
        model = BinaryData.fromObject(model).toObject(OperationDetailInner.class);
        Assertions.assertEquals("jbp", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("n", model.display().provider());
        Assertions.assertEquals("v", model.display().resource());
        Assertions.assertEquals("jrwzox", model.display().operation());
        Assertions.assertEquals("tfell", model.display().description());
        Assertions.assertEquals("fziton", model.origin());
    }
}
