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

package com.azure.resourcemanager.hdinsight.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hdinsight.models.MetricSpecifications;
import com.azure.resourcemanager.hdinsight.models.OperationProperties;
import com.azure.resourcemanager.hdinsight.models.ServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class OperationPropertiesTests {
    @Test
    public void testDeserialize() {
        OperationProperties model =
            BinaryData
                .fromString(
                    "{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"hirctymoxoftpipi\",\"displayName\":\"czuhxacpqjlihh\",\"displayDescription\":\"spskasdvlmfwdgz\",\"unit\":\"lucvpam\",\"aggregationType\":\"reuzvxurisjn\",\"supportedAggregationTypes\":[],\"supportedTimeGrainTypes\":[],\"enableRegionalMdmAccount\":true,\"sourceMdmAccount\":\"fq\",\"sourceMdmNamespace\":\"gxmrhublwp\",\"metricFilterPattern\":\"sutrgjup\",\"fillGapWithZero\":true,\"category\":\"p\",\"resourceIdDimensionNameOverride\":\"qhih\",\"isInternal\":false,\"delegateMetricNameOverride\":\"w\",\"dimensions\":[]}]}}")
                .toObject(OperationProperties.class);
        Assertions.assertEquals("hirctymoxoftpipi", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions
            .assertEquals("czuhxacpqjlihh", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions
            .assertEquals(
                "spskasdvlmfwdgz", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("lucvpam", model.serviceSpecification().metricSpecifications().get(0).unit());
        Assertions
            .assertEquals("reuzvxurisjn", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions
            .assertEquals(true, model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("fq", model.serviceSpecification().metricSpecifications().get(0).sourceMdmAccount());
        Assertions
            .assertEquals(
                "gxmrhublwp", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace());
        Assertions
            .assertEquals("sutrgjup", model.serviceSpecification().metricSpecifications().get(0).metricFilterPattern());
        Assertions.assertEquals(true, model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("p", model.serviceSpecification().metricSpecifications().get(0).category());
        Assertions
            .assertEquals(
                "qhih", model.serviceSpecification().metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions.assertEquals(false, model.serviceSpecification().metricSpecifications().get(0).isInternal());
        Assertions
            .assertEquals("w", model.serviceSpecification().metricSpecifications().get(0).delegateMetricNameOverride());
    }

    @Test
    public void testSerialize() {
        OperationProperties model =
            new OperationProperties()
                .withServiceSpecification(
                    new ServiceSpecification()
                        .withMetricSpecifications(
                            Arrays
                                .asList(
                                    new MetricSpecifications()
                                        .withName("hirctymoxoftpipi")
                                        .withDisplayName("czuhxacpqjlihh")
                                        .withDisplayDescription("spskasdvlmfwdgz")
                                        .withUnit("lucvpam")
                                        .withAggregationType("reuzvxurisjn")
                                        .withSupportedAggregationTypes(Arrays.asList())
                                        .withSupportedTimeGrainTypes(Arrays.asList())
                                        .withEnableRegionalMdmAccount(true)
                                        .withSourceMdmAccount("fq")
                                        .withSourceMdmNamespace("gxmrhublwp")
                                        .withMetricFilterPattern("sutrgjup")
                                        .withFillGapWithZero(true)
                                        .withCategory("p")
                                        .withResourceIdDimensionNameOverride("qhih")
                                        .withIsInternal(false)
                                        .withDelegateMetricNameOverride("w")
                                        .withDimensions(Arrays.asList()))));
        model = BinaryData.fromObject(model).toObject(OperationProperties.class);
        Assertions.assertEquals("hirctymoxoftpipi", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions
            .assertEquals("czuhxacpqjlihh", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions
            .assertEquals(
                "spskasdvlmfwdgz", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("lucvpam", model.serviceSpecification().metricSpecifications().get(0).unit());
        Assertions
            .assertEquals("reuzvxurisjn", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions
            .assertEquals(true, model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("fq", model.serviceSpecification().metricSpecifications().get(0).sourceMdmAccount());
        Assertions
            .assertEquals(
                "gxmrhublwp", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace());
        Assertions
            .assertEquals("sutrgjup", model.serviceSpecification().metricSpecifications().get(0).metricFilterPattern());
        Assertions.assertEquals(true, model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("p", model.serviceSpecification().metricSpecifications().get(0).category());
        Assertions
            .assertEquals(
                "qhih", model.serviceSpecification().metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions.assertEquals(false, model.serviceSpecification().metricSpecifications().get(0).isInternal());
        Assertions
            .assertEquals("w", model.serviceSpecification().metricSpecifications().get(0).delegateMetricNameOverride());
    }
}
