// 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.models.ClientDiscoveryForLogSpecification;
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 ClientDiscoveryForPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ClientDiscoveryForProperties model =
            BinaryData
                .fromString(
                    "{\"serviceSpecification\":{\"logSpecifications\":[{\"name\":\"mijcmmxdcufufs\",\"displayName\":\"ymzidn\",\"blobDuration\":\"zcxtbzsgfyccsn\"},{\"name\":\"mdwzjeiachboo\",\"displayName\":\"lnrosfqp\",\"blobDuration\":\"ehzzvypyqrim\"},{\"name\":\"npvswjdkirso\",\"displayName\":\"qxhcrmn\",\"blobDuration\":\"jtckwhdso\"},{\"name\":\"iy\",\"displayName\":\"jxsqwpgrjbz\",\"blobDuration\":\"rcjxvsnbyxqabn\"}]}}")
                .toObject(ClientDiscoveryForProperties.class);
        Assertions.assertEquals("mijcmmxdcufufs", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions.assertEquals("ymzidn", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions
            .assertEquals("zcxtbzsgfyccsn", 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("mijcmmxdcufufs")
                                        .withDisplayName("ymzidn")
                                        .withBlobDuration("zcxtbzsgfyccsn"),
                                    new ClientDiscoveryForLogSpecification()
                                        .withName("mdwzjeiachboo")
                                        .withDisplayName("lnrosfqp")
                                        .withBlobDuration("ehzzvypyqrim"),
                                    new ClientDiscoveryForLogSpecification()
                                        .withName("npvswjdkirso")
                                        .withDisplayName("qxhcrmn")
                                        .withBlobDuration("jtckwhdso"),
                                    new ClientDiscoveryForLogSpecification()
                                        .withName("iy")
                                        .withDisplayName("jxsqwpgrjbz")
                                        .withBlobDuration("rcjxvsnbyxqabn"))));
        model = BinaryData.fromObject(model).toObject(ClientDiscoveryForProperties.class);
        Assertions.assertEquals("mijcmmxdcufufs", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions.assertEquals("ymzidn", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions
            .assertEquals("zcxtbzsgfyccsn", model.serviceSpecification().logSpecifications().get(0).blobDuration());
    }
}
