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

package com.azure.resourcemanager.appconfiguration.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.appconfiguration.models.MetricDimension;
import com.azure.resourcemanager.appconfiguration.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\":\"cynpwlbjnp\",\"displayName\":\"cftadeh\",\"displayDescription\":\"ltyfsop\",\"unit\":\"suesnzw\",\"aggregationType\":\"jbavorxzdm\",\"internalMetricName\":\"ctbqvudwx\",\"dimensions\":[{\"name\":\"vo\",\"displayName\":\"ujjugwdkcglh\",\"internalName\":\"azjdyggd\"},{\"name\":\"ixhbkuofqweykhm\",\"displayName\":\"evfyexfwhybcib\",\"internalName\":\"vdcsitynn\"}],\"fillGapWithZero\":true}")
                .toObject(MetricSpecification.class);
        Assertions.assertEquals("cynpwlbjnp", model.name());
        Assertions.assertEquals("cftadeh", model.displayName());
        Assertions.assertEquals("ltyfsop", model.displayDescription());
        Assertions.assertEquals("suesnzw", model.unit());
        Assertions.assertEquals("jbavorxzdm", model.aggregationType());
        Assertions.assertEquals("ctbqvudwx", model.internalMetricName());
        Assertions.assertEquals("vo", model.dimensions().get(0).name());
        Assertions.assertEquals("ujjugwdkcglh", model.dimensions().get(0).displayName());
        Assertions.assertEquals("azjdyggd", model.dimensions().get(0).internalName());
        Assertions.assertEquals(true, model.fillGapWithZero());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MetricSpecification model =
            new MetricSpecification()
                .withName("cynpwlbjnp")
                .withDisplayName("cftadeh")
                .withDisplayDescription("ltyfsop")
                .withUnit("suesnzw")
                .withAggregationType("jbavorxzdm")
                .withInternalMetricName("ctbqvudwx")
                .withDimensions(
                    Arrays
                        .asList(
                            new MetricDimension()
                                .withName("vo")
                                .withDisplayName("ujjugwdkcglh")
                                .withInternalName("azjdyggd"),
                            new MetricDimension()
                                .withName("ixhbkuofqweykhm")
                                .withDisplayName("evfyexfwhybcib")
                                .withInternalName("vdcsitynn")))
                .withFillGapWithZero(true);
        model = BinaryData.fromObject(model).toObject(MetricSpecification.class);
        Assertions.assertEquals("cynpwlbjnp", model.name());
        Assertions.assertEquals("cftadeh", model.displayName());
        Assertions.assertEquals("ltyfsop", model.displayDescription());
        Assertions.assertEquals("suesnzw", model.unit());
        Assertions.assertEquals("jbavorxzdm", model.aggregationType());
        Assertions.assertEquals("ctbqvudwx", model.internalMetricName());
        Assertions.assertEquals("vo", model.dimensions().get(0).name());
        Assertions.assertEquals("ujjugwdkcglh", model.dimensions().get(0).displayName());
        Assertions.assertEquals("azjdyggd", model.dimensions().get(0).internalName());
        Assertions.assertEquals(true, model.fillGapWithZero());
    }
}
