// 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.fluent.models.OperationProperties;
import com.azure.resourcemanager.maps.models.MetricSpecification;
import com.azure.resourcemanager.maps.models.ServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationProperties model =
            BinaryData
                .fromString(
                    "{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"amiheognarxz\",\"displayName\":\"heotusiv\",\"displayDescription\":\"v\",\"unit\":\"iqihn\",\"dimensions\":[],\"aggregationType\":\"gbwjzrnf\",\"fillGapWithZero\":true,\"category\":\"ispe\",\"resourceIdDimensionNameOverride\":\"tzfkufubl\"},{\"name\":\"fxqeof\",\"displayName\":\"e\",\"displayDescription\":\"hqjbasvmsmj\",\"unit\":\"lngsntnbybkzgcwr\",\"dimensions\":[],\"aggregationType\":\"xxwr\",\"fillGapWithZero\":true,\"category\":\"uskcqvkocrcj\",\"resourceIdDimensionNameOverride\":\"wtnhxbnjbiksqr\"},{\"name\":\"ssainqpjwnzll\",\"displayName\":\"mppeebvmgxs\",\"displayDescription\":\"kyqduujit\",\"unit\":\"czdzev\",\"dimensions\":[],\"aggregationType\":\"krwpdap\",\"fillGapWithZero\":false,\"category\":\"dkvwrwjfe\",\"resourceIdDimensionNameOverride\":\"nhutjeltmrldhugj\"},{\"name\":\"datqxhocdgeabl\",\"displayName\":\"huticndvkao\",\"displayDescription\":\"yiftyhxhuro\",\"unit\":\"tyxolniwpwc\",\"dimensions\":[],\"aggregationType\":\"fkgiawxk\",\"fillGapWithZero\":false,\"category\":\"lwckbasyypnddhs\",\"resourceIdDimensionNameOverride\":\"bacphejko\"}]}}")
                .toObject(OperationProperties.class);
        Assertions.assertEquals("amiheognarxz", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions.assertEquals("heotusiv", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions.assertEquals("v", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("iqihn", model.serviceSpecification().metricSpecifications().get(0).unit());
        Assertions
            .assertEquals("gbwjzrnf", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals(true, model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("ispe", model.serviceSpecification().metricSpecifications().get(0).category());
        Assertions
            .assertEquals(
                "tzfkufubl",
                model.serviceSpecification().metricSpecifications().get(0).resourceIdDimensionNameOverride());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationProperties model =
            new OperationProperties()
                .withServiceSpecification(
                    new ServiceSpecification()
                        .withMetricSpecifications(
                            Arrays
                                .asList(
                                    new MetricSpecification()
                                        .withName("amiheognarxz")
                                        .withDisplayName("heotusiv")
                                        .withDisplayDescription("v")
                                        .withUnit("iqihn")
                                        .withDimensions(Arrays.asList())
                                        .withAggregationType("gbwjzrnf")
                                        .withFillGapWithZero(true)
                                        .withCategory("ispe")
                                        .withResourceIdDimensionNameOverride("tzfkufubl"),
                                    new MetricSpecification()
                                        .withName("fxqeof")
                                        .withDisplayName("e")
                                        .withDisplayDescription("hqjbasvmsmj")
                                        .withUnit("lngsntnbybkzgcwr")
                                        .withDimensions(Arrays.asList())
                                        .withAggregationType("xxwr")
                                        .withFillGapWithZero(true)
                                        .withCategory("uskcqvkocrcj")
                                        .withResourceIdDimensionNameOverride("wtnhxbnjbiksqr"),
                                    new MetricSpecification()
                                        .withName("ssainqpjwnzll")
                                        .withDisplayName("mppeebvmgxs")
                                        .withDisplayDescription("kyqduujit")
                                        .withUnit("czdzev")
                                        .withDimensions(Arrays.asList())
                                        .withAggregationType("krwpdap")
                                        .withFillGapWithZero(false)
                                        .withCategory("dkvwrwjfe")
                                        .withResourceIdDimensionNameOverride("nhutjeltmrldhugj"),
                                    new MetricSpecification()
                                        .withName("datqxhocdgeabl")
                                        .withDisplayName("huticndvkao")
                                        .withDisplayDescription("yiftyhxhuro")
                                        .withUnit("tyxolniwpwc")
                                        .withDimensions(Arrays.asList())
                                        .withAggregationType("fkgiawxk")
                                        .withFillGapWithZero(false)
                                        .withCategory("lwckbasyypnddhs")
                                        .withResourceIdDimensionNameOverride("bacphejko"))));
        model = BinaryData.fromObject(model).toObject(OperationProperties.class);
        Assertions.assertEquals("amiheognarxz", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions.assertEquals("heotusiv", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions.assertEquals("v", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("iqihn", model.serviceSpecification().metricSpecifications().get(0).unit());
        Assertions
            .assertEquals("gbwjzrnf", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals(true, model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("ispe", model.serviceSpecification().metricSpecifications().get(0).category());
        Assertions
            .assertEquals(
                "tzfkufubl",
                model.serviceSpecification().metricSpecifications().get(0).resourceIdDimensionNameOverride());
    }
}
