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

package com.azure.resourcemanager.resourcehealth.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.resourcehealth.models.Operation;
import com.azure.resourcemanager.resourcehealth.models.OperationDisplay;
import org.junit.jupiter.api.Assertions;

public final class OperationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        Operation model =
            BinaryData
                .fromString(
                    "{\"name\":\"btoqcjmkljavbqid\",\"display\":{\"provider\":\"jzyulpk\",\"resource\":\"jkrlkhbzhfepg\",\"operation\":\"qex\",\"description\":\"ocxscpaierhhbcs\"}}")
                .toObject(Operation.class);
        Assertions.assertEquals("btoqcjmkljavbqid", model.name());
        Assertions.assertEquals("jzyulpk", model.display().provider());
        Assertions.assertEquals("jkrlkhbzhfepg", model.display().resource());
        Assertions.assertEquals("qex", model.display().operation());
        Assertions.assertEquals("ocxscpaierhhbcs", model.display().description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        Operation model =
            new Operation()
                .withName("btoqcjmkljavbqid")
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("jzyulpk")
                        .withResource("jkrlkhbzhfepg")
                        .withOperation("qex")
                        .withDescription("ocxscpaierhhbcs"));
        model = BinaryData.fromObject(model).toObject(Operation.class);
        Assertions.assertEquals("btoqcjmkljavbqid", model.name());
        Assertions.assertEquals("jzyulpk", model.display().provider());
        Assertions.assertEquals("jkrlkhbzhfepg", model.display().resource());
        Assertions.assertEquals("qex", model.display().operation());
        Assertions.assertEquals("ocxscpaierhhbcs", model.display().description());
    }
}
