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

public final class GenericRecoveryPointTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        GenericRecoveryPoint model =
            BinaryData
                .fromString(
                    "{\"objectType\":\"GenericRecoveryPoint\",\"friendlyName\":\"kpggqoweyi\",\"recoveryPointType\":\"hlisngw\",\"recoveryPointTime\":\"2021-04-30T08:04:33Z\",\"recoveryPointAdditionalInfo\":\"mpizru\",\"recoveryPointProperties\":{\"expiryTime\":\"qxpxiwfcngjsaa\",\"ruleName\":\"ixtmkzjvkviirhgf\",\"isSoftDeleted\":true}}")
                .toObject(GenericRecoveryPoint.class);
        Assertions.assertEquals("kpggqoweyi", model.friendlyName());
        Assertions.assertEquals("hlisngw", model.recoveryPointType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-04-30T08:04:33Z"), model.recoveryPointTime());
        Assertions.assertEquals("mpizru", model.recoveryPointAdditionalInfo());
        Assertions.assertEquals("qxpxiwfcngjsaa", model.recoveryPointProperties().expiryTime());
        Assertions.assertEquals("ixtmkzjvkviirhgf", model.recoveryPointProperties().ruleName());
        Assertions.assertEquals(true, model.recoveryPointProperties().isSoftDeleted());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        GenericRecoveryPoint model =
            new GenericRecoveryPoint()
                .withFriendlyName("kpggqoweyi")
                .withRecoveryPointType("hlisngw")
                .withRecoveryPointTime(OffsetDateTime.parse("2021-04-30T08:04:33Z"))
                .withRecoveryPointAdditionalInfo("mpizru")
                .withRecoveryPointProperties(
                    new RecoveryPointProperties()
                        .withExpiryTime("qxpxiwfcngjsaa")
                        .withRuleName("ixtmkzjvkviirhgf")
                        .withIsSoftDeleted(true));
        model = BinaryData.fromObject(model).toObject(GenericRecoveryPoint.class);
        Assertions.assertEquals("kpggqoweyi", model.friendlyName());
        Assertions.assertEquals("hlisngw", model.recoveryPointType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-04-30T08:04:33Z"), model.recoveryPointTime());
        Assertions.assertEquals("mpizru", model.recoveryPointAdditionalInfo());
        Assertions.assertEquals("qxpxiwfcngjsaa", model.recoveryPointProperties().expiryTime());
        Assertions.assertEquals("ixtmkzjvkviirhgf", model.recoveryPointProperties().ruleName());
        Assertions.assertEquals(true, model.recoveryPointProperties().isSoftDeleted());
    }
}
