// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.maintenance.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.maintenance.fluent.models.ApplyUpdateProperties;
import com.azure.resourcemanager.maintenance.models.UpdateStatus;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class ApplyUpdatePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ApplyUpdateProperties model =
            BinaryData
                .fromString(
                    "{\"status\":\"RetryLater\",\"resourceId\":\"dcsi\",\"lastUpdateTime\":\"2021-11-05T13:04:28Z\"}")
                .toObject(ApplyUpdateProperties.class);
        Assertions.assertEquals(UpdateStatus.RETRY_LATER, model.status());
        Assertions.assertEquals("dcsi", model.resourceId());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-05T13:04:28Z"), model.lastUpdateTime());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ApplyUpdateProperties model =
            new ApplyUpdateProperties()
                .withStatus(UpdateStatus.RETRY_LATER)
                .withResourceId("dcsi")
                .withLastUpdateTime(OffsetDateTime.parse("2021-11-05T13:04:28Z"));
        model = BinaryData.fromObject(model).toObject(ApplyUpdateProperties.class);
        Assertions.assertEquals(UpdateStatus.RETRY_LATER, model.status());
        Assertions.assertEquals("dcsi", model.resourceId());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-05T13:04:28Z"), model.lastUpdateTime());
    }
}
