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

package com.azure.resourcemanager.datalakeanalytics.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datalakeanalytics.models.OperationMetaMetricAvailabilitiesSpecification;
import com.azure.resourcemanager.datalakeanalytics.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(
                    "{\"name\":\"ruvw\",\"displayDescription\":\"sqfsubcgjbirxb\",\"displayName\":\"bsrfbj\",\"unit\":\"twss\",\"aggregationType\":\"ftpvjzbexil\",\"availabilities\":[{\"timeGrain\":\"qqnvwpmq\",\"blobDuration\":\"ruoujmk\"},{\"timeGrain\":\"hwqytj\",\"blobDuration\":\"bnw\"}]}")
                .toObject(OperationMetaMetricSpecification.class);
        Assertions.assertEquals("ruvw", model.name());
        Assertions.assertEquals("sqfsubcgjbirxb", model.displayDescription());
        Assertions.assertEquals("bsrfbj", model.displayName());
        Assertions.assertEquals("twss", model.unit());
        Assertions.assertEquals("ftpvjzbexil", model.aggregationType());
        Assertions.assertEquals("qqnvwpmq", model.availabilities().get(0).timeGrain());
        Assertions.assertEquals("ruoujmk", model.availabilities().get(0).blobDuration());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationMetaMetricSpecification model =
            new OperationMetaMetricSpecification()
                .withName("ruvw")
                .withDisplayDescription("sqfsubcgjbirxb")
                .withDisplayName("bsrfbj")
                .withUnit("twss")
                .withAggregationType("ftpvjzbexil")
                .withAvailabilities(
                    Arrays
                        .asList(
                            new OperationMetaMetricAvailabilitiesSpecification()
                                .withTimeGrain("qqnvwpmq")
                                .withBlobDuration("ruoujmk"),
                            new OperationMetaMetricAvailabilitiesSpecification()
                                .withTimeGrain("hwqytj")
                                .withBlobDuration("bnw")));
        model = BinaryData.fromObject(model).toObject(OperationMetaMetricSpecification.class);
        Assertions.assertEquals("ruvw", model.name());
        Assertions.assertEquals("sqfsubcgjbirxb", model.displayDescription());
        Assertions.assertEquals("bsrfbj", model.displayName());
        Assertions.assertEquals("twss", model.unit());
        Assertions.assertEquals("ftpvjzbexil", model.aggregationType());
        Assertions.assertEquals("qqnvwpmq", model.availabilities().get(0).timeGrain());
        Assertions.assertEquals("ruoujmk", model.availabilities().get(0).blobDuration());
    }
}
