// 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.OperationEntityInner;
import com.azure.resourcemanager.advisor.models.OperationDisplayInfo;
import com.azure.resourcemanager.advisor.models.OperationEntityListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationEntityListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationEntityListResult model =
            BinaryData
                .fromString(
                    "{\"nextLink\":\"ochcbonqvpkvl\",\"value\":[{\"name\":\"ea\",\"display\":{\"description\":\"pheoflokeyy\",\"operation\":\"nj\",\"provider\":\"lwtgrhpdj\",\"resource\":\"umasxazjpq\"}},{\"name\":\"gual\",\"display\":{\"description\":\"xhejjzzvdud\",\"operation\":\"dslfhotwmcy\",\"provider\":\"wlbjnpgacftade\",\"resource\":\"nltyfsoppusuesnz\"}},{\"name\":\"ej\",\"display\":{\"description\":\"orxzdmohctbqvud\",\"operation\":\"dndnvow\",\"provider\":\"jjugwdkcglhslaz\",\"resource\":\"yggdtjixh\"}},{\"name\":\"uofqwe\",\"display\":{\"description\":\"menevfyexfwh\",\"operation\":\"cibvyvdcsitynn\",\"provider\":\"mdectehfiqscjey\",\"resource\":\"hezrkgq\"}}]}")
                .toObject(OperationEntityListResult.class);
        Assertions.assertEquals("ochcbonqvpkvl", model.nextLink());
        Assertions.assertEquals("ea", model.value().get(0).name());
        Assertions.assertEquals("pheoflokeyy", model.value().get(0).display().description());
        Assertions.assertEquals("nj", model.value().get(0).display().operation());
        Assertions.assertEquals("lwtgrhpdj", model.value().get(0).display().provider());
        Assertions.assertEquals("umasxazjpq", model.value().get(0).display().resource());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationEntityListResult model =
            new OperationEntityListResult()
                .withNextLink("ochcbonqvpkvl")
                .withValue(
                    Arrays
                        .asList(
                            new OperationEntityInner()
                                .withName("ea")
                                .withDisplay(
                                    new OperationDisplayInfo()
                                        .withDescription("pheoflokeyy")
                                        .withOperation("nj")
                                        .withProvider("lwtgrhpdj")
                                        .withResource("umasxazjpq")),
                            new OperationEntityInner()
                                .withName("gual")
                                .withDisplay(
                                    new OperationDisplayInfo()
                                        .withDescription("xhejjzzvdud")
                                        .withOperation("dslfhotwmcy")
                                        .withProvider("wlbjnpgacftade")
                                        .withResource("nltyfsoppusuesnz")),
                            new OperationEntityInner()
                                .withName("ej")
                                .withDisplay(
                                    new OperationDisplayInfo()
                                        .withDescription("orxzdmohctbqvud")
                                        .withOperation("dndnvow")
                                        .withProvider("jjugwdkcglhslaz")
                                        .withResource("yggdtjixh")),
                            new OperationEntityInner()
                                .withName("uofqwe")
                                .withDisplay(
                                    new OperationDisplayInfo()
                                        .withDescription("menevfyexfwh")
                                        .withOperation("cibvyvdcsitynn")
                                        .withProvider("mdectehfiqscjey")
                                        .withResource("hezrkgq"))));
        model = BinaryData.fromObject(model).toObject(OperationEntityListResult.class);
        Assertions.assertEquals("ochcbonqvpkvl", model.nextLink());
        Assertions.assertEquals("ea", model.value().get(0).name());
        Assertions.assertEquals("pheoflokeyy", model.value().get(0).display().description());
        Assertions.assertEquals("nj", model.value().get(0).display().operation());
        Assertions.assertEquals("lwtgrhpdj", model.value().get(0).display().provider());
        Assertions.assertEquals("umasxazjpq", model.value().get(0).display().resource());
    }
}
