// 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.BlobStorageEventType;
import com.azure.resourcemanager.synapse.models.EventGridDataConnection;
import com.azure.resourcemanager.synapse.models.EventGridDataFormat;
import org.junit.jupiter.api.Assertions;

public final class EventGridDataConnectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EventGridDataConnection model =
            BinaryData
                .fromString(
                    "{\"kind\":\"EventGrid\",\"properties\":{\"storageAccountResourceId\":\"pmfbfununmpzkr\",\"eventHubResourceId\":\"fyif\",\"consumerGroup\":\"dschlzvfictnkjjw\",\"tableName\":\"wnphbkgfyrto\",\"mappingRuleName\":\"hmjpjscdfpdqwtyg\",\"dataFormat\":\"TSVE\",\"ignoreFirstRecord\":false,\"blobStorageEventType\":\"Microsoft.Storage.BlobCreated\",\"provisioningState\":\"Deleting\"},\"location\":\"xifvqnrxtmbpjpt\",\"id\":\"wjhrsidqpxlbtpa\",\"name\":\"f\",\"type\":\"ngatwmy\"}")
                .toObject(EventGridDataConnection.class);
        Assertions.assertEquals("xifvqnrxtmbpjpt", model.location());
        Assertions.assertEquals("pmfbfununmpzkr", model.storageAccountResourceId());
        Assertions.assertEquals("fyif", model.eventHubResourceId());
        Assertions.assertEquals("dschlzvfictnkjjw", model.consumerGroup());
        Assertions.assertEquals("wnphbkgfyrto", model.tableName());
        Assertions.assertEquals("hmjpjscdfpdqwtyg", model.mappingRuleName());
        Assertions.assertEquals(EventGridDataFormat.TSVE, model.dataFormat());
        Assertions.assertEquals(false, model.ignoreFirstRecord());
        Assertions.assertEquals(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_CREATED, model.blobStorageEventType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EventGridDataConnection model =
            new EventGridDataConnection()
                .withLocation("xifvqnrxtmbpjpt")
                .withStorageAccountResourceId("pmfbfununmpzkr")
                .withEventHubResourceId("fyif")
                .withConsumerGroup("dschlzvfictnkjjw")
                .withTableName("wnphbkgfyrto")
                .withMappingRuleName("hmjpjscdfpdqwtyg")
                .withDataFormat(EventGridDataFormat.TSVE)
                .withIgnoreFirstRecord(false)
                .withBlobStorageEventType(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_CREATED);
        model = BinaryData.fromObject(model).toObject(EventGridDataConnection.class);
        Assertions.assertEquals("xifvqnrxtmbpjpt", model.location());
        Assertions.assertEquals("pmfbfununmpzkr", model.storageAccountResourceId());
        Assertions.assertEquals("fyif", model.eventHubResourceId());
        Assertions.assertEquals("dschlzvfictnkjjw", model.consumerGroup());
        Assertions.assertEquals("wnphbkgfyrto", model.tableName());
        Assertions.assertEquals("hmjpjscdfpdqwtyg", model.mappingRuleName());
        Assertions.assertEquals(EventGridDataFormat.TSVE, model.dataFormat());
        Assertions.assertEquals(false, model.ignoreFirstRecord());
        Assertions.assertEquals(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_CREATED, model.blobStorageEventType());
    }
}
