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

public final class IotHubDataConnectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IotHubDataConnection model =
            BinaryData
                .fromString(
                    "{\"kind\":\"IotHub\",\"properties\":{\"iotHubResourceId\":\"uzlbcnn\",\"consumerGroup\":\"t\",\"tableName\":\"xawqy\",\"mappingRuleName\":\"lhdyzmyckzex\",\"dataFormat\":\"TXT\",\"eventSystemProperties\":[\"kywymxgaabj\",\"dtfohfaog\",\"vkiwrsiwdyjqu\"],\"sharedAccessPolicyName\":\"ykcrraue\",\"provisioningState\":\"Succeeded\"},\"location\":\"uehogdd\",\"id\":\"bcbgydlqidywmhm\",\"name\":\"tyrilkfbnrqqxvz\",\"type\":\"pbnfnqtx\"}")
                .toObject(IotHubDataConnection.class);
        Assertions.assertEquals("uehogdd", model.location());
        Assertions.assertEquals("uzlbcnn", model.iotHubResourceId());
        Assertions.assertEquals("t", model.consumerGroup());
        Assertions.assertEquals("xawqy", model.tableName());
        Assertions.assertEquals("lhdyzmyckzex", model.mappingRuleName());
        Assertions.assertEquals(IotHubDataFormat.TXT, model.dataFormat());
        Assertions.assertEquals("kywymxgaabj", model.eventSystemProperties().get(0));
        Assertions.assertEquals("ykcrraue", model.sharedAccessPolicyName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IotHubDataConnection model =
            new IotHubDataConnection()
                .withLocation("uehogdd")
                .withIotHubResourceId("uzlbcnn")
                .withConsumerGroup("t")
                .withTableName("xawqy")
                .withMappingRuleName("lhdyzmyckzex")
                .withDataFormat(IotHubDataFormat.TXT)
                .withEventSystemProperties(Arrays.asList("kywymxgaabj", "dtfohfaog", "vkiwrsiwdyjqu"))
                .withSharedAccessPolicyName("ykcrraue");
        model = BinaryData.fromObject(model).toObject(IotHubDataConnection.class);
        Assertions.assertEquals("uehogdd", model.location());
        Assertions.assertEquals("uzlbcnn", model.iotHubResourceId());
        Assertions.assertEquals("t", model.consumerGroup());
        Assertions.assertEquals("xawqy", model.tableName());
        Assertions.assertEquals("lhdyzmyckzex", model.mappingRuleName());
        Assertions.assertEquals(IotHubDataFormat.TXT, model.dataFormat());
        Assertions.assertEquals("kywymxgaabj", model.eventSystemProperties().get(0));
        Assertions.assertEquals("ykcrraue", model.sharedAccessPolicyName());
    }
}
