// 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.AzureVmWorkloadProtectedItemExtendedInfo;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class AzureVmWorkloadProtectedItemExtendedInfoTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureVmWorkloadProtectedItemExtendedInfo model =
            BinaryData
                .fromString(
                    "{\"oldestRecoveryPoint\":\"2021-01-31T05:51:19Z\",\"oldestRecoveryPointInVault\":\"2021-03-23T20:11:29Z\",\"oldestRecoveryPointInArchive\":\"2021-03-18T16:49:20Z\",\"newestRecoveryPointInArchive\":\"2020-12-23T19:56:30Z\",\"recoveryPointCount\":159855339,\"policyState\":\"ktwkuziyc\",\"recoveryModel\":\"evufuztck\"}")
                .toObject(AzureVmWorkloadProtectedItemExtendedInfo.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-31T05:51:19Z"), model.oldestRecoveryPoint());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-23T20:11:29Z"), model.oldestRecoveryPointInVault());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-18T16:49:20Z"), model.oldestRecoveryPointInArchive());
        Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T19:56:30Z"), model.newestRecoveryPointInArchive());
        Assertions.assertEquals(159855339, model.recoveryPointCount());
        Assertions.assertEquals("ktwkuziyc", model.policyState());
        Assertions.assertEquals("evufuztck", model.recoveryModel());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureVmWorkloadProtectedItemExtendedInfo model =
            new AzureVmWorkloadProtectedItemExtendedInfo()
                .withOldestRecoveryPoint(OffsetDateTime.parse("2021-01-31T05:51:19Z"))
                .withOldestRecoveryPointInVault(OffsetDateTime.parse("2021-03-23T20:11:29Z"))
                .withOldestRecoveryPointInArchive(OffsetDateTime.parse("2021-03-18T16:49:20Z"))
                .withNewestRecoveryPointInArchive(OffsetDateTime.parse("2020-12-23T19:56:30Z"))
                .withRecoveryPointCount(159855339)
                .withPolicyState("ktwkuziyc")
                .withRecoveryModel("evufuztck");
        model = BinaryData.fromObject(model).toObject(AzureVmWorkloadProtectedItemExtendedInfo.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-31T05:51:19Z"), model.oldestRecoveryPoint());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-23T20:11:29Z"), model.oldestRecoveryPointInVault());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-18T16:49:20Z"), model.oldestRecoveryPointInArchive());
        Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T19:56:30Z"), model.newestRecoveryPointInArchive());
        Assertions.assertEquals(159855339, model.recoveryPointCount());
        Assertions.assertEquals("ktwkuziyc", model.policyState());
        Assertions.assertEquals("evufuztck", model.recoveryModel());
    }
}
