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

package com.azure.resourcemanager.recoveryservicesbackup.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSClassicComputeVMProtectableItem;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus;
import org.junit.jupiter.api.Assertions;

public final class AzureIaaSClassicComputeVMProtectableItemTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureIaaSClassicComputeVMProtectableItem model =
            BinaryData
                .fromString(
                    "{\"protectableItemType\":\"Microsoft.ClassicCompute/virtualMachines\",\"virtualMachineId\":\"arfsi\",\"virtualMachineVersion\":\"lkjxnqpvwgf\",\"resourceGroup\":\"mhqykizmdksa\",\"backupManagementType\":\"fcluqvo\",\"workloadType\":\"ycjimryvwgcwwpbm\",\"friendlyName\":\"w\",\"protectionState\":\"ProtectionFailed\"}")
                .toObject(AzureIaaSClassicComputeVMProtectableItem.class);
        Assertions.assertEquals("fcluqvo", model.backupManagementType());
        Assertions.assertEquals("ycjimryvwgcwwpbm", model.workloadType());
        Assertions.assertEquals("w", model.friendlyName());
        Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState());
        Assertions.assertEquals("arfsi", model.virtualMachineId());
        Assertions.assertEquals("lkjxnqpvwgf", model.virtualMachineVersion());
        Assertions.assertEquals("mhqykizmdksa", model.resourceGroup());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureIaaSClassicComputeVMProtectableItem model =
            new AzureIaaSClassicComputeVMProtectableItem()
                .withBackupManagementType("fcluqvo")
                .withWorkloadType("ycjimryvwgcwwpbm")
                .withFriendlyName("w")
                .withProtectionState(ProtectionStatus.PROTECTION_FAILED)
                .withVirtualMachineId("arfsi")
                .withVirtualMachineVersion("lkjxnqpvwgf")
                .withResourceGroup("mhqykizmdksa");
        model = BinaryData.fromObject(model).toObject(AzureIaaSClassicComputeVMProtectableItem.class);
        Assertions.assertEquals("fcluqvo", model.backupManagementType());
        Assertions.assertEquals("ycjimryvwgcwwpbm", model.workloadType());
        Assertions.assertEquals("w", model.friendlyName());
        Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState());
        Assertions.assertEquals("arfsi", model.virtualMachineId());
        Assertions.assertEquals("lkjxnqpvwgf", model.virtualMachineVersion());
        Assertions.assertEquals("mhqykizmdksa", model.resourceGroup());
    }
}
