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

package com.azure.resourcemanager.mysqlflexibleserver.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerBackupInner;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class ServerBackupInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServerBackupInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"backupType\":\"ouajpsqucmpoyf\",\"completedTime\":\"2021-02-06T21:08:58Z\",\"source\":\"gknygjofjddeqs\"},\"id\":\"eupewnwreitjz\",\"name\":\"flusarhmof\",\"type\":\"qhsmyurkdtml\"}")
                .toObject(ServerBackupInner.class);
        Assertions.assertEquals("ouajpsqucmpoyf", model.backupType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-06T21:08:58Z"), model.completedTime());
        Assertions.assertEquals("gknygjofjddeqs", model.source());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServerBackupInner model =
            new ServerBackupInner()
                .withBackupType("ouajpsqucmpoyf")
                .withCompletedTime(OffsetDateTime.parse("2021-02-06T21:08:58Z"))
                .withSource("gknygjofjddeqs");
        model = BinaryData.fromObject(model).toObject(ServerBackupInner.class);
        Assertions.assertEquals("ouajpsqucmpoyf", model.backupType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-06T21:08:58Z"), model.completedTime());
        Assertions.assertEquals("gknygjofjddeqs", model.source());
    }
}
