// 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.OperationMetaLogSpecification;
import com.azure.resourcemanager.datalakeanalytics.models.OperationMetaMetricSpecification;
import com.azure.resourcemanager.datalakeanalytics.models.OperationMetaPropertyInfo;
import com.azure.resourcemanager.datalakeanalytics.models.OperationMetaServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationMetaPropertyInfoTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationMetaPropertyInfo model =
            BinaryData
                .fromString(
                    "{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"sgzvahapjyzhpv\",\"displayDescription\":\"zcjrvxdjzlmwlx\",\"displayName\":\"ug\",\"unit\":\"zovawjvz\",\"aggregationType\":\"luthn\",\"availabilities\":[]},{\"name\":\"nxipeil\",\"displayDescription\":\"zuaejxd\",\"displayName\":\"tskzbbtdzumveek\",\"unit\":\"wozuhkf\",\"aggregationType\":\"sjyofdx\",\"availabilities\":[]},{\"name\":\"sd\",\"displayDescription\":\"ouwaboekqvkeln\",\"displayName\":\"vbxwyjsflhh\",\"unit\":\"aln\",\"aggregationType\":\"xisxyawjoyaqcsl\",\"availabilities\":[]}],\"logSpecifications\":[{\"name\":\"idzyexznelixhnr\",\"displayName\":\"folhbnxknal\",\"blobDuration\":\"lp\"},{\"name\":\"gdtpnapnyiro\",\"displayName\":\"hpigv\",\"blobDuration\":\"ylgqgitxmedjvcsl\"}]}}")
                .toObject(OperationMetaPropertyInfo.class);
        Assertions.assertEquals("sgzvahapjyzhpv", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions
            .assertEquals(
                "zcjrvxdjzlmwlx", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("ug", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions.assertEquals("zovawjvz", model.serviceSpecification().metricSpecifications().get(0).unit());
        Assertions.assertEquals("luthn", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("idzyexznelixhnr", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions.assertEquals("folhbnxknal", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions.assertEquals("lp", model.serviceSpecification().logSpecifications().get(0).blobDuration());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationMetaPropertyInfo model =
            new OperationMetaPropertyInfo()
                .withServiceSpecification(
                    new OperationMetaServiceSpecification()
                        .withMetricSpecifications(
                            Arrays
                                .asList(
                                    new OperationMetaMetricSpecification()
                                        .withName("sgzvahapjyzhpv")
                                        .withDisplayDescription("zcjrvxdjzlmwlx")
                                        .withDisplayName("ug")
                                        .withUnit("zovawjvz")
                                        .withAggregationType("luthn")
                                        .withAvailabilities(Arrays.asList()),
                                    new OperationMetaMetricSpecification()
                                        .withName("nxipeil")
                                        .withDisplayDescription("zuaejxd")
                                        .withDisplayName("tskzbbtdzumveek")
                                        .withUnit("wozuhkf")
                                        .withAggregationType("sjyofdx")
                                        .withAvailabilities(Arrays.asList()),
                                    new OperationMetaMetricSpecification()
                                        .withName("sd")
                                        .withDisplayDescription("ouwaboekqvkeln")
                                        .withDisplayName("vbxwyjsflhh")
                                        .withUnit("aln")
                                        .withAggregationType("xisxyawjoyaqcsl")
                                        .withAvailabilities(Arrays.asList())))
                        .withLogSpecifications(
                            Arrays
                                .asList(
                                    new OperationMetaLogSpecification()
                                        .withName("idzyexznelixhnr")
                                        .withDisplayName("folhbnxknal")
                                        .withBlobDuration("lp"),
                                    new OperationMetaLogSpecification()
                                        .withName("gdtpnapnyiro")
                                        .withDisplayName("hpigv")
                                        .withBlobDuration("ylgqgitxmedjvcsl"))));
        model = BinaryData.fromObject(model).toObject(OperationMetaPropertyInfo.class);
        Assertions.assertEquals("sgzvahapjyzhpv", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions
            .assertEquals(
                "zcjrvxdjzlmwlx", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("ug", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions.assertEquals("zovawjvz", model.serviceSpecification().metricSpecifications().get(0).unit());
        Assertions.assertEquals("luthn", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("idzyexznelixhnr", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions.assertEquals("folhbnxknal", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions.assertEquals("lp", model.serviceSpecification().logSpecifications().get(0).blobDuration());
    }
}
