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

package com.azure.resourcemanager.dataprotection.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.dataprotection.fluent.models.ClientDiscoveryValueForSingleApiInner;
import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryDisplay;
import com.azure.resourcemanager.dataprotection.models.ClientDiscoveryForProperties;
import com.azure.resourcemanager.dataprotection.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(
                    "{\"display\":{\"description\":\"pgrjbz\",\"operation\":\"rcjxvsnbyxqabn\",\"provider\":\"cpc\",\"resource\":\"hurzafblj\"},\"name\":\"pbtoqcjmkl\",\"isDataAction\":false,\"origin\":\"qidtqajzyu\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[]}}}")
                .toObject(ClientDiscoveryValueForSingleApiInner.class);
        Assertions.assertEquals("pgrjbz", model.display().description());
        Assertions.assertEquals("rcjxvsnbyxqabn", model.display().operation());
        Assertions.assertEquals("cpc", model.display().provider());
        Assertions.assertEquals("hurzafblj", model.display().resource());
        Assertions.assertEquals("pbtoqcjmkl", model.name());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("qidtqajzyu", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ClientDiscoveryValueForSingleApiInner model =
            new ClientDiscoveryValueForSingleApiInner()
                .withDisplay(
                    new ClientDiscoveryDisplay()
                        .withDescription("pgrjbz")
                        .withOperation("rcjxvsnbyxqabn")
                        .withProvider("cpc")
                        .withResource("hurzafblj"))
                .withName("pbtoqcjmkl")
                .withIsDataAction(false)
                .withOrigin("qidtqajzyu")
                .withProperties(
                    new ClientDiscoveryForProperties()
                        .withServiceSpecification(
                            new ClientDiscoveryForServiceSpecification().withLogSpecifications(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(ClientDiscoveryValueForSingleApiInner.class);
        Assertions.assertEquals("pgrjbz", model.display().description());
        Assertions.assertEquals("rcjxvsnbyxqabn", model.display().operation());
        Assertions.assertEquals("cpc", model.display().provider());
        Assertions.assertEquals("hurzafblj", model.display().resource());
        Assertions.assertEquals("pbtoqcjmkl", model.name());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("qidtqajzyu", model.origin());
    }
}
