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

public final class IotHubConnectionPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IotHubConnectionProperties model =
            BinaryData
                .fromString(
                    "{\"iotHubResourceId\":\"to\",\"consumerGroup\":\"alswbnfd\",\"tableName\":\"pld\",\"mappingRuleName\":\"jnsfzygleexahvmy\",\"dataFormat\":\"PSV\",\"eventSystemProperties\":[\"carycsjjzyvoaqa\",\"uvehzptd\",\"krrbhmpful\"],\"sharedAccessPolicyName\":\"be\",\"provisioningState\":\"Moving\"}")
                .toObject(IotHubConnectionProperties.class);
        Assertions.assertEquals("to", model.iotHubResourceId());
        Assertions.assertEquals("alswbnfd", model.consumerGroup());
        Assertions.assertEquals("pld", model.tableName());
        Assertions.assertEquals("jnsfzygleexahvmy", model.mappingRuleName());
        Assertions.assertEquals(IotHubDataFormat.PSV, model.dataFormat());
        Assertions.assertEquals("carycsjjzyvoaqa", model.eventSystemProperties().get(0));
        Assertions.assertEquals("be", model.sharedAccessPolicyName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IotHubConnectionProperties model =
            new IotHubConnectionProperties()
                .withIotHubResourceId("to")
                .withConsumerGroup("alswbnfd")
                .withTableName("pld")
                .withMappingRuleName("jnsfzygleexahvmy")
                .withDataFormat(IotHubDataFormat.PSV)
                .withEventSystemProperties(Arrays.asList("carycsjjzyvoaqa", "uvehzptd", "krrbhmpful"))
                .withSharedAccessPolicyName("be");
        model = BinaryData.fromObject(model).toObject(IotHubConnectionProperties.class);
        Assertions.assertEquals("to", model.iotHubResourceId());
        Assertions.assertEquals("alswbnfd", model.consumerGroup());
        Assertions.assertEquals("pld", model.tableName());
        Assertions.assertEquals("jnsfzygleexahvmy", model.mappingRuleName());
        Assertions.assertEquals(IotHubDataFormat.PSV, model.dataFormat());
        Assertions.assertEquals("carycsjjzyvoaqa", model.eventSystemProperties().get(0));
        Assertions.assertEquals("be", model.sharedAccessPolicyName());
    }
}
