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

package com.azure.resourcemanager.resourcegraph.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner;
import com.azure.resourcemanager.resourcegraph.models.OperationDisplay;
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\":\"iwbybrkxvdumjg\",\"display\":{\"provider\":\"wvukx\",\"resource\":\"udccsnhsjc\",\"operation\":\"ejhkry\",\"description\":\"napczwlokjy\"},\"origin\":\"kkvnipjox\"}")
                .toObject(OperationInner.class);
        Assertions.assertEquals("iwbybrkxvdumjg", model.name());
        Assertions.assertEquals("wvukx", model.display().provider());
        Assertions.assertEquals("udccsnhsjc", model.display().resource());
        Assertions.assertEquals("ejhkry", model.display().operation());
        Assertions.assertEquals("napczwlokjy", model.display().description());
        Assertions.assertEquals("kkvnipjox", model.origin());
    }

    @Test
    public void testSerialize() {
        OperationInner model =
            new OperationInner()
                .withName("iwbybrkxvdumjg")
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("wvukx")
                        .withResource("udccsnhsjc")
                        .withOperation("ejhkry")
                        .withDescription("napczwlokjy"))
                .withOrigin("kkvnipjox");
        model = BinaryData.fromObject(model).toObject(OperationInner.class);
        Assertions.assertEquals("iwbybrkxvdumjg", model.name());
        Assertions.assertEquals("wvukx", model.display().provider());
        Assertions.assertEquals("udccsnhsjc", model.display().resource());
        Assertions.assertEquals("ejhkry", model.display().operation());
        Assertions.assertEquals("napczwlokjy", model.display().description());
        Assertions.assertEquals("kkvnipjox", model.origin());
    }
}
