// 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.IaaSvmProtectableItem;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus;
import org.junit.jupiter.api.Assertions;

public final class IaaSvmProtectableItemTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IaaSvmProtectableItem model =
            BinaryData
                .fromString(
                    "{\"protectableItemType\":\"IaaSVMProtectableItem\",\"virtualMachineId\":\"sxwef\",\"virtualMachineVersion\":\"ecb\",\"resourceGroup\":\"pwndyqlea\",\"backupManagementType\":\"klmtkhlowkx\",\"workloadType\":\"vbrdfjmzsyzfho\",\"friendlyName\":\"h\",\"protectionState\":\"ProtectionFailed\"}")
                .toObject(IaaSvmProtectableItem.class);
        Assertions.assertEquals("klmtkhlowkx", model.backupManagementType());
        Assertions.assertEquals("vbrdfjmzsyzfho", model.workloadType());
        Assertions.assertEquals("h", model.friendlyName());
        Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState());
        Assertions.assertEquals("sxwef", model.virtualMachineId());
        Assertions.assertEquals("ecb", model.virtualMachineVersion());
        Assertions.assertEquals("pwndyqlea", model.resourceGroup());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IaaSvmProtectableItem model =
            new IaaSvmProtectableItem()
                .withBackupManagementType("klmtkhlowkx")
                .withWorkloadType("vbrdfjmzsyzfho")
                .withFriendlyName("h")
                .withProtectionState(ProtectionStatus.PROTECTION_FAILED)
                .withVirtualMachineId("sxwef")
                .withVirtualMachineVersion("ecb")
                .withResourceGroup("pwndyqlea");
        model = BinaryData.fromObject(model).toObject(IaaSvmProtectableItem.class);
        Assertions.assertEquals("klmtkhlowkx", model.backupManagementType());
        Assertions.assertEquals("vbrdfjmzsyzfho", model.workloadType());
        Assertions.assertEquals("h", model.friendlyName());
        Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState());
        Assertions.assertEquals("sxwef", model.virtualMachineId());
        Assertions.assertEquals("ecb", model.virtualMachineVersion());
        Assertions.assertEquals("pwndyqlea", model.resourceGroup());
    }
}
