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

public final class DatabasePrincipalPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatabasePrincipalProperties model =
            BinaryData
                .fromString(
                    "{\"principalId\":\"ybwptda\",\"role\":\"Monitor\",\"tenantId\":\"vvlfntymtp\",\"principalType\":\"Group\",\"tenantName\":\"enazerohzrsqals\",\"principalName\":\"dnwqapfg\",\"provisioningState\":\"Creating\",\"aadObjectId\":\"vessm\"}")
                .toObject(DatabasePrincipalProperties.class);
        Assertions.assertEquals("ybwptda", model.principalId());
        Assertions.assertEquals(DatabasePrincipalRole.MONITOR, model.role());
        Assertions.assertEquals("vvlfntymtp", model.tenantId());
        Assertions.assertEquals(PrincipalType.GROUP, model.principalType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatabasePrincipalProperties model =
            new DatabasePrincipalProperties()
                .withPrincipalId("ybwptda")
                .withRole(DatabasePrincipalRole.MONITOR)
                .withTenantId("vvlfntymtp")
                .withPrincipalType(PrincipalType.GROUP);
        model = BinaryData.fromObject(model).toObject(DatabasePrincipalProperties.class);
        Assertions.assertEquals("ybwptda", model.principalId());
        Assertions.assertEquals(DatabasePrincipalRole.MONITOR, model.role());
        Assertions.assertEquals("vvlfntymtp", model.tenantId());
        Assertions.assertEquals(PrincipalType.GROUP, model.principalType());
    }
}
