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

package com.azure.resourcemanager.machinelearning.generated;

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

public final class ManagedIdentityTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ManagedIdentity model =
            BinaryData
                .fromString(
                    "{\"identityType\":\"Managed\",\"clientId\":\"49930aac-491a-4ce3-99bb-f763f6db3ac3\",\"objectId\":\"2fd57264-6306-4a7e-bd5d-0d45048516e5\",\"resourceId\":\"clg\"}")
                .toObject(ManagedIdentity.class);
        Assertions.assertEquals(UUID.fromString("49930aac-491a-4ce3-99bb-f763f6db3ac3"), model.clientId());
        Assertions.assertEquals(UUID.fromString("2fd57264-6306-4a7e-bd5d-0d45048516e5"), model.objectId());
        Assertions.assertEquals("clg", model.resourceId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ManagedIdentity model =
            new ManagedIdentity()
                .withClientId(UUID.fromString("49930aac-491a-4ce3-99bb-f763f6db3ac3"))
                .withObjectId(UUID.fromString("2fd57264-6306-4a7e-bd5d-0d45048516e5"))
                .withResourceId("clg");
        model = BinaryData.fromObject(model).toObject(ManagedIdentity.class);
        Assertions.assertEquals(UUID.fromString("49930aac-491a-4ce3-99bb-f763f6db3ac3"), model.clientId());
        Assertions.assertEquals(UUID.fromString("2fd57264-6306-4a7e-bd5d-0d45048516e5"), model.objectId());
        Assertions.assertEquals("clg", model.resourceId());
    }
}
