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

package com.azure.resourcemanager.kusto.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.kusto.models.CosmosDbDataConnection;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class CosmosDbDataConnectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CosmosDbDataConnection model =
            BinaryData
                .fromString(
                    "{\"kind\":\"CosmosDb\",\"properties\":{\"tableName\":\"on\",\"mappingRuleName\":\"yhgfipnsx\",\"managedIdentityResourceId\":\"mcwaekrrjr\",\"managedIdentityObjectId\":\"fxtsgum\",\"cosmosDbAccountResourceId\":\"jglikkxwslolb\",\"cosmosDbDatabase\":\"pvuzlmv\",\"cosmosDbContainer\":\"elfk\",\"retrievalStartDate\":\"2021-02-21T20:32:58Z\",\"provisioningState\":\"Succeeded\"},\"location\":\"pwjxezn\",\"id\":\"igbrnjw\",\"name\":\"wkpnbsaz\",\"type\":\"jjoqkagf\"}")
                .toObject(CosmosDbDataConnection.class);
        Assertions.assertEquals("pwjxezn", model.location());
        Assertions.assertEquals("on", model.tableName());
        Assertions.assertEquals("yhgfipnsx", model.mappingRuleName());
        Assertions.assertEquals("mcwaekrrjr", model.managedIdentityResourceId());
        Assertions.assertEquals("jglikkxwslolb", model.cosmosDbAccountResourceId());
        Assertions.assertEquals("pvuzlmv", model.cosmosDbDatabase());
        Assertions.assertEquals("elfk", model.cosmosDbContainer());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-21T20:32:58Z"), model.retrievalStartDate());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CosmosDbDataConnection model =
            new CosmosDbDataConnection()
                .withLocation("pwjxezn")
                .withTableName("on")
                .withMappingRuleName("yhgfipnsx")
                .withManagedIdentityResourceId("mcwaekrrjr")
                .withCosmosDbAccountResourceId("jglikkxwslolb")
                .withCosmosDbDatabase("pvuzlmv")
                .withCosmosDbContainer("elfk")
                .withRetrievalStartDate(OffsetDateTime.parse("2021-02-21T20:32:58Z"));
        model = BinaryData.fromObject(model).toObject(CosmosDbDataConnection.class);
        Assertions.assertEquals("pwjxezn", model.location());
        Assertions.assertEquals("on", model.tableName());
        Assertions.assertEquals("yhgfipnsx", model.mappingRuleName());
        Assertions.assertEquals("mcwaekrrjr", model.managedIdentityResourceId());
        Assertions.assertEquals("jglikkxwslolb", model.cosmosDbAccountResourceId());
        Assertions.assertEquals("pvuzlmv", model.cosmosDbDatabase());
        Assertions.assertEquals("elfk", model.cosmosDbContainer());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-21T20:32:58Z"), model.retrievalStartDate());
    }
}
