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

package com.azure.resourcemanager.deploymentmanager.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.deploymentmanager.models.Operation;
import com.azure.resourcemanager.deploymentmanager.models.OperationDetail;
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\":\"ur\",\"display\":{\"provider\":\"xjnspy\",\"resource\":\"tko\",\"operation\":\"kouknvudwtiu\",\"description\":\"ldngkpoci\"},\"origin\":\"z\",\"properties\":\"datao\"}")
                .toObject(Operation.class);
        Assertions.assertEquals("ur", model.name());
        Assertions.assertEquals("xjnspy", model.display().provider());
        Assertions.assertEquals("tko", model.display().resource());
        Assertions.assertEquals("kouknvudwtiu", model.display().operation());
        Assertions.assertEquals("ldngkpoci", model.display().description());
        Assertions.assertEquals("z", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        Operation model =
            new Operation()
                .withName("ur")
                .withDisplay(
                    new OperationDetail()
                        .withProvider("xjnspy")
                        .withResource("tko")
                        .withOperation("kouknvudwtiu")
                        .withDescription("ldngkpoci"))
                .withOrigin("z")
                .withProperties("datao");
        model = BinaryData.fromObject(model).toObject(Operation.class);
        Assertions.assertEquals("ur", model.name());
        Assertions.assertEquals("xjnspy", model.display().provider());
        Assertions.assertEquals("tko", model.display().resource());
        Assertions.assertEquals("kouknvudwtiu", model.display().operation());
        Assertions.assertEquals("ldngkpoci", model.display().description());
        Assertions.assertEquals("z", model.origin());
    }
}
