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

package com.azure.resourcemanager.synapse.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.synapse.models.OperationMetaMetricDimensionSpecification;
import com.azure.resourcemanager.synapse.models.OperationMetaMetricSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationMetaMetricSpecificationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationMetaMetricSpecification model =
            BinaryData
                .fromString(
                    "{\"sourceMdmNamespace\":\"rfidfvzwdz\",\"displayName\":\"tymw\",\"name\":\"dkfthwxmnt\",\"aggregationType\":\"waopvkmijcmmxd\",\"displayDescription\":\"fufsrpymzi\",\"sourceMdmAccount\":\"sezcxtb\",\"enableRegionalMdmAccount\":false,\"unit\":\"yc\",\"dimensions\":[{\"displayName\":\"wmdwzjeiachboo\",\"name\":\"lnrosfqp\",\"toBeExportedForShoebox\":true},{\"displayName\":\"zzvypyqrimzinp\",\"name\":\"wjdk\",\"toBeExportedForShoebox\":true},{\"displayName\":\"od\",\"name\":\"hc\",\"toBeExportedForShoebox\":false},{\"displayName\":\"hjtckwhd\",\"name\":\"ifiyipjxsqwpgrj\",\"toBeExportedForShoebox\":true}],\"supportsInstanceLevelAggregation\":true,\"metricFilterPattern\":\"jxvsnbyxqabn\"}")
                .toObject(OperationMetaMetricSpecification.class);
        Assertions.assertEquals("rfidfvzwdz", model.sourceMdmNamespace());
        Assertions.assertEquals("tymw", model.displayName());
        Assertions.assertEquals("dkfthwxmnt", model.name());
        Assertions.assertEquals("waopvkmijcmmxd", model.aggregationType());
        Assertions.assertEquals("fufsrpymzi", model.displayDescription());
        Assertions.assertEquals("sezcxtb", model.sourceMdmAccount());
        Assertions.assertEquals(false, model.enableRegionalMdmAccount());
        Assertions.assertEquals("yc", model.unit());
        Assertions.assertEquals("wmdwzjeiachboo", model.dimensions().get(0).displayName());
        Assertions.assertEquals("lnrosfqp", model.dimensions().get(0).name());
        Assertions.assertEquals(true, model.dimensions().get(0).toBeExportedForShoebox());
        Assertions.assertEquals(true, model.supportsInstanceLevelAggregation());
        Assertions.assertEquals("jxvsnbyxqabn", model.metricFilterPattern());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationMetaMetricSpecification model =
            new OperationMetaMetricSpecification()
                .withSourceMdmNamespace("rfidfvzwdz")
                .withDisplayName("tymw")
                .withName("dkfthwxmnt")
                .withAggregationType("waopvkmijcmmxd")
                .withDisplayDescription("fufsrpymzi")
                .withSourceMdmAccount("sezcxtb")
                .withEnableRegionalMdmAccount(false)
                .withUnit("yc")
                .withDimensions(
                    Arrays
                        .asList(
                            new OperationMetaMetricDimensionSpecification()
                                .withDisplayName("wmdwzjeiachboo")
                                .withName("lnrosfqp")
                                .withToBeExportedForShoebox(true),
                            new OperationMetaMetricDimensionSpecification()
                                .withDisplayName("zzvypyqrimzinp")
                                .withName("wjdk")
                                .withToBeExportedForShoebox(true),
                            new OperationMetaMetricDimensionSpecification()
                                .withDisplayName("od")
                                .withName("hc")
                                .withToBeExportedForShoebox(false),
                            new OperationMetaMetricDimensionSpecification()
                                .withDisplayName("hjtckwhd")
                                .withName("ifiyipjxsqwpgrj")
                                .withToBeExportedForShoebox(true)))
                .withSupportsInstanceLevelAggregation(true)
                .withMetricFilterPattern("jxvsnbyxqabn");
        model = BinaryData.fromObject(model).toObject(OperationMetaMetricSpecification.class);
        Assertions.assertEquals("rfidfvzwdz", model.sourceMdmNamespace());
        Assertions.assertEquals("tymw", model.displayName());
        Assertions.assertEquals("dkfthwxmnt", model.name());
        Assertions.assertEquals("waopvkmijcmmxd", model.aggregationType());
        Assertions.assertEquals("fufsrpymzi", model.displayDescription());
        Assertions.assertEquals("sezcxtb", model.sourceMdmAccount());
        Assertions.assertEquals(false, model.enableRegionalMdmAccount());
        Assertions.assertEquals("yc", model.unit());
        Assertions.assertEquals("wmdwzjeiachboo", model.dimensions().get(0).displayName());
        Assertions.assertEquals("lnrosfqp", model.dimensions().get(0).name());
        Assertions.assertEquals(true, model.dimensions().get(0).toBeExportedForShoebox());
        Assertions.assertEquals(true, model.supportsInstanceLevelAggregation());
        Assertions.assertEquals("jxvsnbyxqabn", model.metricFilterPattern());
    }
}
