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

package com.azure.resourcemanager.mixedreality.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mixedreality.models.MetricDimension;
import com.azure.resourcemanager.mixedreality.models.MetricSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MetricSpecificationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MetricSpecification model =
            BinaryData
                .fromString(
                    "{\"name\":\"sne\",\"displayName\":\"dwzjeiach\",\"displayDescription\":\"osfln\",\"unit\":\"sfqpteehz\",\"aggregationType\":\"ypyqrimzinp\",\"supportedAggregationTypes\":[\"jdkirsoodqx\"],\"supportedTimeGrainTypes\":[\"mnoh\",\"t\"],\"enableRegionalMdmAccount\":true,\"sourceMdmAccount\":\"dsoifiyipj\",\"sourceMdmNamespace\":\"qwpgrjbzn\",\"metricFilterPattern\":\"cjxvsnbyxqab\",\"fillGapWithZero\":false,\"category\":\"pcyshu\",\"internalMetricName\":\"afbljjgpbtoqcjmk\",\"dimensions\":[{\"name\":\"bqidtqaj\",\"displayName\":\"ulpkudjkrl\",\"internalName\":\"bzhfepgzgqexz\",\"toBeExportedForShoebox\":false}],\"lockedAggregationType\":\"scpai\"}")
                .toObject(MetricSpecification.class);
        Assertions.assertEquals("sne", model.name());
        Assertions.assertEquals("dwzjeiach", model.displayName());
        Assertions.assertEquals("osfln", model.displayDescription());
        Assertions.assertEquals("sfqpteehz", model.unit());
        Assertions.assertEquals("ypyqrimzinp", model.aggregationType());
        Assertions.assertEquals("jdkirsoodqx", model.supportedAggregationTypes().get(0));
        Assertions.assertEquals("mnoh", model.supportedTimeGrainTypes().get(0));
        Assertions.assertEquals(true, model.enableRegionalMdmAccount());
        Assertions.assertEquals("dsoifiyipj", model.sourceMdmAccount());
        Assertions.assertEquals("qwpgrjbzn", model.sourceMdmNamespace());
        Assertions.assertEquals("cjxvsnbyxqab", model.metricFilterPattern());
        Assertions.assertEquals(false, model.fillGapWithZero());
        Assertions.assertEquals("pcyshu", model.category());
        Assertions.assertEquals("afbljjgpbtoqcjmk", model.internalMetricName());
        Assertions.assertEquals("bqidtqaj", model.dimensions().get(0).name());
        Assertions.assertEquals("ulpkudjkrl", model.dimensions().get(0).displayName());
        Assertions.assertEquals("bzhfepgzgqexz", model.dimensions().get(0).internalName());
        Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedForShoebox());
        Assertions.assertEquals("scpai", model.lockedAggregationType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MetricSpecification model =
            new MetricSpecification()
                .withName("sne")
                .withDisplayName("dwzjeiach")
                .withDisplayDescription("osfln")
                .withUnit("sfqpteehz")
                .withAggregationType("ypyqrimzinp")
                .withSupportedAggregationTypes(Arrays.asList("jdkirsoodqx"))
                .withSupportedTimeGrainTypes(Arrays.asList("mnoh", "t"))
                .withEnableRegionalMdmAccount(true)
                .withSourceMdmAccount("dsoifiyipj")
                .withSourceMdmNamespace("qwpgrjbzn")
                .withMetricFilterPattern("cjxvsnbyxqab")
                .withFillGapWithZero(false)
                .withCategory("pcyshu")
                .withInternalMetricName("afbljjgpbtoqcjmk")
                .withDimensions(
                    Arrays
                        .asList(
                            new MetricDimension()
                                .withName("bqidtqaj")
                                .withDisplayName("ulpkudjkrl")
                                .withInternalName("bzhfepgzgqexz")
                                .withToBeExportedForShoebox(false)))
                .withLockedAggregationType("scpai");
        model = BinaryData.fromObject(model).toObject(MetricSpecification.class);
        Assertions.assertEquals("sne", model.name());
        Assertions.assertEquals("dwzjeiach", model.displayName());
        Assertions.assertEquals("osfln", model.displayDescription());
        Assertions.assertEquals("sfqpteehz", model.unit());
        Assertions.assertEquals("ypyqrimzinp", model.aggregationType());
        Assertions.assertEquals("jdkirsoodqx", model.supportedAggregationTypes().get(0));
        Assertions.assertEquals("mnoh", model.supportedTimeGrainTypes().get(0));
        Assertions.assertEquals(true, model.enableRegionalMdmAccount());
        Assertions.assertEquals("dsoifiyipj", model.sourceMdmAccount());
        Assertions.assertEquals("qwpgrjbzn", model.sourceMdmNamespace());
        Assertions.assertEquals("cjxvsnbyxqab", model.metricFilterPattern());
        Assertions.assertEquals(false, model.fillGapWithZero());
        Assertions.assertEquals("pcyshu", model.category());
        Assertions.assertEquals("afbljjgpbtoqcjmk", model.internalMetricName());
        Assertions.assertEquals("bqidtqaj", model.dimensions().get(0).name());
        Assertions.assertEquals("ulpkudjkrl", model.dimensions().get(0).displayName());
        Assertions.assertEquals("bzhfepgzgqexz", model.dimensions().get(0).internalName());
        Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedForShoebox());
        Assertions.assertEquals("scpai", model.lockedAggregationType());
    }
}
