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

public final class AzureVmWorkloadSqlDatabaseWorkloadItemTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureVmWorkloadSqlDatabaseWorkloadItem model =
            BinaryData
                .fromString(
                    "{\"workloadItemType\":\"SQLDataBase\",\"parentName\":\"njad\",\"serverName\":\"oawjqoyueay\",\"isAutoProtectable\":true,\"subinquireditemcount\":1723468141,\"subWorkloadItemCount\":830999556,\"backupManagementType\":\"byrrueqth\",\"workloadType\":\"gnmbscbbxigdhx\",\"friendlyName\":\"d\",\"protectionState\":\"Protecting\"}")
                .toObject(AzureVmWorkloadSqlDatabaseWorkloadItem.class);
        Assertions.assertEquals("byrrueqth", model.backupManagementType());
        Assertions.assertEquals("gnmbscbbxigdhx", model.workloadType());
        Assertions.assertEquals("d", model.friendlyName());
        Assertions.assertEquals(ProtectionStatus.PROTECTING, model.protectionState());
        Assertions.assertEquals("njad", model.parentName());
        Assertions.assertEquals("oawjqoyueay", model.serverName());
        Assertions.assertEquals(true, model.isAutoProtectable());
        Assertions.assertEquals(1723468141, model.subinquireditemcount());
        Assertions.assertEquals(830999556, model.subWorkloadItemCount());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureVmWorkloadSqlDatabaseWorkloadItem model =
            new AzureVmWorkloadSqlDatabaseWorkloadItem()
                .withBackupManagementType("byrrueqth")
                .withWorkloadType("gnmbscbbxigdhx")
                .withFriendlyName("d")
                .withProtectionState(ProtectionStatus.PROTECTING)
                .withParentName("njad")
                .withServerName("oawjqoyueay")
                .withIsAutoProtectable(true)
                .withSubinquireditemcount(1723468141)
                .withSubWorkloadItemCount(830999556);
        model = BinaryData.fromObject(model).toObject(AzureVmWorkloadSqlDatabaseWorkloadItem.class);
        Assertions.assertEquals("byrrueqth", model.backupManagementType());
        Assertions.assertEquals("gnmbscbbxigdhx", model.workloadType());
        Assertions.assertEquals("d", model.friendlyName());
        Assertions.assertEquals(ProtectionStatus.PROTECTING, model.protectionState());
        Assertions.assertEquals("njad", model.parentName());
        Assertions.assertEquals("oawjqoyueay", model.serverName());
        Assertions.assertEquals(true, model.isAutoProtectable());
        Assertions.assertEquals(1723468141, model.subinquireditemcount());
        Assertions.assertEquals(830999556, model.subWorkloadItemCount());
    }
}
