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

public final class JobTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        Job model =
            BinaryData
                .fromString(
                    "{\"jobType\":\"Job\",\"entityFriendlyName\":\"rqhakauha\",\"backupManagementType\":\"AzureSql\",\"operation\":\"wxosowzxcug\",\"status\":\"jooxdjebw\",\"startTime\":\"2021-11-24T18:17:12Z\",\"endTime\":\"2021-05-20T12:38:42Z\",\"activityId\":\"vo\"}")
                .toObject(Job.class);
        Assertions.assertEquals("rqhakauha", model.entityFriendlyName());
        Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType());
        Assertions.assertEquals("wxosowzxcug", model.operation());
        Assertions.assertEquals("jooxdjebw", model.status());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-24T18:17:12Z"), model.startTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-20T12:38:42Z"), model.endTime());
        Assertions.assertEquals("vo", model.activityId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        Job model =
            new Job()
                .withEntityFriendlyName("rqhakauha")
                .withBackupManagementType(BackupManagementType.AZURE_SQL)
                .withOperation("wxosowzxcug")
                .withStatus("jooxdjebw")
                .withStartTime(OffsetDateTime.parse("2021-11-24T18:17:12Z"))
                .withEndTime(OffsetDateTime.parse("2021-05-20T12:38:42Z"))
                .withActivityId("vo");
        model = BinaryData.fromObject(model).toObject(Job.class);
        Assertions.assertEquals("rqhakauha", model.entityFriendlyName());
        Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType());
        Assertions.assertEquals("wxosowzxcug", model.operation());
        Assertions.assertEquals("jooxdjebw", model.status());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-24T18:17:12Z"), model.startTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-20T12:38:42Z"), model.endTime());
        Assertions.assertEquals("vo", model.activityId());
    }
}
