// 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.ClusterPrincipalProperties;
import com.azure.resourcemanager.synapse.models.ClusterPrincipalRole;
import com.azure.resourcemanager.synapse.models.PrincipalType;
import org.junit.jupiter.api.Assertions;

public final class ClusterPrincipalPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ClusterPrincipalProperties model =
            BinaryData
                .fromString(
                    "{\"principalId\":\"h\",\"role\":\"AllDatabasesViewer\",\"tenantId\":\"omew\",\"principalType\":\"User\",\"tenantName\":\"tl\",\"principalName\":\"hqawmo\",\"provisioningState\":\"Succeeded\",\"aadObjectId\":\"cz\"}")
                .toObject(ClusterPrincipalProperties.class);
        Assertions.assertEquals("h", model.principalId());
        Assertions.assertEquals(ClusterPrincipalRole.ALL_DATABASES_VIEWER, model.role());
        Assertions.assertEquals("omew", model.tenantId());
        Assertions.assertEquals(PrincipalType.USER, model.principalType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ClusterPrincipalProperties model =
            new ClusterPrincipalProperties()
                .withPrincipalId("h")
                .withRole(ClusterPrincipalRole.ALL_DATABASES_VIEWER)
                .withTenantId("omew")
                .withPrincipalType(PrincipalType.USER);
        model = BinaryData.fromObject(model).toObject(ClusterPrincipalProperties.class);
        Assertions.assertEquals("h", model.principalId());
        Assertions.assertEquals(ClusterPrincipalRole.ALL_DATABASES_VIEWER, model.role());
        Assertions.assertEquals("omew", model.tenantId());
        Assertions.assertEquals(PrincipalType.USER, model.principalType());
    }
}
