// 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.Dimension;
import com.azure.resourcemanager.hdinsight.models.MetricSpecifications;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class MetricSpecificationsTests {
    @Test
    public void testDeserialize() {
        MetricSpecifications model =
            BinaryData
                .fromString(
                    "{\"name\":\"smlmbtxhwgfwsrta\",\"displayName\":\"oezbrhubsk\",\"displayDescription\":\"dyg\",\"unit\":\"okkqfqjbvleo\",\"aggregationType\":\"ml\",\"supportedAggregationTypes\":[\"tqzfavyv\",\"qqybarye\",\"ayjkqa\"],\"supportedTimeGrainTypes\":[\"zslesjcbher\",\"ntiew\",\"jcvb\",\"uwrbehwagoh\"],\"enableRegionalMdmAccount\":false,\"sourceMdmAccount\":\"kmr\",\"sourceMdmNamespace\":\"mvvhmxtdrjfuta\",\"metricFilterPattern\":\"ebjvewzcjzn\",\"fillGapWithZero\":true,\"category\":\"mguaadraufa\",\"resourceIdDimensionNameOverride\":\"kahzo\",\"isInternal\":true,\"delegateMetricNameOverride\":\"ziuxxpshnee\",\"dimensions\":[{\"name\":\"gs\",\"displayName\":\"ubkwdle\",\"internalName\":\"d\",\"toBeExportedForShoebox\":true}]}")
                .toObject(MetricSpecifications.class);
        Assertions.assertEquals("smlmbtxhwgfwsrta", model.name());
        Assertions.assertEquals("oezbrhubsk", model.displayName());
        Assertions.assertEquals("dyg", model.displayDescription());
        Assertions.assertEquals("okkqfqjbvleo", model.unit());
        Assertions.assertEquals("ml", model.aggregationType());
        Assertions.assertEquals("tqzfavyv", model.supportedAggregationTypes().get(0));
        Assertions.assertEquals("zslesjcbher", model.supportedTimeGrainTypes().get(0));
        Assertions.assertEquals(false, model.enableRegionalMdmAccount());
        Assertions.assertEquals("kmr", model.sourceMdmAccount());
        Assertions.assertEquals("mvvhmxtdrjfuta", model.sourceMdmNamespace());
        Assertions.assertEquals("ebjvewzcjzn", model.metricFilterPattern());
        Assertions.assertEquals(true, model.fillGapWithZero());
        Assertions.assertEquals("mguaadraufa", model.category());
        Assertions.assertEquals("kahzo", model.resourceIdDimensionNameOverride());
        Assertions.assertEquals(true, model.isInternal());
        Assertions.assertEquals("ziuxxpshnee", model.delegateMetricNameOverride());
        Assertions.assertEquals("gs", model.dimensions().get(0).name());
        Assertions.assertEquals("ubkwdle", model.dimensions().get(0).displayName());
        Assertions.assertEquals("d", model.dimensions().get(0).internalName());
        Assertions.assertEquals(true, model.dimensions().get(0).toBeExportedForShoebox());
    }

    @Test
    public void testSerialize() {
        MetricSpecifications model =
            new MetricSpecifications()
                .withName("smlmbtxhwgfwsrta")
                .withDisplayName("oezbrhubsk")
                .withDisplayDescription("dyg")
                .withUnit("okkqfqjbvleo")
                .withAggregationType("ml")
                .withSupportedAggregationTypes(Arrays.asList("tqzfavyv", "qqybarye", "ayjkqa"))
                .withSupportedTimeGrainTypes(Arrays.asList("zslesjcbher", "ntiew", "jcvb", "uwrbehwagoh"))
                .withEnableRegionalMdmAccount(false)
                .withSourceMdmAccount("kmr")
                .withSourceMdmNamespace("mvvhmxtdrjfuta")
                .withMetricFilterPattern("ebjvewzcjzn")
                .withFillGapWithZero(true)
                .withCategory("mguaadraufa")
                .withResourceIdDimensionNameOverride("kahzo")
                .withIsInternal(true)
                .withDelegateMetricNameOverride("ziuxxpshnee")
                .withDimensions(
                    Arrays
                        .asList(
                            new Dimension()
                                .withName("gs")
                                .withDisplayName("ubkwdle")
                                .withInternalName("d")
                                .withToBeExportedForShoebox(true)));
        model = BinaryData.fromObject(model).toObject(MetricSpecifications.class);
        Assertions.assertEquals("smlmbtxhwgfwsrta", model.name());
        Assertions.assertEquals("oezbrhubsk", model.displayName());
        Assertions.assertEquals("dyg", model.displayDescription());
        Assertions.assertEquals("okkqfqjbvleo", model.unit());
        Assertions.assertEquals("ml", model.aggregationType());
        Assertions.assertEquals("tqzfavyv", model.supportedAggregationTypes().get(0));
        Assertions.assertEquals("zslesjcbher", model.supportedTimeGrainTypes().get(0));
        Assertions.assertEquals(false, model.enableRegionalMdmAccount());
        Assertions.assertEquals("kmr", model.sourceMdmAccount());
        Assertions.assertEquals("mvvhmxtdrjfuta", model.sourceMdmNamespace());
        Assertions.assertEquals("ebjvewzcjzn", model.metricFilterPattern());
        Assertions.assertEquals(true, model.fillGapWithZero());
        Assertions.assertEquals("mguaadraufa", model.category());
        Assertions.assertEquals("kahzo", model.resourceIdDimensionNameOverride());
        Assertions.assertEquals(true, model.isInternal());
        Assertions.assertEquals("ziuxxpshnee", model.delegateMetricNameOverride());
        Assertions.assertEquals("gs", model.dimensions().get(0).name());
        Assertions.assertEquals("ubkwdle", model.dimensions().get(0).displayName());
        Assertions.assertEquals("d", model.dimensions().get(0).internalName());
        Assertions.assertEquals(true, model.dimensions().get(0).toBeExportedForShoebox());
    }
}
