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

public final class EventGridConnectionPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EventGridConnectionProperties model =
            BinaryData
                .fromString(
                    "{\"storageAccountResourceId\":\"yutrymd\",\"eventHubResourceId\":\"mfjhpycvjqdvdwkq\",\"consumerGroup\":\"ldrlefgnaavua\",\"tableName\":\"tetaoutnpdctuhs\",\"mappingRuleName\":\"efyihduyeuyl\",\"dataFormat\":\"APACHEAVRO\",\"ignoreFirstRecord\":false,\"blobStorageEventType\":\"Microsoft.Storage.BlobRenamed\",\"provisioningState\":\"Running\"}")
                .toObject(EventGridConnectionProperties.class);
        Assertions.assertEquals("yutrymd", model.storageAccountResourceId());
        Assertions.assertEquals("mfjhpycvjqdvdwkq", model.eventHubResourceId());
        Assertions.assertEquals("ldrlefgnaavua", model.consumerGroup());
        Assertions.assertEquals("tetaoutnpdctuhs", model.tableName());
        Assertions.assertEquals("efyihduyeuyl", model.mappingRuleName());
        Assertions.assertEquals(EventGridDataFormat.APACHEAVRO, model.dataFormat());
        Assertions.assertEquals(false, model.ignoreFirstRecord());
        Assertions.assertEquals(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_RENAMED, model.blobStorageEventType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EventGridConnectionProperties model =
            new EventGridConnectionProperties()
                .withStorageAccountResourceId("yutrymd")
                .withEventHubResourceId("mfjhpycvjqdvdwkq")
                .withConsumerGroup("ldrlefgnaavua")
                .withTableName("tetaoutnpdctuhs")
                .withMappingRuleName("efyihduyeuyl")
                .withDataFormat(EventGridDataFormat.APACHEAVRO)
                .withIgnoreFirstRecord(false)
                .withBlobStorageEventType(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_RENAMED);
        model = BinaryData.fromObject(model).toObject(EventGridConnectionProperties.class);
        Assertions.assertEquals("yutrymd", model.storageAccountResourceId());
        Assertions.assertEquals("mfjhpycvjqdvdwkq", model.eventHubResourceId());
        Assertions.assertEquals("ldrlefgnaavua", model.consumerGroup());
        Assertions.assertEquals("tetaoutnpdctuhs", model.tableName());
        Assertions.assertEquals("efyihduyeuyl", model.mappingRuleName());
        Assertions.assertEquals(EventGridDataFormat.APACHEAVRO, model.dataFormat());
        Assertions.assertEquals(false, model.ignoreFirstRecord());
        Assertions.assertEquals(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_RENAMED, model.blobStorageEventType());
    }
}
