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

public final class WorkloadItemTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        WorkloadItem model =
            BinaryData
                .fromString(
                    "{\"workloadItemType\":\"WorkloadItem\",\"backupManagementType\":\"zfoqouicybxar\",\"workloadType\":\"szufoxciqopidoa\",\"friendlyName\":\"iodhkhazxkhnz\",\"protectionState\":\"Protected\"}")
                .toObject(WorkloadItem.class);
        Assertions.assertEquals("zfoqouicybxar", model.backupManagementType());
        Assertions.assertEquals("szufoxciqopidoa", model.workloadType());
        Assertions.assertEquals("iodhkhazxkhnz", model.friendlyName());
        Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        WorkloadItem model =
            new WorkloadItem()
                .withBackupManagementType("zfoqouicybxar")
                .withWorkloadType("szufoxciqopidoa")
                .withFriendlyName("iodhkhazxkhnz")
                .withProtectionState(ProtectionStatus.PROTECTED);
        model = BinaryData.fromObject(model).toObject(WorkloadItem.class);
        Assertions.assertEquals("zfoqouicybxar", model.backupManagementType());
        Assertions.assertEquals("szufoxciqopidoa", model.workloadType());
        Assertions.assertEquals("iodhkhazxkhnz", model.friendlyName());
        Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState());
    }
}
