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

package com.azure.resourcemanager.recoveryservicesbackup.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ClientDiscoveryValueForSingleApiInner;
import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryDisplay;
import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForProperties;
import com.azure.resourcemanager.recoveryservicesbackup.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\":\"prbnwbxgjvtbv\",\"display\":{\"provider\":\"szdnr\",\"resource\":\"qguhmuo\",\"operation\":\"f\",\"description\":\"wzwbnguitn\"},\"origin\":\"izgazxu\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[]}}}")
                .toObject(ClientDiscoveryValueForSingleApiInner.class);
        Assertions.assertEquals("prbnwbxgjvtbv", model.name());
        Assertions.assertEquals("szdnr", model.display().provider());
        Assertions.assertEquals("qguhmuo", model.display().resource());
        Assertions.assertEquals("f", model.display().operation());
        Assertions.assertEquals("wzwbnguitn", model.display().description());
        Assertions.assertEquals("izgazxu", model.origin());
    }

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