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

public final class AzureSqlProtectedItemExtendedInfoTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureSqlProtectedItemExtendedInfo model =
            BinaryData
                .fromString(
                    "{\"oldestRecoveryPoint\":\"2021-09-16T17:42:02Z\",\"recoveryPointCount\":970870399,\"policyState\":\"ayakkudzpx\"}")
                .toObject(AzureSqlProtectedItemExtendedInfo.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-16T17:42:02Z"), model.oldestRecoveryPoint());
        Assertions.assertEquals(970870399, model.recoveryPointCount());
        Assertions.assertEquals("ayakkudzpx", model.policyState());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureSqlProtectedItemExtendedInfo model =
            new AzureSqlProtectedItemExtendedInfo()
                .withOldestRecoveryPoint(OffsetDateTime.parse("2021-09-16T17:42:02Z"))
                .withRecoveryPointCount(970870399)
                .withPolicyState("ayakkudzpx");
        model = BinaryData.fromObject(model).toObject(AzureSqlProtectedItemExtendedInfo.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-16T17:42:02Z"), model.oldestRecoveryPoint());
        Assertions.assertEquals(970870399, model.recoveryPointCount());
        Assertions.assertEquals("ayakkudzpx", model.policyState());
    }
}
