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

package com.azure.resourcemanager.newrelicobservability.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.newrelicobservability.fluent.models.AccountResourceInner;
import com.azure.resourcemanager.newrelicobservability.models.AccountsListResponse;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AccountsListResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AccountsListResponse model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"organizationId\":\"ithxqhabifpi\",\"accountId\":\"wczbys\",\"accountName\":\"pqxu\",\"region\":\"vyq\"},\"id\":\"wby\",\"name\":\"rkxvdum\",\"type\":\"grtfwvu\"}],\"nextLink\":\"gaudcc\"}")
                .toObject(AccountsListResponse.class);
        Assertions.assertEquals("ithxqhabifpi", model.value().get(0).organizationId());
        Assertions.assertEquals("wczbys", model.value().get(0).accountId());
        Assertions.assertEquals("pqxu", model.value().get(0).accountName());
        Assertions.assertEquals("vyq", model.value().get(0).region());
        Assertions.assertEquals("gaudcc", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AccountsListResponse model =
            new AccountsListResponse()
                .withValue(
                    Arrays
                        .asList(
                            new AccountResourceInner()
                                .withOrganizationId("ithxqhabifpi")
                                .withAccountId("wczbys")
                                .withAccountName("pqxu")
                                .withRegion("vyq")))
                .withNextLink("gaudcc");
        model = BinaryData.fromObject(model).toObject(AccountsListResponse.class);
        Assertions.assertEquals("ithxqhabifpi", model.value().get(0).organizationId());
        Assertions.assertEquals("wczbys", model.value().get(0).accountId());
        Assertions.assertEquals("pqxu", model.value().get(0).accountName());
        Assertions.assertEquals("vyq", model.value().get(0).region());
        Assertions.assertEquals("gaudcc", model.nextLink());
    }
}
