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

package com.azure.resourcemanager.powerbidedicated.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.powerbidedicated.models.MetricSpecification;
import com.azure.resourcemanager.powerbidedicated.models.MetricSpecificationDimensionsItem;
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\":\"ienjbdlwtgr\",\"displayName\":\"djpjumasxazjpq\",\"displayDescription\":\"gual\",\"unit\":\"xxhejjzzvd\",\"aggregationType\":\"gwdslfhotwm\",\"metricFilterPattern\":\"npwlbjnpg\",\"dimensions\":[{\"name\":\"adehxnltyfsopp\",\"displayName\":\"uesnzwdejbavo\"},{\"name\":\"zdmohctbqvu\",\"displayName\":\"xdn\"},{\"name\":\"vo\",\"displayName\":\"ujjugwdkcglh\"},{\"name\":\"azjdyggd\",\"displayName\":\"ixhbkuofqweykhm\"}]}")
                .toObject(MetricSpecification.class);
        Assertions.assertEquals("djpjumasxazjpq", model.displayName());
        Assertions.assertEquals("gual", model.displayDescription());
        Assertions.assertEquals("uesnzwdejbavo", model.dimensions().get(0).displayName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MetricSpecification model =
            new MetricSpecification()
                .withDisplayName("djpjumasxazjpq")
                .withDisplayDescription("gual")
                .withDimensions(
                    Arrays
                        .asList(
                            new MetricSpecificationDimensionsItem().withDisplayName("uesnzwdejbavo"),
                            new MetricSpecificationDimensionsItem().withDisplayName("xdn"),
                            new MetricSpecificationDimensionsItem().withDisplayName("ujjugwdkcglh"),
                            new MetricSpecificationDimensionsItem().withDisplayName("ixhbkuofqweykhm")));
        model = BinaryData.fromObject(model).toObject(MetricSpecification.class);
        Assertions.assertEquals("djpjumasxazjpq", model.displayName());
        Assertions.assertEquals("gual", model.displayDescription());
        Assertions.assertEquals("uesnzwdejbavo", model.dimensions().get(0).displayName());
    }
}
