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

package com.azure.resourcemanager.datamigration.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datamigration.models.MigrateSqlServerSqlDbSyncTaskOutputDatabaseError;
import com.azure.resourcemanager.datamigration.models.SyncMigrationDatabaseErrorEvent;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MigrateSqlServerSqlDbSyncTaskOutputDatabaseErrorTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MigrateSqlServerSqlDbSyncTaskOutputDatabaseError model =
            BinaryData
                .fromString(
                    "{\"resultType\":\"DatabaseLevelErrorOutput\",\"errorMessage\":\"rddh\",\"events\":[{\"timestampString\":\"izzronasxiftozqy\",\"eventTypeString\":\"f\",\"eventText\":\"esgogc\"}],\"id\":\"onnxkrlgnyhm\"}")
                .toObject(MigrateSqlServerSqlDbSyncTaskOutputDatabaseError.class);
        Assertions.assertEquals("rddh", model.errorMessage());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MigrateSqlServerSqlDbSyncTaskOutputDatabaseError model =
            new MigrateSqlServerSqlDbSyncTaskOutputDatabaseError()
                .withErrorMessage("rddh")
                .withEvents(Arrays.asList(new SyncMigrationDatabaseErrorEvent()));
        model = BinaryData.fromObject(model).toObject(MigrateSqlServerSqlDbSyncTaskOutputDatabaseError.class);
        Assertions.assertEquals("rddh", model.errorMessage());
    }
}
