// 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\":\"isgwbnbbeldawkz\",\"display\":{\"provider\":\"io\",\"resource\":\"qhakauhashsf\",\"operation\":\"osow\",\"description\":\"cugicjoox\"},\"origin\":\"ebwpucwwfvo\",\"properties\":\"datavmeueci\",\"isDataAction\":true}")
                .toObject(OperationInner.class);
        Assertions.assertEquals("isgwbnbbeldawkz", model.name());
        Assertions.assertEquals("io", model.display().provider());
        Assertions.assertEquals("qhakauhashsf", model.display().resource());
        Assertions.assertEquals("osow", model.display().operation());
        Assertions.assertEquals("cugicjoox", model.display().description());
        Assertions.assertEquals("ebwpucwwfvo", model.origin());
        Assertions.assertEquals(true, model.isDataAction());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationInner model =
            new OperationInner()
                .withName("isgwbnbbeldawkz")
                .withDisplay(
                    new OperationInfo()
                        .withProvider("io")
                        .withResource("qhakauhashsf")
                        .withOperation("osow")
                        .withDescription("cugicjoox"))
                .withOrigin("ebwpucwwfvo")
                .withProperties("datavmeueci")
                .withIsDataAction(true);
        model = BinaryData.fromObject(model).toObject(OperationInner.class);
        Assertions.assertEquals("isgwbnbbeldawkz", model.name());
        Assertions.assertEquals("io", model.display().provider());
        Assertions.assertEquals("qhakauhashsf", model.display().resource());
        Assertions.assertEquals("osow", model.display().operation());
        Assertions.assertEquals("cugicjoox", model.display().description());
        Assertions.assertEquals("ebwpucwwfvo", model.origin());
        Assertions.assertEquals(true, model.isDataAction());
    }
}
