// 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.MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputDatabaseError;
import com.azure.resourcemanager.datamigration.models.SyncMigrationDatabaseErrorEvent;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputDatabaseErrorTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputDatabaseError model =
            BinaryData
                .fromString(
                    "{\"resultType\":\"DatabaseLevelErrorOutput\",\"errorMessage\":\"cgpik\",\"events\":[{\"timestampString\":\"ejzanlfz\",\"eventTypeString\":\"av\",\"eventText\":\"bzonok\"},{\"timestampString\":\"rjqc\",\"eventTypeString\":\"gzpfrla\",\"eventText\":\"zrnw\"}],\"id\":\"indfpwpjyl\"}")
                .toObject(MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputDatabaseError.class);
        Assertions.assertEquals("cgpik", model.errorMessage());
    }

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