// 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.models.ClientDiscoveryForLogSpecification;
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 ClientDiscoveryForPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ClientDiscoveryForProperties model =
            BinaryData
                .fromString(
                    "{\"serviceSpecification\":{\"logSpecifications\":[{\"blobDuration\":\"dxkqpx\",\"displayName\":\"ajionpimexgstxg\",\"name\":\"odgmaajrmvdjwz\"},{\"blobDuration\":\"ovmclwhijcoejct\",\"displayName\":\"aqsqsycbkbfk\",\"name\":\"kdkexxp\"}]}}")
                .toObject(ClientDiscoveryForProperties.class);
        Assertions.assertEquals("dxkqpx", model.serviceSpecification().logSpecifications().get(0).blobDuration());
        Assertions
            .assertEquals("ajionpimexgstxg", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions.assertEquals("odgmaajrmvdjwz", model.serviceSpecification().logSpecifications().get(0).name());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ClientDiscoveryForProperties model =
            new ClientDiscoveryForProperties()
                .withServiceSpecification(
                    new ClientDiscoveryForServiceSpecification()
                        .withLogSpecifications(
                            Arrays
                                .asList(
                                    new ClientDiscoveryForLogSpecification()
                                        .withBlobDuration("dxkqpx")
                                        .withDisplayName("ajionpimexgstxg")
                                        .withName("odgmaajrmvdjwz"),
                                    new ClientDiscoveryForLogSpecification()
                                        .withBlobDuration("ovmclwhijcoejct")
                                        .withDisplayName("aqsqsycbkbfk")
                                        .withName("kdkexxp"))));
        model = BinaryData.fromObject(model).toObject(ClientDiscoveryForProperties.class);
        Assertions.assertEquals("dxkqpx", model.serviceSpecification().logSpecifications().get(0).blobDuration());
        Assertions
            .assertEquals("ajionpimexgstxg", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions.assertEquals("odgmaajrmvdjwz", model.serviceSpecification().logSpecifications().get(0).name());
    }
}
