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

package com.azure.resourcemanager.storagecache.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.storagecache.fluent.models.UsageModelInner;
import com.azure.resourcemanager.storagecache.models.UsageModelDisplay;
import com.azure.resourcemanager.storagecache.models.UsageModelsResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class UsageModelsResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        UsageModelsResult model =
            BinaryData
                .fromString(
                    "{\"nextLink\":\"clhocohsl\",\"value\":[{\"display\":{\"description\":\"ggzfbu\"},\"modelName\":\"mvfaxkffeiith\",\"targetType\":\"m\"},{\"display\":{\"description\":\"v\"},\"modelName\":\"xmzsbbzogg\",\"targetType\":\"rxwburv\"},{\"display\":{\"description\":\"jnspydp\"},\"modelName\":\"oenkouknvudwti\",\"targetType\":\"bldngkpoc\"},{\"display\":{\"description\":\"z\"},\"modelName\":\"o\",\"targetType\":\"ukgjnpiucgygevq\"}]}")
                .toObject(UsageModelsResult.class);
        Assertions.assertEquals("clhocohsl", model.nextLink());
        Assertions.assertEquals("ggzfbu", model.value().get(0).display().description());
        Assertions.assertEquals("mvfaxkffeiith", model.value().get(0).modelName());
        Assertions.assertEquals("m", model.value().get(0).targetType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        UsageModelsResult model =
            new UsageModelsResult()
                .withNextLink("clhocohsl")
                .withValue(
                    Arrays
                        .asList(
                            new UsageModelInner()
                                .withDisplay(new UsageModelDisplay().withDescription("ggzfbu"))
                                .withModelName("mvfaxkffeiith")
                                .withTargetType("m"),
                            new UsageModelInner()
                                .withDisplay(new UsageModelDisplay().withDescription("v"))
                                .withModelName("xmzsbbzogg")
                                .withTargetType("rxwburv"),
                            new UsageModelInner()
                                .withDisplay(new UsageModelDisplay().withDescription("jnspydp"))
                                .withModelName("oenkouknvudwti")
                                .withTargetType("bldngkpoc"),
                            new UsageModelInner()
                                .withDisplay(new UsageModelDisplay().withDescription("z"))
                                .withModelName("o")
                                .withTargetType("ukgjnpiucgygevq")));
        model = BinaryData.fromObject(model).toObject(UsageModelsResult.class);
        Assertions.assertEquals("clhocohsl", model.nextLink());
        Assertions.assertEquals("ggzfbu", model.value().get(0).display().description());
        Assertions.assertEquals("mvfaxkffeiith", model.value().get(0).modelName());
        Assertions.assertEquals("m", model.value().get(0).targetType());
    }
}
