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

package com.azure.resourcemanager.signalr.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.signalr.models.LogSpecification;
import com.azure.resourcemanager.signalr.models.MetricSpecification;
import com.azure.resourcemanager.signalr.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(
                    "{\"metricSpecifications\":[{\"name\":\"yffdfdos\",\"displayName\":\"expa\",\"displayDescription\":\"akhmsbzjhcrz\",\"unit\":\"dphlxaolt\",\"aggregationType\":\"trg\",\"fillGapWithZero\":\"bpf\",\"category\":\"s\",\"dimensions\":[]}],\"logSpecifications\":[{\"name\":\"cjrwzoxxjtfellu\",\"displayName\":\"zitonpeqfpjkjl\"}]}")
                .toObject(ServiceSpecification.class);
        Assertions.assertEquals("yffdfdos", model.metricSpecifications().get(0).name());
        Assertions.assertEquals("expa", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("akhmsbzjhcrz", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("dphlxaolt", model.metricSpecifications().get(0).unit());
        Assertions.assertEquals("trg", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("bpf", model.metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("s", model.metricSpecifications().get(0).category());
        Assertions.assertEquals("cjrwzoxxjtfellu", model.logSpecifications().get(0).name());
        Assertions.assertEquals("zitonpeqfpjkjl", model.logSpecifications().get(0).displayName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceSpecification model =
            new ServiceSpecification()
                .withMetricSpecifications(
                    Arrays
                        .asList(
                            new MetricSpecification()
                                .withName("yffdfdos")
                                .withDisplayName("expa")
                                .withDisplayDescription("akhmsbzjhcrz")
                                .withUnit("dphlxaolt")
                                .withAggregationType("trg")
                                .withFillGapWithZero("bpf")
                                .withCategory("s")
                                .withDimensions(Arrays.asList())))
                .withLogSpecifications(
                    Arrays
                        .asList(new LogSpecification().withName("cjrwzoxxjtfellu").withDisplayName("zitonpeqfpjkjl")));
        model = BinaryData.fromObject(model).toObject(ServiceSpecification.class);
        Assertions.assertEquals("yffdfdos", model.metricSpecifications().get(0).name());
        Assertions.assertEquals("expa", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("akhmsbzjhcrz", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("dphlxaolt", model.metricSpecifications().get(0).unit());
        Assertions.assertEquals("trg", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("bpf", model.metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("s", model.metricSpecifications().get(0).category());
        Assertions.assertEquals("cjrwzoxxjtfellu", model.logSpecifications().get(0).name());
        Assertions.assertEquals("zitonpeqfpjkjl", model.logSpecifications().get(0).displayName());
    }
}
