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

package com.azure.resourcemanager.synapse.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.synapse.models.Compression;
import com.azure.resourcemanager.synapse.models.EventHubDataConnection;
import com.azure.resourcemanager.synapse.models.EventHubDataFormat;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class EventHubDataConnectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EventHubDataConnection model =
            BinaryData
                .fromString(
                    "{\"kind\":\"EventHub\",\"properties\":{\"eventHubResourceId\":\"lhdjzqd\",\"consumerGroup\":\"a\",\"tableName\":\"vpsozjiihjri\",\"mappingRuleName\":\"mrzoep\",\"dataFormat\":\"PARQUET\",\"eventSystemProperties\":[\"wnjkgvfn\"],\"compression\":\"GZip\",\"provisioningState\":\"Moving\",\"managedIdentityResourceId\":\"q\"},\"location\":\"ibtyibuyvpirfqjp\",\"id\":\"noow\",\"name\":\"bedenrexkx\",\"type\":\"hxvucnu\"}")
                .toObject(EventHubDataConnection.class);
        Assertions.assertEquals("ibtyibuyvpirfqjp", model.location());
        Assertions.assertEquals("lhdjzqd", model.eventHubResourceId());
        Assertions.assertEquals("a", model.consumerGroup());
        Assertions.assertEquals("vpsozjiihjri", model.tableName());
        Assertions.assertEquals("mrzoep", model.mappingRuleName());
        Assertions.assertEquals(EventHubDataFormat.PARQUET, model.dataFormat());
        Assertions.assertEquals("wnjkgvfn", model.eventSystemProperties().get(0));
        Assertions.assertEquals(Compression.GZIP, model.compression());
        Assertions.assertEquals("q", model.managedIdentityResourceId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EventHubDataConnection model =
            new EventHubDataConnection()
                .withLocation("ibtyibuyvpirfqjp")
                .withEventHubResourceId("lhdjzqd")
                .withConsumerGroup("a")
                .withTableName("vpsozjiihjri")
                .withMappingRuleName("mrzoep")
                .withDataFormat(EventHubDataFormat.PARQUET)
                .withEventSystemProperties(Arrays.asList("wnjkgvfn"))
                .withCompression(Compression.GZIP)
                .withManagedIdentityResourceId("q");
        model = BinaryData.fromObject(model).toObject(EventHubDataConnection.class);
        Assertions.assertEquals("ibtyibuyvpirfqjp", model.location());
        Assertions.assertEquals("lhdjzqd", model.eventHubResourceId());
        Assertions.assertEquals("a", model.consumerGroup());
        Assertions.assertEquals("vpsozjiihjri", model.tableName());
        Assertions.assertEquals("mrzoep", model.mappingRuleName());
        Assertions.assertEquals(EventHubDataFormat.PARQUET, model.dataFormat());
        Assertions.assertEquals("wnjkgvfn", model.eventSystemProperties().get(0));
        Assertions.assertEquals(Compression.GZIP, model.compression());
        Assertions.assertEquals("q", model.managedIdentityResourceId());
    }
}
