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

public final class ServiceSpecificationTests {
    @Test
    public void testDeserialize() {
        ServiceSpecification model =
            BinaryData
                .fromString(
                    "{\"metricSpecifications\":[{\"name\":\"n\",\"displayName\":\"ypsxjvfoim\",\"displayDescription\":\"slirciz\",\"unit\":\"vydfceacvlhvygdy\",\"aggregationType\":\"umrtwnawjsl\",\"supportedAggregationTypes\":[\"kojgcyzts\",\"mznbaeqphch\",\"nrnrp\",\"ehuwrykqgaifmvik\"],\"supportedTimeGrainTypes\":[\"dvk\"],\"enableRegionalMdmAccount\":false,\"sourceMdmAccount\":\"dznx\",\"sourceMdmNamespace\":\"dsrhnjiv\",\"metricFilterPattern\":\"v\",\"fillGapWithZero\":false,\"category\":\"qfzgemjdftul\",\"resourceIdDimensionNameOverride\":\"tduceamt\",\"isInternal\":false,\"delegateMetricNameOverride\":\"o\",\"dimensions\":[]},{\"name\":\"cwwqiokn\",\"displayName\":\"xmojmsvpkjp\",\"displayDescription\":\"kwcf\",\"unit\":\"ljyxgtczhe\",\"aggregationType\":\"bsdshmkxmaehvbbx\",\"supportedAggregationTypes\":[\"pltfnhtba\"],\"supportedTimeGrainTypes\":[\"xywr\"],\"enableRegionalMdmAccount\":true,\"sourceMdmAccount\":\"kl\",\"sourceMdmNamespace\":\"pluodpv\",\"metricFilterPattern\":\"udlgzibthostgkts\",\"fillGapWithZero\":true,\"category\":\"eclze\",\"resourceIdDimensionNameOverride\":\"bcvhzlhpl\",\"isInternal\":false,\"delegateMetricNameOverride\":\"dlwwqfbumlkxt\",\"dimensions\":[]}]}")
                .toObject(ServiceSpecification.class);
        Assertions.assertEquals("n", model.metricSpecifications().get(0).name());
        Assertions.assertEquals("ypsxjvfoim", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("slirciz", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("vydfceacvlhvygdy", model.metricSpecifications().get(0).unit());
        Assertions.assertEquals("umrtwnawjsl", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("kojgcyzts", model.metricSpecifications().get(0).supportedAggregationTypes().get(0));
        Assertions.assertEquals("dvk", model.metricSpecifications().get(0).supportedTimeGrainTypes().get(0));
        Assertions.assertEquals(false, model.metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("dznx", model.metricSpecifications().get(0).sourceMdmAccount());
        Assertions.assertEquals("dsrhnjiv", model.metricSpecifications().get(0).sourceMdmNamespace());
        Assertions.assertEquals("v", model.metricSpecifications().get(0).metricFilterPattern());
        Assertions.assertEquals(false, model.metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("qfzgemjdftul", model.metricSpecifications().get(0).category());
        Assertions.assertEquals("tduceamt", model.metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions.assertEquals(false, model.metricSpecifications().get(0).isInternal());
        Assertions.assertEquals("o", model.metricSpecifications().get(0).delegateMetricNameOverride());
    }

    @Test
    public void testSerialize() {
        ServiceSpecification model =
            new ServiceSpecification()
                .withMetricSpecifications(
                    Arrays
                        .asList(
                            new MetricSpecifications()
                                .withName("n")
                                .withDisplayName("ypsxjvfoim")
                                .withDisplayDescription("slirciz")
                                .withUnit("vydfceacvlhvygdy")
                                .withAggregationType("umrtwnawjsl")
                                .withSupportedAggregationTypes(
                                    Arrays.asList("kojgcyzts", "mznbaeqphch", "nrnrp", "ehuwrykqgaifmvik"))
                                .withSupportedTimeGrainTypes(Arrays.asList("dvk"))
                                .withEnableRegionalMdmAccount(false)
                                .withSourceMdmAccount("dznx")
                                .withSourceMdmNamespace("dsrhnjiv")
                                .withMetricFilterPattern("v")
                                .withFillGapWithZero(false)
                                .withCategory("qfzgemjdftul")
                                .withResourceIdDimensionNameOverride("tduceamt")
                                .withIsInternal(false)
                                .withDelegateMetricNameOverride("o")
                                .withDimensions(Arrays.asList()),
                            new MetricSpecifications()
                                .withName("cwwqiokn")
                                .withDisplayName("xmojmsvpkjp")
                                .withDisplayDescription("kwcf")
                                .withUnit("ljyxgtczhe")
                                .withAggregationType("bsdshmkxmaehvbbx")
                                .withSupportedAggregationTypes(Arrays.asList("pltfnhtba"))
                                .withSupportedTimeGrainTypes(Arrays.asList("xywr"))
                                .withEnableRegionalMdmAccount(true)
                                .withSourceMdmAccount("kl")
                                .withSourceMdmNamespace("pluodpv")
                                .withMetricFilterPattern("udlgzibthostgkts")
                                .withFillGapWithZero(true)
                                .withCategory("eclze")
                                .withResourceIdDimensionNameOverride("bcvhzlhpl")
                                .withIsInternal(false)
                                .withDelegateMetricNameOverride("dlwwqfbumlkxt")
                                .withDimensions(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(ServiceSpecification.class);
        Assertions.assertEquals("n", model.metricSpecifications().get(0).name());
        Assertions.assertEquals("ypsxjvfoim", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("slirciz", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("vydfceacvlhvygdy", model.metricSpecifications().get(0).unit());
        Assertions.assertEquals("umrtwnawjsl", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("kojgcyzts", model.metricSpecifications().get(0).supportedAggregationTypes().get(0));
        Assertions.assertEquals("dvk", model.metricSpecifications().get(0).supportedTimeGrainTypes().get(0));
        Assertions.assertEquals(false, model.metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("dznx", model.metricSpecifications().get(0).sourceMdmAccount());
        Assertions.assertEquals("dsrhnjiv", model.metricSpecifications().get(0).sourceMdmNamespace());
        Assertions.assertEquals("v", model.metricSpecifications().get(0).metricFilterPattern());
        Assertions.assertEquals(false, model.metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("qfzgemjdftul", model.metricSpecifications().get(0).category());
        Assertions.assertEquals("tduceamt", model.metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions.assertEquals(false, model.metricSpecifications().get(0).isInternal());
        Assertions.assertEquals("o", model.metricSpecifications().get(0).delegateMetricNameOverride());
    }
}
