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

public final class ServiceSpecificationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServiceSpecification model =
            BinaryData
                .fromString(
                    "{\"logSpecifications\":[{\"name\":\"anyktzlcuiywg\",\"displayName\":\"wgndrvynhzgpp\",\"blobDuration\":\"cgyncocpecf\"},{\"name\":\"mcoo\",\"displayName\":\"xlzevgbmqjqabcy\",\"blobDuration\":\"ivkwlzuvccfwnfnb\"}],\"metricSpecifications\":[{\"name\":\"onlebxetqgtzxdpn\",\"displayName\":\"qqwx\",\"displayDescription\":\"feallnwsu\",\"unit\":\"snjampmng\",\"aggregationType\":\"scxaq\",\"internalMetricName\":\"ochcbonqvpkvl\",\"dimensions\":[],\"fillGapWithZero\":false},{\"name\":\"seiphe\",\"displayName\":\"lokeyy\",\"displayDescription\":\"nj\",\"unit\":\"lwtgrhpdj\",\"aggregationType\":\"umasxazjpq\",\"internalMetricName\":\"gual\",\"dimensions\":[],\"fillGapWithZero\":false}]}")
                .toObject(ServiceSpecification.class);
        Assertions.assertEquals("anyktzlcuiywg", model.logSpecifications().get(0).name());
        Assertions.assertEquals("wgndrvynhzgpp", model.logSpecifications().get(0).displayName());
        Assertions.assertEquals("cgyncocpecf", model.logSpecifications().get(0).blobDuration());
        Assertions.assertEquals("onlebxetqgtzxdpn", model.metricSpecifications().get(0).name());
        Assertions.assertEquals("qqwx", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("feallnwsu", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("snjampmng", model.metricSpecifications().get(0).unit());
        Assertions.assertEquals("scxaq", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("ochcbonqvpkvl", model.metricSpecifications().get(0).internalMetricName());
        Assertions.assertEquals(false, model.metricSpecifications().get(0).fillGapWithZero());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceSpecification model =
            new ServiceSpecification()
                .withLogSpecifications(
                    Arrays
                        .asList(
                            new LogSpecification()
                                .withName("anyktzlcuiywg")
                                .withDisplayName("wgndrvynhzgpp")
                                .withBlobDuration("cgyncocpecf"),
                            new LogSpecification()
                                .withName("mcoo")
                                .withDisplayName("xlzevgbmqjqabcy")
                                .withBlobDuration("ivkwlzuvccfwnfnb")))
                .withMetricSpecifications(
                    Arrays
                        .asList(
                            new MetricSpecification()
                                .withName("onlebxetqgtzxdpn")
                                .withDisplayName("qqwx")
                                .withDisplayDescription("feallnwsu")
                                .withUnit("snjampmng")
                                .withAggregationType("scxaq")
                                .withInternalMetricName("ochcbonqvpkvl")
                                .withDimensions(Arrays.asList())
                                .withFillGapWithZero(false),
                            new MetricSpecification()
                                .withName("seiphe")
                                .withDisplayName("lokeyy")
                                .withDisplayDescription("nj")
                                .withUnit("lwtgrhpdj")
                                .withAggregationType("umasxazjpq")
                                .withInternalMetricName("gual")
                                .withDimensions(Arrays.asList())
                                .withFillGapWithZero(false)));
        model = BinaryData.fromObject(model).toObject(ServiceSpecification.class);
        Assertions.assertEquals("anyktzlcuiywg", model.logSpecifications().get(0).name());
        Assertions.assertEquals("wgndrvynhzgpp", model.logSpecifications().get(0).displayName());
        Assertions.assertEquals("cgyncocpecf", model.logSpecifications().get(0).blobDuration());
        Assertions.assertEquals("onlebxetqgtzxdpn", model.metricSpecifications().get(0).name());
        Assertions.assertEquals("qqwx", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("feallnwsu", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("snjampmng", model.metricSpecifications().get(0).unit());
        Assertions.assertEquals("scxaq", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("ochcbonqvpkvl", model.metricSpecifications().get(0).internalMetricName());
        Assertions.assertEquals(false, model.metricSpecifications().get(0).fillGapWithZero());
    }
}
