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

public final class DatabasePrincipalAssignmentInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatabasePrincipalAssignmentInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"principalId\":\"faoytehqpuv\",\"role\":\"Viewer\",\"tenantId\":\"qm\",\"principalType\":\"App\",\"tenantName\":\"ckygroejnndljdju\",\"principalName\":\"br\",\"provisioningState\":\"Moving\",\"aadObjectId\":\"n\"},\"id\":\"eysfaqegplw\",\"name\":\"ysh\",\"type\":\"ddkvbxgkqu\"}")
                .toObject(DatabasePrincipalAssignmentInner.class);
        Assertions.assertEquals("faoytehqpuv", model.principalId());
        Assertions.assertEquals(DatabasePrincipalRole.VIEWER, model.role());
        Assertions.assertEquals("qm", model.tenantId());
        Assertions.assertEquals(PrincipalType.APP, model.principalType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatabasePrincipalAssignmentInner model =
            new DatabasePrincipalAssignmentInner()
                .withPrincipalId("faoytehqpuv")
                .withRole(DatabasePrincipalRole.VIEWER)
                .withTenantId("qm")
                .withPrincipalType(PrincipalType.APP);
        model = BinaryData.fromObject(model).toObject(DatabasePrincipalAssignmentInner.class);
        Assertions.assertEquals("faoytehqpuv", model.principalId());
        Assertions.assertEquals(DatabasePrincipalRole.VIEWER, model.role());
        Assertions.assertEquals("qm", model.tenantId());
        Assertions.assertEquals(PrincipalType.APP, model.principalType());
    }
}
