// 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.AzureWorkloadBackupRequest;
import com.azure.resourcemanager.recoveryservicesbackup.models.BackupType;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class AzureWorkloadBackupRequestTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureWorkloadBackupRequest model =
            BinaryData
                .fromString(
                    "{\"objectType\":\"AzureWorkloadBackupRequest\",\"backupType\":\"Incremental\",\"enableCompression\":false,\"recoveryPointExpiryTimeInUTC\":\"2021-05-21T17:48:07Z\"}")
                .toObject(AzureWorkloadBackupRequest.class);
        Assertions.assertEquals(BackupType.INCREMENTAL, model.backupType());
        Assertions.assertEquals(false, model.enableCompression());
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-21T17:48:07Z"), model.recoveryPointExpiryTimeInUtc());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureWorkloadBackupRequest model =
            new AzureWorkloadBackupRequest()
                .withBackupType(BackupType.INCREMENTAL)
                .withEnableCompression(false)
                .withRecoveryPointExpiryTimeInUtc(OffsetDateTime.parse("2021-05-21T17:48:07Z"));
        model = BinaryData.fromObject(model).toObject(AzureWorkloadBackupRequest.class);
        Assertions.assertEquals(BackupType.INCREMENTAL, model.backupType());
        Assertions.assertEquals(false, model.enableCompression());
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-21T17:48:07Z"), model.recoveryPointExpiryTimeInUtc());
    }
}
