// 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.ClientDiscoveryForServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ClientDiscoveryForServiceSpecificationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ClientDiscoveryForServiceSpecification model =
            BinaryData
                .fromString(
                    "{\"logSpecifications\":[{\"name\":\"idyjrrfbyaosvexc\",\"displayName\":\"npc\",\"blobDuration\":\"ocohslkevleg\"},{\"name\":\"fbuhfmvfaxkffe\",\"displayName\":\"th\",\"blobDuration\":\"m\"}]}")
                .toObject(ClientDiscoveryForServiceSpecification.class);
        Assertions.assertEquals("idyjrrfbyaosvexc", model.logSpecifications().get(0).name());
        Assertions.assertEquals("npc", model.logSpecifications().get(0).displayName());
        Assertions.assertEquals("ocohslkevleg", model.logSpecifications().get(0).blobDuration());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ClientDiscoveryForServiceSpecification model =
            new ClientDiscoveryForServiceSpecification()
                .withLogSpecifications(
                    Arrays
                        .asList(
                            new ClientDiscoveryForLogSpecification()
                                .withName("idyjrrfbyaosvexc")
                                .withDisplayName("npc")
                                .withBlobDuration("ocohslkevleg"),
                            new ClientDiscoveryForLogSpecification()
                                .withName("fbuhfmvfaxkffe")
                                .withDisplayName("th")
                                .withBlobDuration("m")));
        model = BinaryData.fromObject(model).toObject(ClientDiscoveryForServiceSpecification.class);
        Assertions.assertEquals("idyjrrfbyaosvexc", model.logSpecifications().get(0).name());
        Assertions.assertEquals("npc", model.logSpecifications().get(0).displayName());
        Assertions.assertEquals("ocohslkevleg", model.logSpecifications().get(0).blobDuration());
    }
}
