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

package com.azure.resourcemanager.recoveryservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservices.fluent.models.ClientDiscoveryValueForSingleApiInner;
import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryDisplay;
import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryForProperties;
import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryForServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ClientDiscoveryValueForSingleApiInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ClientDiscoveryValueForSingleApiInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"xim\",\"display\":{\"provider\":\"ocfs\",\"resource\":\"s\",\"operation\":\"ddystkiiuxhqy\",\"description\":\"xorrqnb\"},\"origin\":\"czvyifq\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[]}}}")
                .toObject(ClientDiscoveryValueForSingleApiInner.class);
        Assertions.assertEquals("xim", model.name());
        Assertions.assertEquals("ocfs", model.display().provider());
        Assertions.assertEquals("s", model.display().resource());
        Assertions.assertEquals("ddystkiiuxhqy", model.display().operation());
        Assertions.assertEquals("xorrqnb", model.display().description());
        Assertions.assertEquals("czvyifq", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ClientDiscoveryValueForSingleApiInner model =
            new ClientDiscoveryValueForSingleApiInner()
                .withName("xim")
                .withDisplay(
                    new ClientDiscoveryDisplay()
                        .withProvider("ocfs")
                        .withResource("s")
                        .withOperation("ddystkiiuxhqy")
                        .withDescription("xorrqnb"))
                .withOrigin("czvyifq")
                .withProperties(
                    new ClientDiscoveryForProperties()
                        .withServiceSpecification(
                            new ClientDiscoveryForServiceSpecification().withLogSpecifications(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(ClientDiscoveryValueForSingleApiInner.class);
        Assertions.assertEquals("xim", model.name());
        Assertions.assertEquals("ocfs", model.display().provider());
        Assertions.assertEquals("s", model.display().resource());
        Assertions.assertEquals("ddystkiiuxhqy", model.display().operation());
        Assertions.assertEquals("xorrqnb", model.display().description());
        Assertions.assertEquals("czvyifq", model.origin());
    }
}
