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

package com.azure.resourcemanager.advisor.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.advisor.fluent.models.ConfigDataInner;
import com.azure.resourcemanager.advisor.models.ConfigurationListResult;
import com.azure.resourcemanager.advisor.models.CpuThreshold;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ConfigurationListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ConfigurationListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"exclude\":false,\"lowCpuThreshold\":\"5\",\"digests\":[]},\"id\":\"urkdtmlx\",\"name\":\"ekuksjtx\",\"type\":\"kc\"},{\"properties\":{\"exclude\":true,\"lowCpuThreshold\":\"10\",\"digests\":[]},\"id\":\"y\",\"name\":\"anzwuxzdxta\",\"type\":\"rlhm\"},{\"properties\":{\"exclude\":false,\"lowCpuThreshold\":\"10\",\"digests\":[]},\"id\":\"obmtukk\",\"name\":\"ryrtihfxtijbpzv\",\"type\":\"nwzsymg\"}],\"nextLink\":\"uf\"}")
                .toObject(ConfigurationListResult.class);
        Assertions.assertEquals(false, model.value().get(0).exclude());
        Assertions.assertEquals(CpuThreshold.FIVE, model.value().get(0).lowCpuThreshold());
        Assertions.assertEquals("uf", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ConfigurationListResult model =
            new ConfigurationListResult()
                .withValue(
                    Arrays
                        .asList(
                            new ConfigDataInner()
                                .withExclude(false)
                                .withLowCpuThreshold(CpuThreshold.FIVE)
                                .withDigests(Arrays.asList()),
                            new ConfigDataInner()
                                .withExclude(true)
                                .withLowCpuThreshold(CpuThreshold.ONE_ZERO)
                                .withDigests(Arrays.asList()),
                            new ConfigDataInner()
                                .withExclude(false)
                                .withLowCpuThreshold(CpuThreshold.ONE_ZERO)
                                .withDigests(Arrays.asList())))
                .withNextLink("uf");
        model = BinaryData.fromObject(model).toObject(ConfigurationListResult.class);
        Assertions.assertEquals(false, model.value().get(0).exclude());
        Assertions.assertEquals(CpuThreshold.FIVE, model.value().get(0).lowCpuThreshold());
        Assertions.assertEquals("uf", model.nextLink());
    }
}
