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

package com.azure.resourcemanager.purview.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.purview.fluent.models.OperationInner;
import com.azure.resourcemanager.purview.models.OperationDisplay;
import com.azure.resourcemanager.purview.models.OperationMetaServiceSpecification;
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(
                    "{\"display\":{\"description\":\"yiuokktwh\",\"operation\":\"xw\",\"provider\":\"wqsmbsur\",\"resource\":\"imoryocfsfksym\"},\"isDataAction\":false,\"name\":\"tki\",\"origin\":\"xhqyudxorrqnb\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[],\"metricSpecifications\":[]}}}")
                .toObject(OperationInner.class);
        Assertions.assertEquals("yiuokktwh", model.display().description());
        Assertions.assertEquals("xw", model.display().operation());
        Assertions.assertEquals("wqsmbsur", model.display().provider());
        Assertions.assertEquals("imoryocfsfksym", model.display().resource());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("tki", model.name());
        Assertions.assertEquals("xhqyudxorrqnb", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationInner model =
            new OperationInner()
                .withDisplay(
                    new OperationDisplay()
                        .withDescription("yiuokktwh")
                        .withOperation("xw")
                        .withProvider("wqsmbsur")
                        .withResource("imoryocfsfksym"))
                .withIsDataAction(false)
                .withName("tki")
                .withOrigin("xhqyudxorrqnb")
                .withServiceSpecification(
                    new OperationMetaServiceSpecification()
                        .withLogSpecifications(Arrays.asList())
                        .withMetricSpecifications(Arrays.asList()));
        model = BinaryData.fromObject(model).toObject(OperationInner.class);
        Assertions.assertEquals("yiuokktwh", model.display().description());
        Assertions.assertEquals("xw", model.display().operation());
        Assertions.assertEquals("wqsmbsur", model.display().provider());
        Assertions.assertEquals("imoryocfsfksym", model.display().resource());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("tki", model.name());
        Assertions.assertEquals("xhqyudxorrqnb", model.origin());
    }
}
