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

package com.azure.resourcemanager.postgresqlflexibleserver.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.DatabaseInner;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DatabaseListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DatabaseListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatabaseListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"charset\":\"wxrjfeallnwsub\",\"collation\":\"njampm\"},\"id\":\"nzscxa\",\"name\":\"wooc\",\"type\":\"cbonqvpk\"},{\"properties\":{\"charset\":\"xnj\",\"collation\":\"seiphe\"},\"id\":\"lokeyy\",\"name\":\"enjbdlwtgrhp\",\"type\":\"jp\"}],\"nextLink\":\"masxazjpqyegu\"}")
                .toObject(DatabaseListResult.class);
        Assertions.assertEquals("wxrjfeallnwsub", model.value().get(0).charset());
        Assertions.assertEquals("njampm", model.value().get(0).collation());
        Assertions.assertEquals("masxazjpqyegu", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatabaseListResult model =
            new DatabaseListResult()
                .withValue(
                    Arrays
                        .asList(
                            new DatabaseInner().withCharset("wxrjfeallnwsub").withCollation("njampm"),
                            new DatabaseInner().withCharset("xnj").withCollation("seiphe")))
                .withNextLink("masxazjpqyegu");
        model = BinaryData.fromObject(model).toObject(DatabaseListResult.class);
        Assertions.assertEquals("wxrjfeallnwsub", model.value().get(0).charset());
        Assertions.assertEquals("njampm", model.value().get(0).collation());
        Assertions.assertEquals("masxazjpqyegu", model.nextLink());
    }
}
