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

package com.azure.resourcemanager.appcontainers.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.appcontainers.models.DiagnosticDataTableResponseColumn;
import com.azure.resourcemanager.appcontainers.models.DiagnosticDataTableResponseObject;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DiagnosticDataTableResponseObjectTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DiagnosticDataTableResponseObject model =
            BinaryData
                .fromString(
                    "{\"tableName\":\"tqlkz\",\"columns\":[{\"columnName\":\"itgvkx\",\"dataType\":\"yqdrf\",\"columnType\":\"cealzxwh\"},{\"columnName\":\"nsymoyqhlwigd\",\"dataType\":\"bkbxgomfa\",\"columnType\":\"wasqvdaeyyg\"},{\"columnName\":\"akjsqz\",\"dataType\":\"bezkgimsidxasic\",\"columnType\":\"yvvjskgfmo\"}],\"rows\":[\"datahpqgatjeaahhvj\"]}")
                .toObject(DiagnosticDataTableResponseObject.class);
        Assertions.assertEquals("tqlkz", model.tableName());
        Assertions.assertEquals("itgvkx", model.columns().get(0).columnName());
        Assertions.assertEquals("yqdrf", model.columns().get(0).dataType());
        Assertions.assertEquals("cealzxwh", model.columns().get(0).columnType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DiagnosticDataTableResponseObject model =
            new DiagnosticDataTableResponseObject()
                .withTableName("tqlkz")
                .withColumns(
                    Arrays
                        .asList(
                            new DiagnosticDataTableResponseColumn()
                                .withColumnName("itgvkx")
                                .withDataType("yqdrf")
                                .withColumnType("cealzxwh"),
                            new DiagnosticDataTableResponseColumn()
                                .withColumnName("nsymoyqhlwigd")
                                .withDataType("bkbxgomfa")
                                .withColumnType("wasqvdaeyyg"),
                            new DiagnosticDataTableResponseColumn()
                                .withColumnName("akjsqz")
                                .withDataType("bezkgimsidxasic")
                                .withColumnType("yvvjskgfmo")))
                .withRows(Arrays.asList("datahpqgatjeaahhvj"));
        model = BinaryData.fromObject(model).toObject(DiagnosticDataTableResponseObject.class);
        Assertions.assertEquals("tqlkz", model.tableName());
        Assertions.assertEquals("itgvkx", model.columns().get(0).columnName());
        Assertions.assertEquals("yqdrf", model.columns().get(0).dataType());
        Assertions.assertEquals("cealzxwh", model.columns().get(0).columnType());
    }
}
