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

package com.azure.resourcemanager.recoveryservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservices.models.PrivateEndpointConnection;
import com.azure.resourcemanager.recoveryservices.models.VaultSubResourceType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PrivateEndpointConnectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PrivateEndpointConnection model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Succeeded\",\"privateEndpoint\":{\"id\":\"xrjfeallnwsub\"},\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"mpmngnzscxaqwoo\",\"actionsRequired\":\"cbonqvpk\"},\"groupIds\":[\"AzureBackup_secondary\",\"AzureSiteRecovery\",\"AzureSiteRecovery\",\"AzureBackup\"]}")
                .toObject(PrivateEndpointConnection.class);
        Assertions.assertEquals(VaultSubResourceType.AZURE_BACKUP_SECONDARY, model.groupIds().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateEndpointConnection model =
            new PrivateEndpointConnection()
                .withGroupIds(
                    Arrays
                        .asList(
                            VaultSubResourceType.AZURE_BACKUP_SECONDARY,
                            VaultSubResourceType.AZURE_SITE_RECOVERY,
                            VaultSubResourceType.AZURE_SITE_RECOVERY,
                            VaultSubResourceType.AZURE_BACKUP));
        model = BinaryData.fromObject(model).toObject(PrivateEndpointConnection.class);
        Assertions.assertEquals(VaultSubResourceType.AZURE_BACKUP_SECONDARY, model.groupIds().get(0));
    }
}
