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

package com.azure.resourcemanager.appconfiguration.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.appconfiguration.fluent.models.OperationDefinitionInner;
import com.azure.resourcemanager.appconfiguration.models.OperationDefinitionDisplay;
import com.azure.resourcemanager.appconfiguration.models.OperationProperties;
import com.azure.resourcemanager.appconfiguration.models.ServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationDefinitionInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationDefinitionInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"axcfjpgddtocjjx\",\"isDataAction\":true,\"display\":{\"provider\":\"uexhdzx\",\"resource\":\"qeojnxqbzvddntw\",\"operation\":\"eic\",\"description\":\"w\"},\"origin\":\"zao\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[],\"metricSpecifications\":[]}}}")
                .toObject(OperationDefinitionInner.class);
        Assertions.assertEquals("axcfjpgddtocjjx", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("qeojnxqbzvddntw", model.display().resource());
        Assertions.assertEquals("eic", model.display().operation());
        Assertions.assertEquals("w", model.display().description());
        Assertions.assertEquals("zao", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationDefinitionInner model =
            new OperationDefinitionInner()
                .withName("axcfjpgddtocjjx")
                .withIsDataAction(true)
                .withDisplay(
                    new OperationDefinitionDisplay()
                        .withResource("qeojnxqbzvddntw")
                        .withOperation("eic")
                        .withDescription("w"))
                .withOrigin("zao")
                .withProperties(
                    new OperationProperties()
                        .withServiceSpecification(
                            new ServiceSpecification()
                                .withLogSpecifications(Arrays.asList())
                                .withMetricSpecifications(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(OperationDefinitionInner.class);
        Assertions.assertEquals("axcfjpgddtocjjx", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("qeojnxqbzvddntw", model.display().resource());
        Assertions.assertEquals("eic", model.display().operation());
        Assertions.assertEquals("w", model.display().description());
        Assertions.assertEquals("zao", model.origin());
    }
}
