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

package com.azure.resourcemanager.maintenance.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.maintenance.fluent.models.OperationInner;
import com.azure.resourcemanager.maintenance.models.OperationInfo;
import org.junit.jupiter.api.Assertions;

public final class OperationInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"juvf\",\"display\":{\"provider\":\"rlyxwjkcprbnw\",\"resource\":\"gjvtbv\",\"operation\":\"sszdnru\",\"description\":\"guhmuouqfpr\"},\"origin\":\"wbnguitnwui\",\"properties\":\"dataa\",\"isDataAction\":true}")
                .toObject(OperationInner.class);
        Assertions.assertEquals("juvf", model.name());
        Assertions.assertEquals("rlyxwjkcprbnw", model.display().provider());
        Assertions.assertEquals("gjvtbv", model.display().resource());
        Assertions.assertEquals("sszdnru", model.display().operation());
        Assertions.assertEquals("guhmuouqfpr", model.display().description());
        Assertions.assertEquals("wbnguitnwui", model.origin());
        Assertions.assertEquals(true, model.isDataAction());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationInner model =
            new OperationInner()
                .withName("juvf")
                .withDisplay(
                    new OperationInfo()
                        .withProvider("rlyxwjkcprbnw")
                        .withResource("gjvtbv")
                        .withOperation("sszdnru")
                        .withDescription("guhmuouqfpr"))
                .withOrigin("wbnguitnwui")
                .withProperties("dataa")
                .withIsDataAction(true);
        model = BinaryData.fromObject(model).toObject(OperationInner.class);
        Assertions.assertEquals("juvf", model.name());
        Assertions.assertEquals("rlyxwjkcprbnw", model.display().provider());
        Assertions.assertEquals("gjvtbv", model.display().resource());
        Assertions.assertEquals("sszdnru", model.display().operation());
        Assertions.assertEquals("guhmuouqfpr", model.display().description());
        Assertions.assertEquals("wbnguitnwui", model.origin());
        Assertions.assertEquals(true, model.isDataAction());
    }
}
