// 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.PlanDataResourceInner;
import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource;
import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource;
import com.azure.resourcemanager.newrelicobservability.models.PlanDataListResponse;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PlanDataListResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PlanDataListResponse model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"orgCreationSource\":\"LIFTR\",\"accountCreationSource\":\"NEWRELIC\"},\"id\":\"zaqsqsycbkbfk\",\"name\":\"ukdkexxppofmxa\",\"type\":\"c\"}],\"nextLink\":\"pg\"}")
                .toObject(PlanDataListResponse.class);
        Assertions.assertEquals(OrgCreationSource.LIFTR, model.value().get(0).orgCreationSource());
        Assertions.assertEquals(AccountCreationSource.NEWRELIC, model.value().get(0).accountCreationSource());
        Assertions.assertEquals("pg", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PlanDataListResponse model =
            new PlanDataListResponse()
                .withValue(
                    Arrays
                        .asList(
                            new PlanDataResourceInner()
                                .withOrgCreationSource(OrgCreationSource.LIFTR)
                                .withAccountCreationSource(AccountCreationSource.NEWRELIC)))
                .withNextLink("pg");
        model = BinaryData.fromObject(model).toObject(PlanDataListResponse.class);
        Assertions.assertEquals(OrgCreationSource.LIFTR, model.value().get(0).orgCreationSource());
        Assertions.assertEquals(AccountCreationSource.NEWRELIC, model.value().get(0).accountCreationSource());
        Assertions.assertEquals("pg", model.nextLink());
    }
}
