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

package com.azure.resourcemanager.batch.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.batch.fluent.models.OperationInner;
import com.azure.resourcemanager.batch.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\":\"fhyhltrpmopjmcma\",\"isDataAction\":false,\"display\":{\"provider\":\"hfuiuaodsfc\",\"operation\":\"vxodpu\",\"resource\":\"myzydagfuaxbez\",\"description\":\"uokktwhrdxwz\"},\"origin\":\"q\",\"properties\":\"databsureximo\"}")
                .toObject(OperationInner.class);
        Assertions.assertEquals("fhyhltrpmopjmcma", model.name());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("hfuiuaodsfc", model.display().provider());
        Assertions.assertEquals("vxodpu", model.display().operation());
        Assertions.assertEquals("myzydagfuaxbez", model.display().resource());
        Assertions.assertEquals("uokktwhrdxwz", model.display().description());
        Assertions.assertEquals("q", model.origin());
    }

    @Test
    public void testSerialize() {
        OperationInner model =
            new OperationInner()
                .withName("fhyhltrpmopjmcma")
                .withIsDataAction(false)
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("hfuiuaodsfc")
                        .withOperation("vxodpu")
                        .withResource("myzydagfuaxbez")
                        .withDescription("uokktwhrdxwz"))
                .withOrigin("q")
                .withProperties("databsureximo");
        model = BinaryData.fromObject(model).toObject(OperationInner.class);
        Assertions.assertEquals("fhyhltrpmopjmcma", model.name());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("hfuiuaodsfc", model.display().provider());
        Assertions.assertEquals("vxodpu", model.display().operation());
        Assertions.assertEquals("myzydagfuaxbez", model.display().resource());
        Assertions.assertEquals("uokktwhrdxwz", model.display().description());
        Assertions.assertEquals("q", model.origin());
    }
}
