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

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ClientDiscoveryForProperties model =
            new ClientDiscoveryForProperties()
                .withServiceSpecification(
                    new ClientDiscoveryForServiceSpecification()
                        .withLogSpecifications(
                            Arrays
                                .asList(
                                    new ClientDiscoveryForLogSpecification()
                                        .withName("cspkwlhzdobpxjmf")
                                        .withDisplayName("vvnchrkcc")
                                        .withBlobDuration("wzjuqk"),
                                    new ClientDiscoveryForLogSpecification()
                                        .withName("sa")
                                        .withDisplayName("wkuofoskghsauu")
                                        .withBlobDuration("jmvxie"))));
        model = BinaryData.fromObject(model).toObject(ClientDiscoveryForProperties.class);
        Assertions.assertEquals("cspkwlhzdobpxjmf", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions.assertEquals("vvnchrkcc", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions.assertEquals("wzjuqk", model.serviceSpecification().logSpecifications().get(0).blobDuration());
    }
}
