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

package com.azure.resourcemanager.mysqlflexibleserver.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.DatabaseInner;
import com.azure.resourcemanager.mysqlflexibleserver.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\":\"dkfthwxmnt\",\"collation\":\"waopvkmijcmmxd\"},\"id\":\"fufsrpymzi\",\"name\":\"nsez\",\"type\":\"xtbzsgfyccsne\"},{\"properties\":{\"charset\":\"wzjeiach\",\"collation\":\"osfln\"},\"id\":\"sfqpteehz\",\"name\":\"vypyqrimzinpv\",\"type\":\"wjdk\"}],\"nextLink\":\"soodqxhcrmnoh\"}")
                .toObject(DatabaseListResult.class);
        Assertions.assertEquals("dkfthwxmnt", model.value().get(0).charset());
        Assertions.assertEquals("waopvkmijcmmxd", model.value().get(0).collation());
        Assertions.assertEquals("soodqxhcrmnoh", model.nextLink());
    }

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