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

package com.azure.resourcemanager.storagecache.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.storagecache.fluent.models.ApiOperationInner;
import com.azure.resourcemanager.storagecache.models.ApiOperationDisplay;
import com.azure.resourcemanager.storagecache.models.ApiOperationPropertiesServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ApiOperationInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ApiOperationInner model =
            BinaryData
                .fromString(
                    "{\"display\":{\"operation\":\"po\",\"provider\":\"maajrmvdjwzrlo\",\"resource\":\"clwhijcoejctbz\",\"description\":\"s\"},\"origin\":\"y\",\"isDataAction\":false,\"name\":\"fkgukdkexxppof\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[],\"logSpecifications\":[]}}}")
                .toObject(ApiOperationInner.class);
        Assertions.assertEquals("po", model.display().operation());
        Assertions.assertEquals("maajrmvdjwzrlo", model.display().provider());
        Assertions.assertEquals("clwhijcoejctbz", model.display().resource());
        Assertions.assertEquals("s", model.display().description());
        Assertions.assertEquals("y", model.origin());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("fkgukdkexxppof", model.name());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ApiOperationInner model =
            new ApiOperationInner()
                .withDisplay(
                    new ApiOperationDisplay()
                        .withOperation("po")
                        .withProvider("maajrmvdjwzrlo")
                        .withResource("clwhijcoejctbz")
                        .withDescription("s"))
                .withOrigin("y")
                .withIsDataAction(false)
                .withName("fkgukdkexxppof")
                .withServiceSpecification(
                    new ApiOperationPropertiesServiceSpecification()
                        .withMetricSpecifications(Arrays.asList())
                        .withLogSpecifications(Arrays.asList()));
        model = BinaryData.fromObject(model).toObject(ApiOperationInner.class);
        Assertions.assertEquals("po", model.display().operation());
        Assertions.assertEquals("maajrmvdjwzrlo", model.display().provider());
        Assertions.assertEquals("clwhijcoejctbz", model.display().resource());
        Assertions.assertEquals("s", model.display().description());
        Assertions.assertEquals("y", model.origin());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("fkgukdkexxppof", model.name());
    }
}
