// 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 com.azure.resourcemanager.appcontainers.models.DiagnosticRendering;
import com.azure.resourcemanager.appcontainers.models.DiagnosticsDataApiResponse;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DiagnosticsDataApiResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DiagnosticsDataApiResponse model =
            BinaryData
                .fromString(
                    "{\"table\":{\"tableName\":\"wmd\",\"columns\":[{\"columnName\":\"klvxwmyg\",\"dataType\":\"pgpqchiszepnnb\",\"columnType\":\"rxgibbd\"},{\"columnName\":\"confozauors\",\"dataType\":\"okwbqplh\",\"columnType\":\"nuuepzlrp\"}],\"rows\":[\"datasoldweyuqdunv\",\"datannrwrbiork\"]},\"renderingProperties\":{\"type\":476504183,\"title\":\"jhhgdnhxmsi\",\"description\":\"omi\",\"isVisible\":false}}")
                .toObject(DiagnosticsDataApiResponse.class);
        Assertions.assertEquals("wmd", model.table().tableName());
        Assertions.assertEquals("klvxwmyg", model.table().columns().get(0).columnName());
        Assertions.assertEquals("pgpqchiszepnnb", model.table().columns().get(0).dataType());
        Assertions.assertEquals("rxgibbd", model.table().columns().get(0).columnType());
        Assertions.assertEquals(476504183, model.renderingProperties().type());
        Assertions.assertEquals("jhhgdnhxmsi", model.renderingProperties().title());
        Assertions.assertEquals("omi", model.renderingProperties().description());
        Assertions.assertEquals(false, model.renderingProperties().isVisible());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DiagnosticsDataApiResponse model =
            new DiagnosticsDataApiResponse()
                .withTable(
                    new DiagnosticDataTableResponseObject()
                        .withTableName("wmd")
                        .withColumns(
                            Arrays
                                .asList(
                                    new DiagnosticDataTableResponseColumn()
                                        .withColumnName("klvxwmyg")
                                        .withDataType("pgpqchiszepnnb")
                                        .withColumnType("rxgibbd"),
                                    new DiagnosticDataTableResponseColumn()
                                        .withColumnName("confozauors")
                                        .withDataType("okwbqplh")
                                        .withColumnType("nuuepzlrp")))
                        .withRows(Arrays.asList("datasoldweyuqdunv", "datannrwrbiork")))
                .withRenderingProperties(
                    new DiagnosticRendering()
                        .withType(476504183)
                        .withTitle("jhhgdnhxmsi")
                        .withDescription("omi")
                        .withIsVisible(false));
        model = BinaryData.fromObject(model).toObject(DiagnosticsDataApiResponse.class);
        Assertions.assertEquals("wmd", model.table().tableName());
        Assertions.assertEquals("klvxwmyg", model.table().columns().get(0).columnName());
        Assertions.assertEquals("pgpqchiszepnnb", model.table().columns().get(0).dataType());
        Assertions.assertEquals("rxgibbd", model.table().columns().get(0).columnType());
        Assertions.assertEquals(476504183, model.renderingProperties().type());
        Assertions.assertEquals("jhhgdnhxmsi", model.renderingProperties().title());
        Assertions.assertEquals("omi", model.renderingProperties().description());
        Assertions.assertEquals(false, model.renderingProperties().isVisible());
    }
}
