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

package com.azure.resourcemanager.purview.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.purview.models.OperationMetaLogSpecification;
import com.azure.resourcemanager.purview.models.OperationMetaMetricSpecification;
import com.azure.resourcemanager.purview.models.OperationMetaServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationMetaServiceSpecificationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationMetaServiceSpecification model =
            BinaryData
                .fromString(
                    "{\"logSpecifications\":[{\"blobDuration\":\"iith\",\"displayName\":\"m\",\"name\":\"yvshxmz\"},{\"blobDuration\":\"bzoggigrx\",\"displayName\":\"ur\",\"name\":\"xxjnspydptk\"},{\"blobDuration\":\"nkoukn\",\"displayName\":\"dwtiukbldngkp\",\"name\":\"ipazyxoegukgjnpi\"}],\"metricSpecifications\":[{\"aggregationType\":\"gevqznty\",\"dimensions\":[],\"displayDescription\":\"p\",\"displayName\":\"c\",\"enableRegionalMdmAccount\":\"qjsdpydnfyhxdeo\",\"internalMetricName\":\"zi\",\"name\":\"ifsjttgzfbishcb\",\"resourceIdDimensionNameOverride\":\"ajdeyeamdphaga\",\"sourceMdmNamespace\":\"buxwgip\",\"supportedAggregationTypes\":[\"nowkgshw\",\"nkixzbinj\"],\"supportedTimeGrainTypes\":[\"ttmrywnuzoqf\",\"iyqzrnk\",\"qvyxlwhzlsicoho\",\"qnwvlrya\"],\"unit\":\"hheunmmqhgyx\"},{\"aggregationType\":\"onocukok\",\"dimensions\":[],\"displayDescription\":\"uconuqszfkbey\",\"displayName\":\"wrmjmwvvjektc\",\"enableRegionalMdmAccount\":\"enhwlrs\",\"internalMetricName\":\"rzpwvlqdqgbiq\",\"name\":\"ihkaetcktvfc\",\"resourceIdDimensionNameOverride\":\"fsnkymuctq\",\"sourceMdmNamespace\":\"fbebrjcxer\",\"supportedAggregationTypes\":[\"utttxfvjrbirp\",\"xepcyvahfn\",\"jky\"],\"supportedTimeGrainTypes\":[\"vuujq\"],\"unit\":\"dokgjl\"}]}")
                .toObject(OperationMetaServiceSpecification.class);
        Assertions.assertEquals("iith", model.logSpecifications().get(0).blobDuration());
        Assertions.assertEquals("m", model.logSpecifications().get(0).displayName());
        Assertions.assertEquals("yvshxmz", model.logSpecifications().get(0).name());
        Assertions.assertEquals("gevqznty", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("p", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("c", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("qjsdpydnfyhxdeo", model.metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("zi", model.metricSpecifications().get(0).internalMetricName());
        Assertions.assertEquals("ifsjttgzfbishcb", model.metricSpecifications().get(0).name());
        Assertions
            .assertEquals("ajdeyeamdphaga", model.metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions.assertEquals("buxwgip", model.metricSpecifications().get(0).sourceMdmNamespace());
        Assertions.assertEquals("nowkgshw", model.metricSpecifications().get(0).supportedAggregationTypes().get(0));
        Assertions.assertEquals("ttmrywnuzoqf", model.metricSpecifications().get(0).supportedTimeGrainTypes().get(0));
        Assertions.assertEquals("hheunmmqhgyx", model.metricSpecifications().get(0).unit());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationMetaServiceSpecification model =
            new OperationMetaServiceSpecification()
                .withLogSpecifications(
                    Arrays
                        .asList(
                            new OperationMetaLogSpecification()
                                .withBlobDuration("iith")
                                .withDisplayName("m")
                                .withName("yvshxmz"),
                            new OperationMetaLogSpecification()
                                .withBlobDuration("bzoggigrx")
                                .withDisplayName("ur")
                                .withName("xxjnspydptk"),
                            new OperationMetaLogSpecification()
                                .withBlobDuration("nkoukn")
                                .withDisplayName("dwtiukbldngkp")
                                .withName("ipazyxoegukgjnpi")))
                .withMetricSpecifications(
                    Arrays
                        .asList(
                            new OperationMetaMetricSpecification()
                                .withAggregationType("gevqznty")
                                .withDimensions(Arrays.asList())
                                .withDisplayDescription("p")
                                .withDisplayName("c")
                                .withEnableRegionalMdmAccount("qjsdpydnfyhxdeo")
                                .withInternalMetricName("zi")
                                .withName("ifsjttgzfbishcb")
                                .withResourceIdDimensionNameOverride("ajdeyeamdphaga")
                                .withSourceMdmNamespace("buxwgip")
                                .withSupportedAggregationTypes(Arrays.asList("nowkgshw", "nkixzbinj"))
                                .withSupportedTimeGrainTypes(
                                    Arrays.asList("ttmrywnuzoqf", "iyqzrnk", "qvyxlwhzlsicoho", "qnwvlrya"))
                                .withUnit("hheunmmqhgyx"),
                            new OperationMetaMetricSpecification()
                                .withAggregationType("onocukok")
                                .withDimensions(Arrays.asList())
                                .withDisplayDescription("uconuqszfkbey")
                                .withDisplayName("wrmjmwvvjektc")
                                .withEnableRegionalMdmAccount("enhwlrs")
                                .withInternalMetricName("rzpwvlqdqgbiq")
                                .withName("ihkaetcktvfc")
                                .withResourceIdDimensionNameOverride("fsnkymuctq")
                                .withSourceMdmNamespace("fbebrjcxer")
                                .withSupportedAggregationTypes(Arrays.asList("utttxfvjrbirp", "xepcyvahfn", "jky"))
                                .withSupportedTimeGrainTypes(Arrays.asList("vuujq"))
                                .withUnit("dokgjl")));
        model = BinaryData.fromObject(model).toObject(OperationMetaServiceSpecification.class);
        Assertions.assertEquals("iith", model.logSpecifications().get(0).blobDuration());
        Assertions.assertEquals("m", model.logSpecifications().get(0).displayName());
        Assertions.assertEquals("yvshxmz", model.logSpecifications().get(0).name());
        Assertions.assertEquals("gevqznty", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("p", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("c", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("qjsdpydnfyhxdeo", model.metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("zi", model.metricSpecifications().get(0).internalMetricName());
        Assertions.assertEquals("ifsjttgzfbishcb", model.metricSpecifications().get(0).name());
        Assertions
            .assertEquals("ajdeyeamdphaga", model.metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions.assertEquals("buxwgip", model.metricSpecifications().get(0).sourceMdmNamespace());
        Assertions.assertEquals("nowkgshw", model.metricSpecifications().get(0).supportedAggregationTypes().get(0));
        Assertions.assertEquals("ttmrywnuzoqf", model.metricSpecifications().get(0).supportedTimeGrainTypes().get(0));
        Assertions.assertEquals("hheunmmqhgyx", model.metricSpecifications().get(0).unit());
    }
}
