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

package com.azure.resourcemanager.elastic.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.elastic.fluent.models.OperationResultInner;
import com.azure.resourcemanager.elastic.models.OperationDisplay;
import org.junit.jupiter.api.Assertions;

public final class OperationResultInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationResultInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"txukcdmp\"}")
                .toObject(OperationResultInner.class);
        Assertions.assertEquals("nygj", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("eqsrdeupewnwreit", model.display().provider());
        Assertions.assertEquals("yflusarhmofc", model.display().resource());
        Assertions.assertEquals("smy", model.display().operation());
        Assertions.assertEquals("kdtmlxhekuk", model.display().description());
        Assertions.assertEquals("txukcdmp", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationResultInner model =
            new OperationResultInner()
                .withName("nygj")
                .withIsDataAction(true)
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("eqsrdeupewnwreit")
                        .withResource("yflusarhmofc")
                        .withOperation("smy")
                        .withDescription("kdtmlxhekuk"))
                .withOrigin("txukcdmp");
        model = BinaryData.fromObject(model).toObject(OperationResultInner.class);
        Assertions.assertEquals("nygj", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("eqsrdeupewnwreit", model.display().provider());
        Assertions.assertEquals("yflusarhmofc", model.display().resource());
        Assertions.assertEquals("smy", model.display().operation());
        Assertions.assertEquals("kdtmlxhekuk", model.display().description());
        Assertions.assertEquals("txukcdmp", model.origin());
    }
}
