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

package com.azure.resourcemanager.maps.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.maps.models.Dimension;
import com.azure.resourcemanager.maps.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\":\"f\",\"displayName\":\"wzwbnguitn\",\"displayDescription\":\"izgazxu\",\"unit\":\"zuckyfi\",\"dimensions\":[{\"name\":\"dfvzwdzuhty\",\"displayName\":\"isdkfthwxmnteiw\",\"internalName\":\"pvkmijcmmxdcuf\",\"internalMetricName\":\"srp\",\"sourceMdmNamespace\":\"zidnsezcxtbzsgfy\",\"toBeExportedToShoebox\":false},{\"name\":\"ewmdw\",\"displayName\":\"eiachboosflnr\",\"internalName\":\"fqpte\",\"internalMetricName\":\"zzvypyqrimzinp\",\"sourceMdmNamespace\":\"wjdk\",\"toBeExportedToShoebox\":true}],\"aggregationType\":\"od\",\"fillGapWithZero\":false,\"category\":\"rmnohj\",\"resourceIdDimensionNameOverride\":\"kwh\"}")
                .toObject(MetricSpecification.class);
        Assertions.assertEquals("f", model.name());
        Assertions.assertEquals("wzwbnguitn", model.displayName());
        Assertions.assertEquals("izgazxu", model.displayDescription());
        Assertions.assertEquals("zuckyfi", model.unit());
        Assertions.assertEquals("dfvzwdzuhty", model.dimensions().get(0).name());
        Assertions.assertEquals("isdkfthwxmnteiw", model.dimensions().get(0).displayName());
        Assertions.assertEquals("pvkmijcmmxdcuf", model.dimensions().get(0).internalName());
        Assertions.assertEquals("srp", model.dimensions().get(0).internalMetricName());
        Assertions.assertEquals("zidnsezcxtbzsgfy", model.dimensions().get(0).sourceMdmNamespace());
        Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedToShoebox());
        Assertions.assertEquals("od", model.aggregationType());
        Assertions.assertEquals(false, model.fillGapWithZero());
        Assertions.assertEquals("rmnohj", model.category());
        Assertions.assertEquals("kwh", model.resourceIdDimensionNameOverride());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MetricSpecification model =
            new MetricSpecification()
                .withName("f")
                .withDisplayName("wzwbnguitn")
                .withDisplayDescription("izgazxu")
                .withUnit("zuckyfi")
                .withDimensions(
                    Arrays
                        .asList(
                            new Dimension()
                                .withName("dfvzwdzuhty")
                                .withDisplayName("isdkfthwxmnteiw")
                                .withInternalName("pvkmijcmmxdcuf")
                                .withInternalMetricName("srp")
                                .withSourceMdmNamespace("zidnsezcxtbzsgfy")
                                .withToBeExportedToShoebox(false),
                            new Dimension()
                                .withName("ewmdw")
                                .withDisplayName("eiachboosflnr")
                                .withInternalName("fqpte")
                                .withInternalMetricName("zzvypyqrimzinp")
                                .withSourceMdmNamespace("wjdk")
                                .withToBeExportedToShoebox(true)))
                .withAggregationType("od")
                .withFillGapWithZero(false)
                .withCategory("rmnohj")
                .withResourceIdDimensionNameOverride("kwh");
        model = BinaryData.fromObject(model).toObject(MetricSpecification.class);
        Assertions.assertEquals("f", model.name());
        Assertions.assertEquals("wzwbnguitn", model.displayName());
        Assertions.assertEquals("izgazxu", model.displayDescription());
        Assertions.assertEquals("zuckyfi", model.unit());
        Assertions.assertEquals("dfvzwdzuhty", model.dimensions().get(0).name());
        Assertions.assertEquals("isdkfthwxmnteiw", model.dimensions().get(0).displayName());
        Assertions.assertEquals("pvkmijcmmxdcuf", model.dimensions().get(0).internalName());
        Assertions.assertEquals("srp", model.dimensions().get(0).internalMetricName());
        Assertions.assertEquals("zidnsezcxtbzsgfy", model.dimensions().get(0).sourceMdmNamespace());
        Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedToShoebox());
        Assertions.assertEquals("od", model.aggregationType());
        Assertions.assertEquals(false, model.fillGapWithZero());
        Assertions.assertEquals("rmnohj", model.category());
        Assertions.assertEquals("kwh", model.resourceIdDimensionNameOverride());
    }
}
