// 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\":\"Pending\",\"resourceId\":\"ainqpjwnzlljfm\",\"lastUpdateTime\":\"2021-03-13T08:06:39Z\"}")
                .toObject(ApplyUpdateProperties.class);
        Assertions.assertEquals(UpdateStatus.PENDING, model.status());
        Assertions.assertEquals("ainqpjwnzlljfm", model.resourceId());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-13T08:06:39Z"), model.lastUpdateTime());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ApplyUpdateProperties model =
            new ApplyUpdateProperties()
                .withStatus(UpdateStatus.PENDING)
                .withResourceId("ainqpjwnzlljfm")
                .withLastUpdateTime(OffsetDateTime.parse("2021-03-13T08:06:39Z"));
        model = BinaryData.fromObject(model).toObject(ApplyUpdateProperties.class);
        Assertions.assertEquals(UpdateStatus.PENDING, model.status());
        Assertions.assertEquals("ainqpjwnzlljfm", model.resourceId());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-13T08:06:39Z"), model.lastUpdateTime());
    }
}
