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

package com.azure.resourcemanager.databricks.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.databricks.models.WorkspaceProviderAuthorization;
import java.util.UUID;
import org.junit.jupiter.api.Assertions;

public final class WorkspaceProviderAuthorizationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        WorkspaceProviderAuthorization model =
            BinaryData
                .fromString(
                    "{\"principalId\":\"4fd517cd-d648-4f01-9053-54d0c89de410\",\"roleDefinitionId\":\"ffb05287-7804-4938-b591-9b5921328ff7\"}")
                .toObject(WorkspaceProviderAuthorization.class);
        Assertions.assertEquals(UUID.fromString("4fd517cd-d648-4f01-9053-54d0c89de410"), model.principalId());
        Assertions.assertEquals(UUID.fromString("ffb05287-7804-4938-b591-9b5921328ff7"), model.roleDefinitionId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        WorkspaceProviderAuthorization model =
            new WorkspaceProviderAuthorization()
                .withPrincipalId(UUID.fromString("4fd517cd-d648-4f01-9053-54d0c89de410"))
                .withRoleDefinitionId(UUID.fromString("ffb05287-7804-4938-b591-9b5921328ff7"));
        model = BinaryData.fromObject(model).toObject(WorkspaceProviderAuthorization.class);
        Assertions.assertEquals(UUID.fromString("4fd517cd-d648-4f01-9053-54d0c89de410"), model.principalId());
        Assertions.assertEquals(UUID.fromString("ffb05287-7804-4938-b591-9b5921328ff7"), model.roleDefinitionId());
    }
}
