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

package com.azure.resourcemanager.powerbidedicated.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.powerbidedicated.models.LogSpecification;
import com.azure.resourcemanager.powerbidedicated.models.MetricSpecification;
import com.azure.resourcemanager.powerbidedicated.models.OperationProperties;
import com.azure.resourcemanager.powerbidedicated.models.ServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationProperties model =
            BinaryData
                .fromString(
                    "{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"zafb\",\"displayName\":\"j\",\"displayDescription\":\"btoqcjmkljavbqid\",\"unit\":\"ajzyul\",\"aggregationType\":\"u\",\"metricFilterPattern\":\"krlkhbzhfepg\",\"dimensions\":[]},{\"name\":\"e\",\"displayName\":\"locx\",\"displayDescription\":\"paierh\",\"unit\":\"csglum\",\"aggregationType\":\"jtjaodxobnbdxkq\",\"metricFilterPattern\":\"okaj\",\"dimensions\":[]}],\"logSpecifications\":[{\"name\":\"mexgstxgcp\",\"displayName\":\"gmaajrm\",\"blobDuration\":\"jwzrl\"},{\"name\":\"mcl\",\"displayName\":\"ijcoejctb\",\"blobDuration\":\"qsqsy\"},{\"name\":\"kbfkg\",\"displayName\":\"dkexxppofm\",\"blobDuration\":\"x\"},{\"name\":\"jpgd\",\"displayName\":\"ocjjxhvpmouexh\",\"blobDuration\":\"xibqeojnx\"}]}}")
                .toObject(OperationProperties.class);
        Assertions.assertEquals("j", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions
            .assertEquals(
                "btoqcjmkljavbqid", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("gmaajrm", model.serviceSpecification().logSpecifications().get(0).displayName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationProperties model =
            new OperationProperties()
                .withServiceSpecification(
                    new ServiceSpecification()
                        .withMetricSpecifications(
                            Arrays
                                .asList(
                                    new MetricSpecification()
                                        .withDisplayName("j")
                                        .withDisplayDescription("btoqcjmkljavbqid")
                                        .withDimensions(Arrays.asList()),
                                    new MetricSpecification()
                                        .withDisplayName("locx")
                                        .withDisplayDescription("paierh")
                                        .withDimensions(Arrays.asList())))
                        .withLogSpecifications(
                            Arrays
                                .asList(
                                    new LogSpecification().withDisplayName("gmaajrm"),
                                    new LogSpecification().withDisplayName("ijcoejctb"),
                                    new LogSpecification().withDisplayName("dkexxppofm"),
                                    new LogSpecification().withDisplayName("ocjjxhvpmouexh"))));
        model = BinaryData.fromObject(model).toObject(OperationProperties.class);
        Assertions.assertEquals("j", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions
            .assertEquals(
                "btoqcjmkljavbqid", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("gmaajrm", model.serviceSpecification().logSpecifications().get(0).displayName());
    }
}
