From e6d1dc4429d76d3f60cbfac57d27561e2c7e9ac9 Mon Sep 17 00:00:00 2001 From: Julien Roy Date: Tue, 5 Nov 2024 10:20:18 +0100 Subject: [PATCH] Cacheable database schema metadata --- .../java/org/assertj/db/api/Assertions.java | 12 +- .../org/assertj/db/api/BDDAssertions.java | 12 +- .../java/org/assertj/db/api/TableAssert.java | 4 +- .../impl/AssertionsOnTableExistence.java | 50 +-- ...e.java => AbstractConnectionProvider.java} | 64 ++- .../org/assertj/db/type/AbstractDbData.java | 61 ++- .../assertj/db/type/AbstractDbElement.java | 180 +++----- .../assertj/db/type/CachedSchemaMetaData.java | 57 +++ .../java/org/assertj/db/type/Changes.java | 61 +-- .../assertj/db/type/ConnectionProvider.java | 43 ++ .../db/type/ConnectionProviderFactory.java | 175 ++++++++ .../db/type/DataSourceConnectionProvider.java | 55 +++ .../db/type/DataSourceWithLetterCase.java | 162 -------- .../db/type/FromConnectionSchemaMetadata.java | 119 ++++++ .../db/type/JdbcUrlConnectionProvider.java | 59 +++ .../java/org/assertj/db/type/Request.java | 39 +- .../assertj/db/type/SchemaMetaDataMode.java | 48 +++ .../org/assertj/db/type/SchemaMetadata.java | 25 ++ src/main/java/org/assertj/db/type/Source.java | 80 ---- src/main/java/org/assertj/db/type/Table.java | 383 ++++++----------- .../org/assertj/db/util/Descriptions.java | 8 +- ...Equality_HasValues_One_Character_Test.java | 11 +- .../db/api/DefaultDescription_Test.java | 385 +++++++++--------- .../org/assertj/db/api/Descriptable_Test.java | 3 +- .../assertj/db/api/SoftAssertions_Test.java | 12 +- .../AssertOnChangeType_IsCreation_Test.java | 7 +- .../AssertOnChangeType_IsDeletion_Test.java | 7 +- ...ssertOnChangeType_IsModification_Test.java | 73 ++-- .../AssertOnChangeType_IsOfType_Test.java | 7 +- .../AssertOnColumnClass_IsOfClass_Test.java | 17 +- ...mnContent_ContainsValues_Boolean_Test.java | 9 +- ...lumnContent_ContainsValues_Bytes_Test.java | 9 +- ...Content_ContainsValues_Character_Test.java | 9 +- ...ent_ContainsValues_DateTimeValue_Test.java | 9 +- ...Content_ContainsValues_DateValue_Test.java | 9 +- ...umnContent_ContainsValues_Number_Test.java | 9 +- ...umnContent_ContainsValues_String_Test.java | 11 +- ...olumnContent_HasValues_TimeValue_Test.java | 9 +- ...rtOnColumnContent_HasValues_UUID_Test.java | 8 +- ...ColumnEquality_HasValues_Boolean_Test.java | 9 +- ...OnColumnEquality_HasValues_Bytes_Test.java | 9 +- ...lumnEquality_HasValues_Character_Test.java | 9 +- ...Equality_HasValues_DateTimeValue_Test.java | 9 +- ...lumnEquality_HasValues_DateValue_Test.java | 9 +- ...nColumnEquality_HasValues_Number_Test.java | 9 +- ...nColumnEquality_HasValues_String_Test.java | 11 +- ...lumnEquality_HasValues_TimeValue_Test.java | 9 +- ...tOnColumnEquality_HasValues_UUID_Test.java | 8 +- ...AssertOnColumnName_HasColumnName_Test.java | 13 +- ...lumnNullity_HasOnlyNotNullValues_Test.java | 5 +- ...nColumnNullity_HasOnlyNullValues_Test.java | 5 +- ...geEquality_HasValues_One_Boolean_Test.java | 11 +- ...angeEquality_HasValues_One_Bytes_Test.java | 11 +- ...lity_HasValues_One_DateTimeValue_Test.java | 11 +- ...Equality_HasValues_One_DateValue_Test.java | 11 +- ...ngeEquality_HasValues_One_Number_Test.java | 11 +- ...ngeEquality_HasValues_One_String_Test.java | 15 +- ...Equality_HasValues_One_TimeValue_Test.java | 11 +- ...hangeEquality_HasValues_One_UUID_Test.java | 10 +- ...geEquality_HasValues_Two_Boolean_Test.java | 17 +- ...angeEquality_HasValues_Two_Bytes_Test.java | 11 +- ...Equality_HasValues_Two_Character_Test.java | 11 +- ...lity_HasValues_Two_DateTimeValue_Test.java | 11 +- ...Equality_HasValues_Two_DateValue_Test.java | 11 +- ...ngeEquality_HasValues_Two_Number_Test.java | 11 +- ...ngeEquality_HasValues_Two_String_Test.java | 15 +- ...Equality_HasValues_Two_TimeValue_Test.java | 11 +- ...hangeEquality_HasValues_Two_UUID_Test.java | 10 +- .../AssertOnColumnType_IsBoolean_Test.java | 17 +- .../AssertOnColumnType_IsBytes_Test.java | 17 +- .../AssertOnColumnType_IsDateTime_Test.java | 17 +- .../AssertOnColumnType_IsDate_Test.java | 17 +- .../AssertOnColumnType_IsNumber_Test.java | 17 +- ...AssertOnColumnType_IsOfAnyTypeIn_Test.java | 17 +- .../AssertOnColumnType_IsOfType_Test.java | 17 +- .../AssertOnColumnType_IsText_Test.java | 17 +- .../AssertOnColumnType_IsTime_Test.java | 17 +- .../AssertOnColumnType_IsUUID_Test.java | 16 +- .../AssertOnDataType_IsOnDataType_Test.java | 7 +- .../AssertOnDataType_IsOnRequest_Test.java | 7 +- .../AssertOnDataType_IsOnTable_Name_Test.java | 17 +- .../AssertOnDataType_IsOnTable_Test.java | 7 +- .../AssertOnExistence_DoesNotExist_Test.java | 4 +- .../AssertOnExistence_Exists_Test.java | 4 +- ...ssertOnModifiedColumn_IsModified_Test.java | 7 +- ...rtOnModifiedColumn_IsNotModified_Test.java | 7 +- ...lumns_HasModifiedColumns_Integer_Test.java | 7 +- ...olumns_HasModifiedColumns_String_Test.java | 7 +- ...ifiedColumnsGreaterThanOrEqualTo_Test.java | 7 +- ...mberOfModifiedColumnsGreaterThan_Test.java | 7 +- ...ModifiedColumnsLessThanOrEqualTo_Test.java | 7 +- ...sNumberOfModifiedColumnsLessThan_Test.java | 7 +- ...lumns_HasNumberOfModifiedColumns_Test.java | 7 +- ...berOfChangesGreaterThanOrEqualTo_Test.java | 7 +- ...es_HasNumberOfChangesGreaterThan_Test.java | 7 +- ...NumberOfChangesLessThanOrEqualTo_Test.java | 7 +- ...anges_HasNumberOfChangesLessThan_Test.java | 7 +- ...mberOfChanges_HasNumberOfChanges_Test.java | 7 +- ...berOfColumnsGreaterThanOrEqualTo_Test.java | 9 +- ...ns_HasNumberOfColumnsGreaterThan_Test.java | 9 +- ...NumberOfColumnsLessThanOrEqualTo_Test.java | 9 +- ...lumns_HasNumberOfColumnsLessThan_Test.java | 9 +- ...mberOfColumns_HasNumberOfColumns_Test.java | 9 +- ...NumberOfRowsGreaterThanOrEqualTo_Test.java | 5 +- ...fRows_HasNumberOfRowsGreaterThan_Test.java | 5 +- ...HasNumberOfRowsLessThanOrEqualTo_Test.java | 5 +- ...erOfRows_HasNumberOfRowsLessThan_Test.java | 5 +- ...rtOnNumberOfRows_HasNumberOfRows_Test.java | 5 +- .../AssertOnNumberOfRows_IsEmpty_Test.java | 4 +- .../AssertOnPrimaryKey_HasPksNames_Test.java | 11 +- .../AssertOnPrimaryKey_HasPksValues_Test.java | 17 +- ...RowCondition_HasValuesSatisfying_Test.java | 6 +- .../AssertOnRowEquality_HasValues_Test.java | 7 +- ...nRowNullity_HasOnlyNotNullValues_Test.java | 4 +- ...owOfChangeExistence_DoesNotExist_Test.java | 7 +- ...ertOnRowOfChangeExistence_Exists_Test.java | 7 +- ...y_IsAfterOrEqualTo_DateTimeValue_Test.java | 7 +- ...ology_IsAfterOrEqualTo_DateValue_Test.java | 7 +- ...y_IsAfterOrEqualTo_LocalDateTime_Test.java | 6 +- ...ology_IsAfterOrEqualTo_LocalDate_Test.java | 6 +- ...ology_IsAfterOrEqualTo_LocalTime_Test.java | 6 +- ...ronology_IsAfterOrEqualTo_String_Test.java | 7 +- ...ology_IsAfterOrEqualTo_TimeValue_Test.java | 7 +- ...Chronology_IsAfter_DateTimeValue_Test.java | 7 +- ...alueChronology_IsAfter_DateValue_Test.java | 7 +- ...Chronology_IsAfter_LocalDateTime_Test.java | 6 +- ...alueChronology_IsAfter_LocalDate_Test.java | 6 +- ...alueChronology_IsAfter_LocalTime_Test.java | 6 +- ...OnValueChronology_IsAfter_String_Test.java | 7 +- ...alueChronology_IsAfter_TimeValue_Test.java | 7 +- ..._IsBeforeOrEqualTo_DateTimeValue_Test.java | 7 +- ...logy_IsBeforeOrEqualTo_DateValue_Test.java | 7 +- ..._IsBeforeOrEqualTo_LocalDateTime_Test.java | 6 +- ...logy_IsBeforeOrEqualTo_LocalDate_Test.java | 6 +- ...logy_IsBeforeOrEqualTo_LocalTime_Test.java | 6 +- ...onology_IsBeforeOrEqualTo_String_Test.java | 7 +- ...logy_IsBeforeOrEqualTo_TimeValue_Test.java | 7 +- ...hronology_IsBefore_DateTimeValue_Test.java | 7 +- ...lueChronology_IsBefore_DateValue_Test.java | 7 +- ...hronology_IsBefore_LocalDateTime_Test.java | 6 +- ...lueChronology_IsBefore_LocalDate_Test.java | 6 +- ...lueChronology_IsBefore_LocalTime_Test.java | 6 +- ...nValueChronology_IsBefore_String_Test.java | 7 +- ...lueChronology_IsBefore_TimeValue_Test.java | 7 +- .../AssertOnValueClass_IsOfClass_Test.java | 7 +- ...seTo_DateTimeValue_DateTimeValue_Test.java | 7 +- ...sCloseTo_DateTimeValue_DateValue_Test.java | 7 +- ...sCloseTo_DateTimeValue_TimeValue_Test.java | 7 +- ...sCloseTo_DateValue_DateTimeValue_Test.java | 7 +- ...ss_IsCloseTo_DateValue_DateValue_Test.java | 7 +- ...ss_IsCloseTo_DateValue_TimeValue_Test.java | 7 +- ...nValueCloseness_IsCloseTo_Number_Test.java | 7 +- ...ss_IsCloseTo_TimeValue_TimeValue_Test.java | 7 +- ...omparison_IsGreaterThanOrEqualTo_Test.java | 7 +- ...tOnValueComparison_IsGreaterThan_Test.java | 7 +- ...ueComparison_IsLessThanOrEqualTo_Test.java | 7 +- ...sertOnValueComparison_IsLessThan_Test.java | 7 +- ...sertOnValueCondition_DoesNotHave_Test.java | 6 +- .../AssertOnValueCondition_Has_Test.java | 6 +- .../AssertOnValueCondition_IsNot_Test.java | 6 +- .../AssertOnValueCondition_Is_Test.java | 6 +- ...AssertOnValueCondition_Satisfies_Test.java | 6 +- ...nValueEquality_IsEqualTo_Boolean_Test.java | 7 +- ...tOnValueEquality_IsEqualTo_Bytes_Test.java | 7 +- ...alueEquality_IsEqualTo_Character_Test.java | 7 +- ...Equality_IsEqualTo_DateTimeValue_Test.java | 7 +- ...alueEquality_IsEqualTo_DateValue_Test.java | 13 +- ...Equality_IsEqualTo_LocalDateTime_Test.java | 6 +- ...alueEquality_IsEqualTo_LocalDate_Test.java | 16 +- ...alueEquality_IsEqualTo_LocalTime_Test.java | 6 +- ...OnValueEquality_IsEqualTo_Number_Test.java | 7 +- ...OnValueEquality_IsEqualTo_Object_Test.java | 7 +- ...OnValueEquality_IsEqualTo_String_Test.java | 7 +- ...alueEquality_IsEqualTo_TimeValue_Test.java | 7 +- ...rtOnValueEquality_IsEqualTo_UUID_Test.java | 6 +- .../AssertOnValueEquality_IsFalse_Test.java | 7 +- .../AssertOnValueEquality_IsTrue_Test.java | 7 +- .../AssertOnValueEquality_IsZero_Test.java | 7 +- ...eInequality_IsNotEqualTo_Boolean_Test.java | 7 +- ...lueInequality_IsNotEqualTo_Bytes_Test.java | 7 +- ...nequality_IsNotEqualTo_Character_Test.java | 7 +- ...ality_IsNotEqualTo_DateTimeValue_Test.java | 7 +- ...nequality_IsNotEqualTo_DateValue_Test.java | 7 +- ...ality_IsNotEqualTo_LocalDateTime_Test.java | 6 +- ...nequality_IsNotEqualTo_LocalDate_Test.java | 6 +- ...nequality_IsNotEqualTo_LocalTime_Test.java | 6 +- ...ueInequality_IsNotEqualTo_Number_Test.java | 7 +- ...ueInequality_IsNotEqualTo_Object_Test.java | 7 +- ...ueInequality_IsNotEqualTo_String_Test.java | 7 +- ...nequality_IsNotEqualTo_TimeValue_Test.java | 7 +- ...alueInequality_IsNotEqualTo_UUID_Test.java | 6 +- ...ssertOnValueInequality_IsNotZero_Test.java | 7 +- .../AssertOnValueNullity_IsNotNull_Test.java | 13 +- .../AssertOnValueNullity_IsNull_Test.java | 7 +- .../AssertOnValueType_IsBoolean_Test.java | 7 +- .../AssertOnValueType_IsBytes_Test.java | 7 +- .../AssertOnValueType_IsDateTime_Test.java | 7 +- .../AssertOnValueType_IsDate_Test.java | 7 +- .../AssertOnValueType_IsNumber_Test.java | 7 +- .../AssertOnValueType_IsOfAnyTypeIn_Test.java | 13 +- .../AssertOnValueType_IsOfType_Test.java | 7 +- .../AssertOnValueType_IsText_Test.java | 7 +- .../AssertOnValueType_IsTime_Test.java | 7 +- .../AssertOnValueType_IsUUID_Test.java | 6 +- .../db/api/assertions/BDDAssertions_Test.java | 7 +- ...Equality_HasValues_One_TimeValue_Test.java | 10 +- ...nsOnColumnOfChangeType_IsBoolean_Test.java | 6 +- ...onsOnColumnOfChangeType_IsNumber_Test.java | 6 +- ...onsOnColumnOfChangeType_IsOfType_Test.java | 10 +- ...onsOnRowOfChangeExistence_Exists_Test.java | 12 +- ...onsOnTableExistence_DoesNotExist_Test.java | 22 +- ...ssertionsOnTableExistence_Exists_Test.java | 12 +- .../org/assertj/db/common/AbstractTest.java | 80 ++-- .../org/assertj/db/common/NeedReload.java | 2 +- .../db/database/h2/AbstractH2Test.java | 31 +- .../database/h2/AbstractReservedH2Test.java | 31 +- ....java => H2DataBase_JdbcUrl_DDD_Test.java} | 78 ++-- .../db/database/h2/H2DataBase_Test.java | 12 +- .../h2/H2Database_DataSource_DDD_Test.java | 76 ++-- .../h2/H2Database_DataSource_NSNSNS_Test.java | 110 +++-- .../h2/H2Database_DataSource_UIUIUI_Test.java | 62 ++- ...va => H2Database_JdbcUrl_NSNSNS_Test.java} | 112 +++-- ...va => H2Database_JdbcUrl_UIUIUI_Test.java} | 64 ++- .../database/h2/ReservedH2DataBase_Test.java | 12 +- ...eservedH2Database_DataSource_DDD_Test.java | 28 +- ...rvedH2Database_DataSource_NSNSNS_Test.java | 28 +- ...rvedH2Database_DataSource_UIUIUI_Test.java | 28 +- ... ReservedH2Database_JdbcUrl_DDD_Test.java} | 29 +- ...servedH2Database_JdbcUrl_NSNSNS_Test.java} | 29 +- ...servedH2Database_JdbcUrl_UIUIUI_Test.java} | 29 +- .../database/hsqldb/AbstractHsqldbTest.java | 17 +- .../database/hsqldb/HsqldbDataBase_Test.java | 12 +- ...> HsqldbDatabase_JdbcUrl_UIUIUI_Test.java} | 33 +- .../database/sqlite/AbstractSqliteTest.java | 31 +- .../database/sqlite/SqliteDataBase_Test.java | 12 +- .../SqliteDatabase_DataSource_DDD_Test.java | 45 +- ...SqliteDatabase_DataSource_NSNSNS_Test.java | 65 +-- ...SqliteDatabase_DataSource_UIUIUI_Test.java | 45 +- ...a => SqliteDatabase_JdbcUrl_DDD_Test.java} | 47 +-- ...> SqliteDatabase_JdbcUrl_NSNSNS_Test.java} | 67 +-- ...> SqliteDatabase_JdbcUrl_UIUIUI_Test.java} | 47 +-- .../navigation/InstantiationError_Test.java | 15 +- .../db/navigation/ReturnToOrigin_Test.java | 53 +-- ..._ChangeOfCreationOnTable_Integer_Test.java | 5 +- ...ToChange_ChangeOfCreationOnTable_Test.java | 5 +- ...oChange_ChangeOfCreation_Integer_Test.java | 5 +- .../ToChange_ChangeOfCreation_Test.java | 5 +- ..._ChangeOfDeletionOnTable_Integer_Test.java | 5 +- ...ToChange_ChangeOfDeletionOnTable_Test.java | 5 +- ...oChange_ChangeOfDeletion_Integer_Test.java | 5 +- .../ToChange_ChangeOfDeletion_Test.java | 5 +- ...ngeOfModificationOnTable_Integer_Test.java | 5 +- ...ange_ChangeOfModificationOnTable_Test.java | 5 +- ...nge_ChangeOfModification_Integer_Test.java | 5 +- .../ToChange_ChangeOfModification_Test.java | 23 +- .../ToChange_ChangeOnTableWithPks_Test.java | 21 +- .../ToChange_ChangeOnTable_Integer_Test.java | 5 +- .../ToChange_ChangeOnTable_Test.java | 5 +- .../ToChange_Change_Integer_Test.java | 5 +- .../db/navigation/ToChange_Change_Test.java | 5 +- .../assertj/db/navigation/ToChange_Test.java | 5 +- .../assertj/db/navigation/ToChanges_Test.java | 5 +- ...lumnAmongTheModifiedOnes_Integer_Test.java | 5 +- ...olumnAmongTheModifiedOnes_String_Test.java | 5 +- ...hange_ColumnAmongTheModifiedOnes_Test.java | 5 +- .../ToColumn_Column_Integer_Test.java | 13 +- .../ToColumn_Column_String_Test.java | 13 +- .../db/navigation/ToColumn_Column_Test.java | 13 +- .../ToRowFromChange_RowAtEndPoint_Test.java | 5 +- .../ToRowFromChange_RowAtStartPoint_Test.java | 5 +- .../db/navigation/ToRow_Row_Integer_Test.java | 9 +- .../assertj/db/navigation/ToRow_Row_Test.java | 9 +- ...oValueFromColumn_ValueAtEndPoint_Test.java | 5 +- ...alueFromColumn_ValueAtStartPoint_Test.java | 5 +- .../ToValueFromRow_Value_String_Test.java | 9 +- .../ToValue_Value_Integer_Test.java | 21 +- .../db/navigation/ToValue_Value_Test.java | 21 +- .../db/output/OutputterChange_Test.java | 19 +- .../db/output/OutputterChanges_Test.java | 5 +- .../db/output/OutputterColumn_Test.java | 13 +- .../db/output/OutputterException_Test.java | 13 +- .../db/output/OutputterRequest_Test.java | 5 +- .../assertj/db/output/OutputterRow_Test.java | 13 +- .../db/output/OutputterTable_Test.java | 5 +- .../db/output/OutputterToConsole_Test.java | 3 +- .../db/output/OutputterToFile_Test.java | 3 +- .../db/output/OutputterToStream_Test.java | 3 +- .../db/output/OutputterValue_Test.java | 27 +- .../output/impl/OutputType_ValueOf_Test.java | 4 +- .../db/output/impl/PlainOutput_Test.java | 18 +- .../AbstractDbElement_Exception_Test.java | 102 ----- .../db/type/CachedSchemaMetaData_Test.java | 50 +++ .../db/type/Change_GetDataType_Test.java | 7 +- .../db/type/Changes_Constructor_Test.java | 147 +++---- .../db/type/Changes_Exception_Test.java | 30 +- .../type/Changes_GetChangesOfTable_Test.java | 7 +- .../type/Changes_GetChangesOfType_Test.java | 7 +- .../db/type/Changes_GetChanges_Test.java | 7 +- .../Changes_Request_GetChangesList_Test.java | 16 +- .../db/type/Changes_SetTables_Test.java | 3 +- .../Changes_Table_GetChangesList_Test.java | 19 +- .../type/DataSourceWithLetterCase_Test.java | 186 --------- .../db/type/Request_Columns_Name_Test.java | 19 +- .../assertj/db/type/Request_Columns_Test.java | 9 +- .../db/type/Request_Exception_Test.java | 31 +- .../Request_GetRowFromPksValues_Test.java | 5 +- .../assertj/db/type/Request_Getters_Test.java | 41 +- .../db/type/Request_Instantiation_Test.java | 56 +-- .../type/Request_PrimaryKeys_Name_Test.java | 29 +- .../assertj/db/type/Request_Rows_Test.java | 13 +- .../db/type/Table_Columns_Name_Test.java | 27 +- .../assertj/db/type/Table_Columns_Test.java | 15 +- .../assertj/db/type/Table_Exception_Test.java | 44 +- .../type/Table_GetRowFromPksValues_Test.java | 5 +- .../assertj/db/type/Table_Getters_Test.java | 130 ++---- .../db/type/Table_Instantiation_Test.java | 60 ++- .../db/type/Table_PrimaryKeys_Name_Test.java | 27 +- .../org/assertj/db/type/Table_Rows_Test.java | 15 +- .../Descriptions_GetDescription_Test.java | 57 +-- 319 files changed, 3249 insertions(+), 3402 deletions(-) rename src/main/java/org/assertj/db/type/{SourceWithLetterCase.java => AbstractConnectionProvider.java} (53%) create mode 100644 src/main/java/org/assertj/db/type/CachedSchemaMetaData.java create mode 100644 src/main/java/org/assertj/db/type/ConnectionProvider.java create mode 100644 src/main/java/org/assertj/db/type/ConnectionProviderFactory.java create mode 100644 src/main/java/org/assertj/db/type/DataSourceConnectionProvider.java delete mode 100644 src/main/java/org/assertj/db/type/DataSourceWithLetterCase.java create mode 100644 src/main/java/org/assertj/db/type/FromConnectionSchemaMetadata.java create mode 100644 src/main/java/org/assertj/db/type/JdbcUrlConnectionProvider.java create mode 100644 src/main/java/org/assertj/db/type/SchemaMetaDataMode.java create mode 100644 src/main/java/org/assertj/db/type/SchemaMetadata.java delete mode 100644 src/main/java/org/assertj/db/type/Source.java rename src/test/java/org/assertj/db/database/h2/{H2DataBase_Source_DDD_Test.java => H2DataBase_JdbcUrl_DDD_Test.java} (98%) rename src/test/java/org/assertj/db/database/h2/{H2Database_Source_NSNSNS_Test.java => H2Database_JdbcUrl_NSNSNS_Test.java} (97%) rename src/test/java/org/assertj/db/database/h2/{H2Database_Source_UIUIUI_Test.java => H2Database_JdbcUrl_UIUIUI_Test.java} (97%) rename src/test/java/org/assertj/db/database/h2/{ReservedH2Database_Source_DDD_Test.java => ReservedH2Database_JdbcUrl_DDD_Test.java} (86%) rename src/test/java/org/assertj/db/database/h2/{ReservedH2Database_Source_NSNSNS_Test.java => ReservedH2Database_JdbcUrl_NSNSNS_Test.java} (86%) rename src/test/java/org/assertj/db/database/h2/{ReservedH2Database_Source_UIUIUI_Test.java => ReservedH2Database_JdbcUrl_UIUIUI_Test.java} (86%) rename src/test/java/org/assertj/db/database/hsqldb/{HsqldbDatabase_Source_UIUIUI_Test.java => HsqldbDatabase_JdbcUrl_UIUIUI_Test.java} (97%) rename src/test/java/org/assertj/db/database/sqlite/{SqliteDatabase_Source_DDD_Test.java => SqliteDatabase_JdbcUrl_DDD_Test.java} (96%) rename src/test/java/org/assertj/db/database/sqlite/{SqliteDatabase_Source_NSNSNS_Test.java => SqliteDatabase_JdbcUrl_NSNSNS_Test.java} (94%) rename src/test/java/org/assertj/db/database/sqlite/{SqliteDatabase_Source_UIUIUI_Test.java => SqliteDatabase_JdbcUrl_UIUIUI_Test.java} (96%) delete mode 100644 src/test/java/org/assertj/db/type/AbstractDbElement_Exception_Test.java create mode 100644 src/test/java/org/assertj/db/type/CachedSchemaMetaData_Test.java delete mode 100644 src/test/java/org/assertj/db/type/DataSourceWithLetterCase_Test.java diff --git a/src/main/java/org/assertj/db/api/Assertions.java b/src/main/java/org/assertj/db/api/Assertions.java index aa1cccd8..994e0f59 100644 --- a/src/main/java/org/assertj/db/api/Assertions.java +++ b/src/main/java/org/assertj/db/api/Assertions.java @@ -22,8 +22,8 @@ import org.assertj.db.exception.AssertJDBException; import org.assertj.db.type.Changes; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Request; -import org.assertj.db.type.Source; import org.assertj.db.type.Table; /** @@ -33,14 +33,14 @@ * The assertion methods are defined in assertions package. *

*

- * Example with a {@link Source} and a {@link Table} with test on the content on the first row of the {@code movie} + * Example with a {@link ConnectionProvider} and a {@link Table} with test on the content on the first row of the {@code movie} * table that the {@code title} column contains "Alien" like text and the next column contains 1979 like number : *

* *
  * 
- * Source source = new Source("jdbc:h2:mem:test", "sa", "");
- * Table table = new Table(source, "movie");
+ * ConnectionProvider connectionProvider = ConnectionProviderFactory.of("jdbc:h2:mem:test", "sa", "").create();
+ * Table table = new Table(connectionProvider, "movie");
  * assertThat(table)
  *     .row()
  *        .value("title")
@@ -71,8 +71,8 @@
  *
  * 
  * 
- * Source source = new Source("jdbc:h2:mem:test", "sa", "");
- * Table table = new Table(source, "movie");
+ * ConnectionProvider connectionProvider = ConnectionProviderFactory.of("jdbc:h2:mem:test", "sa", "").create();
+ * Table table = new Table(connectionProvider, "movie");
  * assertThat(table)
  *     .row()
  *        .value("title")
diff --git a/src/main/java/org/assertj/db/api/BDDAssertions.java b/src/main/java/org/assertj/db/api/BDDAssertions.java
index 7cb7e902..175f605e 100644
--- a/src/main/java/org/assertj/db/api/BDDAssertions.java
+++ b/src/main/java/org/assertj/db/api/BDDAssertions.java
@@ -19,8 +19,8 @@
 
 import org.assertj.db.exception.AssertJDBException;
 import org.assertj.db.type.Changes;
+import org.assertj.db.type.ConnectionProvider;
 import org.assertj.db.type.Request;
-import org.assertj.db.type.Source;
 import org.assertj.db.type.Table;
 
 /**
@@ -33,14 +33,14 @@
  * The assertion methods are defined in assertions package.
  * 

*

- * Example with a {@link Source} and a {@link Table} with test on the content on the first row of the {@code movie} + * Example with a {@link ConnectionProvider} and a {@link Table} with test on the content on the first row of the {@code movie} * table that the {@code title} column contains "Alien" as text and the next column contains 1979 as a number : *

* *
  * 
- * Source source = new Source("jdbc:h2:mem:test", "sa", "");
- * Table table = new Table(source, "movie");
+ * ConnectionProvider connectionProvider = ConnectionProviderFactory.of("jdbc:h2:mem:test", "sa", "").create();
+ * Table table = new Table(connectionProvider, "movie");
  * then(table)
  *     .row()
  *        .value("title")
@@ -71,8 +71,8 @@
  *
  * 
  * 
- * Source source = new Source("jdbc:h2:mem:test", "sa", "");
- * Table table = new Table(source, "movie");
+ * ConnectionProvider connectionProvider = ConnectionProviderFactory.of("jdbc:h2:mem:test", "sa", "").create();
+ * Table table = new Table(connectionProvider, "movie");
  * then(table)
  *     .row()
  *        .value("title")
diff --git a/src/main/java/org/assertj/db/api/TableAssert.java b/src/main/java/org/assertj/db/api/TableAssert.java
index b9f6bb8e..89251021 100644
--- a/src/main/java/org/assertj/db/api/TableAssert.java
+++ b/src/main/java/org/assertj/db/api/TableAssert.java
@@ -48,7 +48,7 @@ public TableAssert(Table table) {
    */
   @Override
   public TableAssert exists() {
-    return AssertionsOnTableExistence.exists(this, info, actual.getName(), actual.getSource(), actual.getDataSource());
+    return AssertionsOnTableExistence.exists(this, info, actual.getName(), actual.getConnectionProvider());
   }
 
   /**
@@ -65,6 +65,6 @@ public TableAssert exists() {
    */
   @Override
   public TableAssert doesNotExist() {
-    return AssertionsOnTableExistence.doesNotExists(this, info, actual.getName(), actual.getSource(), actual.getDataSource());
+    return AssertionsOnTableExistence.doesNotExists(this, info, actual.getName(), actual.getConnectionProvider());
   }
 }
diff --git a/src/main/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence.java b/src/main/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence.java
index 770cf4c6..78d41951 100644
--- a/src/main/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence.java
+++ b/src/main/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence.java
@@ -17,16 +17,14 @@
 
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
-import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import javax.sql.DataSource;
 
 import org.assertj.core.api.WritableAssertionInfo;
 import org.assertj.core.internal.Failures;
 import org.assertj.db.api.AbstractDbAssert;
 import org.assertj.db.exception.AssertJDBException;
-import org.assertj.db.type.Source;
+import org.assertj.db.type.ConnectionProvider;
 
 /**
  * Implements the assertion method on the existence of a table.
@@ -47,18 +45,20 @@ private AssertionsOnTableExistence() {
   /**
    * Verifies that the table exists.
    *
-   * @param         The type of the assertion which call this method.
-   * @param assertion  The assertion which call this method.
-   * @param info       Writable information about an assertion.
-   * @param table      The table name to search in DB.
-   * @param source     The source to connect to DB.
-   * @param dataSource The source to connect to DB.
+   * @param                 The type of the assertion which call this method.
+   * @param assertion          The assertion which call this method.
+   * @param info               Writable information about an assertion.
+   * @param table              The table name to search in DB.
+   * @param connectionProvider The provider to connect to DB.
    * @return {@code this} assertion object.
    * @throws AssertionError If the table does not exist.
    */
   public static > A exists(A assertion, WritableAssertionInfo info,
-                                                                        String table, Source source, DataSource dataSource) {
-    try (Connection connection = getConnection(source, dataSource)) {
+                                                                        String table, ConnectionProvider connectionProvider) {
+    if (connectionProvider == null) {
+      throw new NullPointerException("connectionProvider must be not null");
+    }
+    try (Connection connection = connectionProvider.getConnection()) {
       DatabaseMetaData metaData = connection.getMetaData();
       ResultSet result = metaData.getTables(null, null, table, null);
       if (!result.next()) {
@@ -75,18 +75,20 @@ private AssertionsOnTableExistence() {
   /**
    * Verifies that the database not contains the table.
    *
-   * @param         The type of the assertion which call this method.
-   * @param assertion  The assertion which call this method.
-   * @param info       Writable information about an assertion.
-   * @param table      The table name to search in DB.
-   * @param source     The source to connect to DB.
-   * @param dataSource The source to connect to DB.
+   * @param                 The type of the assertion which call this method.
+   * @param assertion          The assertion which call this method.
+   * @param info               Writable information about an assertion.
+   * @param table              The table name to search in DB.
+   * @param connectionProvider The provider to connect to DB.
    * @return {@code this} assertion object.
    * @throws AssertionError If the table does not exist.
    */
   public static > A doesNotExists(A assertion, WritableAssertionInfo info,
-                                                                               String table, Source source, DataSource dataSource) {
-    try (Connection connection = getConnection(source, dataSource)) {
+                                                                               String table, ConnectionProvider connectionProvider) {
+    if (connectionProvider == null) {
+      throw new NullPointerException("connectionProvider must be not null");
+    }
+    try (Connection connection = connectionProvider.getConnection()) {
       DatabaseMetaData metaData = connection.getMetaData();
       ResultSet result = metaData.getTables(null, null, table, null);
       if (result.next()) {
@@ -98,14 +100,4 @@ private AssertionsOnTableExistence() {
     }
     return assertion;
   }
-
-  private static Connection getConnection(Source source, DataSource dataSource) throws SQLException {
-    if (source == null && dataSource == null) {
-      throw new NullPointerException("connection or dataSource must be not null");
-    }
-    if (dataSource != null) {
-      return dataSource.getConnection();
-    }
-    return DriverManager.getConnection(source.getUrl(), source.getUser(), source.getPassword());
-  }
 }
diff --git a/src/main/java/org/assertj/db/type/SourceWithLetterCase.java b/src/main/java/org/assertj/db/type/AbstractConnectionProvider.java
similarity index 53%
rename from src/main/java/org/assertj/db/type/SourceWithLetterCase.java
rename to src/main/java/org/assertj/db/type/AbstractConnectionProvider.java
index 573a089a..caf322a9 100644
--- a/src/main/java/org/assertj/db/type/SourceWithLetterCase.java
+++ b/src/main/java/org/assertj/db/type/AbstractConnectionProvider.java
@@ -12,70 +12,56 @@
  */
 package org.assertj.db.type;
 
+import java.lang.reflect.InvocationTargetException;
+
 import org.assertj.db.type.lettercase.LetterCase;
-import org.assertj.db.type.lettercase.WithLetterCase;
 
 /**
- * A source to indicates the information to connect to the database with letter case.
+ * Base implementation for ConnectionProvider that handle letter case and schema metadata management.
  *
- * @author Régis Pouiller
- * @since 1.1.0
+ * @author Julien Roy
+ * @since 3.0.0
  */
-public class SourceWithLetterCase extends Source implements WithLetterCase {
+abstract class AbstractConnectionProvider implements ConnectionProvider {
+
+  private final SchemaMetadata schemaMetadata;
 
-  /**
-   * Letter case of the tables.
-   */
   private final LetterCase tableLetterCase;
-  /**
-   * Letter case of the columns.
-   */
   private final LetterCase columnLetterCase;
-  /**
-   * Letter case of the primary keys.
-   */
   private final LetterCase primaryKeyLetterCase;
 
-  /**
-   * Constructor with the information.
-   *
-   * @param url                  URL to the database.
-   * @param user                 User to connect.
-   * @param password             Password to connect.
-   * @param tableLetterCase      Letter case of the tables.
-   * @param columnLetterCase     Letter case of the columns.
-   * @param primaryKeyLetterCase Letter case of the primary keys.
-   */
-  public SourceWithLetterCase(String url, String user, String password,
-                              LetterCase tableLetterCase, LetterCase columnLetterCase, LetterCase primaryKeyLetterCase) {
-
-    super(url, user, password);
+  protected AbstractConnectionProvider(Class schemaMetadataType, LetterCase tableLetterCase, LetterCase columnLetterCase, LetterCase primaryKeyLetterCase) {
+    this.schemaMetadata = instantiateSchemaMetadata(schemaMetadataType);
     this.tableLetterCase = tableLetterCase;
     this.columnLetterCase = columnLetterCase;
     this.primaryKeyLetterCase = primaryKeyLetterCase;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  private SchemaMetadata instantiateSchemaMetadata(Class schemaMetadataType) {
+    try {
+      return schemaMetadataType.getConstructor(ConnectionProvider.class).newInstance(this);
+    } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+      throw new IllegalArgumentException("Schema metadata instantiation failure", e);
+    }
+  }
+
+  @Override
+  public LetterCase getTableLetterCase() {
+    return tableLetterCase;
+  }
+
   @Override
   public LetterCase getColumnLetterCase() {
     return columnLetterCase;
   }
 
-  /**
-   * {@inheritDoc}
-   */
   @Override
   public LetterCase getPrimaryKeyLetterCase() {
     return primaryKeyLetterCase;
   }
 
-  /**
-   * {@inheritDoc}
-   */
   @Override
-  public LetterCase getTableLetterCase() {
-    return tableLetterCase;
+  public SchemaMetadata getMetaData() {
+    return this.schemaMetadata;
   }
 }
diff --git a/src/main/java/org/assertj/db/type/AbstractDbData.java b/src/main/java/org/assertj/db/type/AbstractDbData.java
index b52a8657..c31c1691 100644
--- a/src/main/java/org/assertj/db/type/AbstractDbData.java
+++ b/src/main/java/org/assertj/db/type/AbstractDbData.java
@@ -12,16 +12,19 @@
  */
 package org.assertj.db.type;
 
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.assertj.db.exception.AssertJDBException;
 import org.assertj.db.type.lettercase.LetterCase;
 import org.assertj.db.util.NameComparator;
 import org.assertj.db.util.RowComparator;
 
-import javax.sql.DataSource;
-import java.sql.*;
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * This class represents data from the database (either a {@link Table} or a {@link Request}).
  * 

@@ -35,6 +38,7 @@ * @param Class of the subclass (an implementation of {@link AbstractDbData}) : useful for the fluent methods * (setters). * @author Régis Pouiller + * @author Julien Roy */ public abstract class AbstractDbData> extends AbstractDbElement { @@ -63,7 +67,7 @@ public abstract class AbstractDbData> extends Abstra * Default constructor. * * @param dataType The type of the data on which is the change. - * @param selfType Class of this element : a sub-class of {@code AbstractDbData}. + * @param selfType Class of this element : a subclass of {@code AbstractDbData}. */ AbstractDbData(Class selfType, DataType dataType) { super(selfType); @@ -71,28 +75,15 @@ public abstract class AbstractDbData> extends Abstra } /** - * Constructor with a {@link Source}. - * - * @param dataType The type of the data on which is the change. - * @param selfType Class of this element : a sub-class of {@code AbstractDbData}. - * @param source The {@link Source} to connect to the database (must be not {@code null}). - * @throws NullPointerException If {@code source} is {@code null}. - */ - AbstractDbData(Class selfType, DataType dataType, Source source) { - super(selfType, source); - this.dataType = dataType; - } - - /** - * Constructor with a {@link DataSource}. + * Constructor with a {@link JdbcUrlConnectionProvider}. * - * @param dataType The type of the data on which is the change. - * @param selfType Class of this element : a sub-class of {@code AbstractDbData}. - * @param dataSource The {@link DataSource} (must be not {@code null}). - * @throws NullPointerException If {@code dataSource} is {@code null}. + * @param dataType The type of the data on which is the change. + * @param selfType Class of this element : a subclass of {@code AbstractDbData}. + * @param connectionProvider The {@link JdbcUrlConnectionProvider} to connect to the database (must be not {@code null}). + * @throws NullPointerException If {@code connectionProvider} is {@code null}. */ - AbstractDbData(Class selfType, DataType dataType, DataSource dataSource) { - super(selfType, dataSource); + AbstractDbData(Class selfType, DataType dataType, ConnectionProvider connectionProvider) { + super(selfType, connectionProvider); this.dataType = dataType; } @@ -121,12 +112,12 @@ public DataType getDataType() { * depending of being a {@link Table} or a {@link Request}. *

* - * @throws NullPointerException If the {@link #dataSource} and {@link #source} fields are {@code null}. + * @throws NullPointerException If the {@code connectionProvider} fields are {@code null}. * @throws AssertJDBException If triggered, this exception wrap a possible {@link SQLException} during the loading. */ private void load() { try (Connection connection = getConnection()) { - // Call the specific loading depending of Table or Request. + // Call the specific loading depending on Table or Request. loadImpl(connection); if (pksNameList == null) { pksNameList = new ArrayList<>(); @@ -219,7 +210,7 @@ protected void collectRowsFromResultSet(ResultSet resultSet) throws SQLException *

* * @return The list of the columns name. - * @throws NullPointerException If the {@link #dataSource} and {@link #source} fields are {@code null}. + * @throws NullPointerException If the {@code connectionProvider} fields are {@code null}. * @throws AssertJDBException If triggered, this exception wrap a possible {@link SQLException} during the loading. */ public List getColumnsNameList() { @@ -246,7 +237,7 @@ protected void setColumnsNameList(List columnsNameList) { *

* * @return The list of the primary key name. - * @throws NullPointerException If the {@link #dataSource} and {@link #source} fields are {@code null}. + * @throws NullPointerException If the {@link #getConnectionProvider()} fields are {@code null}. * @throws AssertJDBException If triggered, this exception wrap a possible {@link SQLException} during the loading. */ public List getPksNameList() { @@ -296,7 +287,7 @@ protected void controlIfAllThePksNameExistInTheColumns() { *

* * @return The list of the values. - * @throws NullPointerException If the {@link #dataSource} and {@link #source} fields are {@code null}. + * @throws NullPointerException If the {@code connectionProvider} fields are {@code null}. * @throws AssertJDBException If triggered, this exception wrap a possible {@link SQLException} during the loading. */ public List getRowsList() { @@ -316,7 +307,7 @@ public List getRowsList() { *

* * @return The list of the values in columns. - * @throws NullPointerException If the {@link #dataSource} and {@link #source} fields are {@code null}. + * @throws NullPointerException If the {@code connectionProvider} fields are {@code null}. * @throws AssertJDBException If triggered, this exception wrap a possible {@link SQLException} during the loading. */ public List getColumnsList() { @@ -345,7 +336,7 @@ public List getColumnsList() { * * @param index The column index. * @return The column and the values - * @throws NullPointerException If the {@link #dataSource} and {@link #source} fields are {@code null}. + * @throws NullPointerException If the {@code connectionProvider} fields are {@code null}. * @throws AssertJDBException If triggered, this exception wrap a possible {@link SQLException} during the loading. */ public Column getColumn(int index) { @@ -362,7 +353,7 @@ public Column getColumn(int index) { * * @param index The index * @return The {@link Row} - * @throws NullPointerException If the {@link #dataSource} and {@link #source} fields are {@code null}. + * @throws NullPointerException If the {@code connectionProvider} fields are {@code null}. * @throws AssertJDBException If triggered, this exception wrap a possible {@link SQLException} during the loading. */ public Row getRow(int index) { @@ -379,7 +370,7 @@ public Row getRow(int index) { * * @param index The column index * @return The values - * @throws NullPointerException If the {@link #dataSource} and {@link #source} fields are {@code null}. + * @throws NullPointerException If the {@code connectionProvider} fields are {@code null}. * @throws AssertJDBException If triggered, this exception wrap a possible {@link SQLException} during the loading. */ private List getValuesList(int index) { diff --git a/src/main/java/org/assertj/db/type/AbstractDbElement.java b/src/main/java/org/assertj/db/type/AbstractDbElement.java index dc4e46ad..d66d0c95 100644 --- a/src/main/java/org/assertj/db/type/AbstractDbElement.java +++ b/src/main/java/org/assertj/db/type/AbstractDbElement.java @@ -12,22 +12,20 @@ */ package org.assertj.db.type; -import org.assertj.db.type.lettercase.LetterCase; -import org.assertj.db.type.lettercase.WithLetterCase; - -import javax.sql.DataSource; import java.sql.Connection; -import java.sql.DriverManager; import java.sql.SQLException; +import org.assertj.db.type.lettercase.LetterCase; +import org.assertj.db.type.lettercase.WithLetterCase; + /** * This class represents element from the database (either a {@link AbstractDbData} or a {@link Change}). - * So this class contains : the way to access the database with {@link #getSource()} and {@link #getDataSource()} (one - * of them need to be set before loading the data).
+ * So this class contains : the way to access the database with {@link #getConnectionProvider()}.
* * @param Class of the subclass (an implementation of {@link AbstractDbElement}) : useful for the fluent methods * (setters). * @author Régis Pouiller + * @author Julien Roy */ public abstract class AbstractDbElement> implements DbElement, WithLetterCase { @@ -36,31 +34,27 @@ public abstract class AbstractDbElement> implemen */ protected final D myself; /** - * Source of the data. + * Database connection provider. */ - private Source source; - /** - * Data source. - */ - private DataSource dataSource; + private ConnectionProvider connectionProvider; /** * Letter case of the tables. * * @since 1.1.0 */ - private LetterCase tableLetterCase; + private LetterCase tableLetterCase = LetterCase.TABLE_DEFAULT; /** * Letter case of the columns. * * @since 1.1.0 */ - private LetterCase columnLetterCase; + private LetterCase columnLetterCase = LetterCase.COLUMN_DEFAULT; /** * Letter case of the primary keys. * * @since 1.1.0 */ - private LetterCase primaryKeyLetterCase; + private LetterCase primaryKeyLetterCase = LetterCase.PRIMARY_KEY_DEFAULT; /** * Default constructor. @@ -75,63 +69,16 @@ public abstract class AbstractDbElement> implemen /** * Constructor. * - * @param selfType Class of this element : a sub-class of {@code AbstractDbElement}. - * @param source The {@link Source} to connect to the database (must be not {@code null}). - * @throws NullPointerException If {@code source} is {@code null}. + * @param selfType Class of this element : a subclass of {@code AbstractDbElement}. + * @param connectionProvider The {@link ConnectionProvider} to connect to the database (must be not {@code null}). + * @throws NullPointerException If {@code connectionProvider} is {@code null}. */ - AbstractDbElement(Class selfType, Source source) { + AbstractDbElement(Class selfType, ConnectionProvider connectionProvider) { this(selfType); - this.source = source; + this.connectionProvider = connectionProvider; setLetterCases(); } - /** - * Constructor. - * - * @param selfType Class of this element : a sub-class of {@code AbstractDbElement}. - * @param dataSource The {@link DataSource} (must be not {@code null}). - * @throws NullPointerException If {@code dataSource} is {@code null}. - */ - AbstractDbElement(Class selfType, DataSource dataSource) { - this(selfType); - this.dataSource = dataSource; - setLetterCases(); - } - - /** - * Returns the catalog from a connection. - * - * @param connection The connection with the catalog - * @return The catalog from a connection. - * @throws SQLException SQL Exception - */ - protected static String getCatalog(Connection connection) throws SQLException { - try { - return connection.getCatalog(); - } catch (SQLException exception) { - throw exception; - } catch (Exception throwable) { - return null; - } - } - - /** - * Returns the schema from a connection. - * - * @param connection The connection with the catalog - * @return The schema from a connection. - * @throws SQLException SQL Exception - */ - protected static String getSchema(Connection connection) throws SQLException { - try { - return connection.getSchema(); - } catch (SQLException exception) { - throw exception; - } catch (Exception throwable) { - return null; - } - } - /** * Sets the letter cases from information in parameters. * @@ -148,24 +95,15 @@ D setLetterCases(LetterCase tableLetterCase, LetterCase columnLetterCase, Letter } /** - * Sets the letter cases from information in {@code dataSource} and {@code source}. + * Sets the letter cases from information in {@code connectionProvider}. */ private void setLetterCases() { - if (dataSource instanceof WithLetterCase) { - WithLetterCase withLetterCase = (WithLetterCase) dataSource; - tableLetterCase = withLetterCase.getTableLetterCase(); - columnLetterCase = withLetterCase.getColumnLetterCase(); - primaryKeyLetterCase = withLetterCase.getPrimaryKeyLetterCase(); - } else if (source instanceof WithLetterCase) { - WithLetterCase withLetterCase = (WithLetterCase) source; - tableLetterCase = withLetterCase.getTableLetterCase(); - columnLetterCase = withLetterCase.getColumnLetterCase(); - primaryKeyLetterCase = withLetterCase.getPrimaryKeyLetterCase(); - } else { - tableLetterCase = LetterCase.TABLE_DEFAULT; - columnLetterCase = LetterCase.COLUMN_DEFAULT; - primaryKeyLetterCase = LetterCase.PRIMARY_KEY_DEFAULT; + if (connectionProvider == null) { + return; } + tableLetterCase = connectionProvider.getTableLetterCase(); + columnLetterCase = connectionProvider.getColumnLetterCase(); + primaryKeyLetterCase = connectionProvider.getPrimaryKeyLetterCase(); } /** @@ -193,77 +131,55 @@ public LetterCase getTableLetterCase() { } /** - * Return the source. + * Return the connectionProvider. * - * @return The {@link Source} to connect. - * @see #setSource(Source) + * @return The {@link ConnectionProvider} to connect. + * @see #setConnectionProvider(ConnectionProvider) */ - public Source getSource() { - return source; + public ConnectionProvider getConnectionProvider() { + return connectionProvider; } /** - * Sets the source. + * Sets the connectionProvider. * - * @param source {@link Source} to connect to the database (must be not {@code null}). + * @param connectionProvider {@link ConnectionProvider} to connect to the database (must be not {@code null}). * @return The actual instance. - * @throws NullPointerException If {@code source} is {@code null}. - * @see #getSource() + * @throws NullPointerException If {@code connectionProvider} is {@code null}. */ - public D setSource(Source source) { - if (source == null) { - throw new NullPointerException("source must be not null"); + public D setConnectionProvider(ConnectionProvider connectionProvider) { + if (connectionProvider == null) { + throw new NullPointerException("connectionProvider must be not null"); } - this.source = source; - this.dataSource = null; + this.connectionProvider = connectionProvider; setLetterCases(); return myself; } /** - * Return the data source. - * - * @return The data source. - * @see #setDataSource(DataSource) - */ - public DataSource getDataSource() { - return dataSource; - } - - /** - * Sets the data source. + * Returns a {@link Connection} from the {@link ConnectionProvider} * - * @param dataSource The {@link DataSource} (must be not {@code null}). - * @return The actual instance. - * @throws NullPointerException If {@code dataSource} is {@code null}. - * @see #getDataSource() + * @return A {@link Connection} from connectionProvider + * @throws SQLException SQL Exception + * @throws NullPointerException this connection provider is null */ - public D setDataSource(DataSource dataSource) { - if (dataSource == null) { - throw new NullPointerException("dataSource must be not null"); + protected Connection getConnection() throws SQLException { + if (connectionProvider == null) { + throw new NullPointerException("connectionProvider must be not null"); } - this.source = null; - this.dataSource = dataSource; - setLetterCases(); - return myself; + return connectionProvider.getConnection(); } /** - * Returns a {@link Connection} from a {@link DataSource} or from a {@link Source}. + * Returns a {@link SchemaMetadata} from the {@link ConnectionProvider} * - * @return A {@link Connection} differently, depending if it is a {@link DataSource} or a {@link Source}. - * @throws SQLException SQL Exception + * @return A {@link SchemaMetadata} from connectionProvider + * @throws NullPointerException this connection provider is null */ - protected Connection getConnection() throws SQLException { - if (dataSource == null && source == null) { - throw new NullPointerException("connection or dataSource must be not null"); - } - - // Get a Connection differently, depending if it is a DataSource or a Source. - if (dataSource != null) { - return dataSource.getConnection(); - } else { - return DriverManager.getConnection(source.getUrl(), source.getUser(), source.getPassword()); + protected SchemaMetadata getMetaData() { + if (connectionProvider == null) { + throw new NullPointerException("connectionProvider must be not null"); } + return connectionProvider.getMetaData(); } } diff --git a/src/main/java/org/assertj/db/type/CachedSchemaMetaData.java b/src/main/java/org/assertj/db/type/CachedSchemaMetaData.java new file mode 100644 index 00000000..6b594733 --- /dev/null +++ b/src/main/java/org/assertj/db/type/CachedSchemaMetaData.java @@ -0,0 +1,57 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2024 the original author or authors. + */ +package org.assertj.db.type; + +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Implementation of SchemaMetadata that cache the metadata of the first request without any expiration. + * + * @author Julien Roy + * @since 3.0.0 + */ +class CachedSchemaMetaData implements SchemaMetadata { + + private final FromConnectionSchemaMetadata metadata; + private final Map> cache = new ConcurrentHashMap<>(); + + public CachedSchemaMetaData(ConnectionProvider connectionProvider) { + this.metadata = new FromConnectionSchemaMetadata(connectionProvider); + } + + /** + * {@inheritDoc} + */ + @Override + public Collection getTablesName() { + return cache.computeIfAbsent("TABLES", key -> this.metadata.getTablesName()); + } + + /** + * {@inheritDoc} + */ + @Override + public Collection getColumnsName(String tableName) { + return cache.computeIfAbsent("COLUMNS#" + tableName, key -> this.metadata.getColumnsName(tableName)); + } + + /** + * {@inheritDoc} + */ + @Override + public Collection getPrimaryKeys(String tableName) { + return cache.computeIfAbsent("PKS#" + tableName, key -> this.metadata.getPrimaryKeys(tableName)); + } +} diff --git a/src/main/java/org/assertj/db/type/Changes.java b/src/main/java/org/assertj/db/type/Changes.java index 3af50b2c..3eec5960 100644 --- a/src/main/java/org/assertj/db/type/Changes.java +++ b/src/main/java/org/assertj/db/type/Changes.java @@ -16,15 +16,10 @@ import static org.assertj.db.type.Change.createDeletionChange; import static org.assertj.db.type.Change.createModificationChange; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import javax.sql.DataSource; import org.assertj.db.exception.AssertJDBException; import org.assertj.db.util.ChangeComparator; @@ -33,6 +28,7 @@ * Changes in the database. * * @author Régis Pouiller + * @author Julien Roy */ public class Changes extends AbstractDbElement { @@ -65,31 +61,15 @@ public class Changes extends AbstractDbElement { */ private List changesList; - /** - * Constructor. - */ - public Changes() { - super(Changes.class); - } - - /** - * Constructor. - * - * @param source The {@link Source} to connect to the database (must be not {@code null}). - * @throws NullPointerException If {@code source} is {@code null}. - */ - public Changes(Source source) { - super(Changes.class, source); - } - /** * Constructor. * - * @param dataSource The {@link DataSource} (must be not {@code null}). - * @throws NullPointerException If {@code dataSource} is {@code null}. + * @param connectionProvider The {@link ConnectionProvider} to connect to the database (must be not {@code null}). + * @throws NullPointerException If {@code connectionProvider} is {@code null}. + * @since 3.0.0 */ - public Changes(DataSource dataSource) { - super(Changes.class, dataSource); + public Changes(ConnectionProvider connectionProvider) { + super(Changes.class, connectionProvider); } /** @@ -119,11 +99,8 @@ public Changes(Request request) { * @param element The {@link AbstractDbElement} on which is the copy */ private static void copyElement(AbstractDbElement elementToCopy, AbstractDbElement element) { - if (elementToCopy.getSource() != null) { - element.setSource(elementToCopy.getSource()); - } - if (elementToCopy.getDataSource() != null) { - element.setDataSource(elementToCopy.getDataSource()); + if (elementToCopy.getConnectionProvider() != null) { + element.setConnectionProvider(elementToCopy.getConnectionProvider()); } } @@ -277,20 +254,12 @@ public Request getRequestAtEndPoint() { */ public Changes setStartPointNow() { if (request == null && tablesList == null) { - try (Connection connection = getConnection()) { - tablesList = new LinkedList<>(); - DatabaseMetaData metaData = connection.getMetaData(); - ResultSet resultSet = metaData.getTables(getCatalog(connection), getSchema(connection), null, - new String[]{"TABLE"}); - while (resultSet.next()) { - String tableName = resultSet.getString("TABLE_NAME"); - Table t = new Table().setLetterCases(getTableLetterCase(), getColumnLetterCase(), getPrimaryKeyLetterCase()) - .setName(getTableLetterCase().convert(tableName)); - copyElement(this, t); - tablesList.add(t); - } - } catch (SQLException e) { - throw new AssertJDBException(e); + tablesList = new LinkedList<>(); + for (String tableName : getMetaData().getTablesName()) { + Table t = new Table().setLetterCases(getTableLetterCase(), getColumnLetterCase(), getPrimaryKeyLetterCase()) + .setName(getTableLetterCase().convert(tableName)); + copyElement(this, t); + tablesList.add(t); } } @@ -538,7 +507,7 @@ public Changes getChangesOfType(ChangeType changeType) { * @return The new instance. */ private Changes createChangesFromThis() { - Changes changes = new Changes(); + Changes changes = new Changes(this.getConnectionProvider()); if (request != null) { changes.request = getDuplicatedRequest(request); } diff --git a/src/main/java/org/assertj/db/type/ConnectionProvider.java b/src/main/java/org/assertj/db/type/ConnectionProvider.java new file mode 100644 index 00000000..de61548a --- /dev/null +++ b/src/main/java/org/assertj/db/type/ConnectionProvider.java @@ -0,0 +1,43 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2024 the original author or authors. + */ +package org.assertj.db.type; + +import java.sql.Connection; +import java.sql.SQLException; + +import org.assertj.db.type.lettercase.WithLetterCase; + +/** + * Represent access to a database with capacity to return schema metadata and settings for letter case management. + * + * @author Julien Roy + * @since 3.0.0 + */ +public interface ConnectionProvider extends WithLetterCase { + + /** + * Return SQL connection to database. + * + * @return An active {@link Connection} to database. + * @throws SQLException When access to database fail. + */ + Connection getConnection() throws SQLException; + + /** + * Return a accessor to retrieve database schema metadata. + * + * @return An {@link SchemaMetadata} to access to database schema metadata. + */ + SchemaMetadata getMetaData(); + +} diff --git a/src/main/java/org/assertj/db/type/ConnectionProviderFactory.java b/src/main/java/org/assertj/db/type/ConnectionProviderFactory.java new file mode 100644 index 00000000..81abd7fa --- /dev/null +++ b/src/main/java/org/assertj/db/type/ConnectionProviderFactory.java @@ -0,0 +1,175 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2024 the original author or authors. + */ +package org.assertj.db.type; + +import javax.sql.DataSource; + +import org.assertj.db.type.lettercase.LetterCase; + +/** + * Fluent factory to create a connectionProvider from different input ( Jdbc URL or DataSource ). + * Allow to configure behavior of connection provider like letter case or schema metadata retrieval mode. + *

+ * For create with JDBC URL : + *

+ * 
+ * ConnectionProvider connectionProvider = ConnectionProviderFactory.of("jdbc:h2:mem:test", "sa", "").create();
+ * Table table = new Table(connectionProvider, "movie");
+ * 
+ * 
+ *

+ * For create with JDBC URL : + *

+ * 
+ * DataSource dataSource = ...;
+ * ConnectionProvider connectionProvider = ConnectionProviderFactory.of(dataSource).create();
+ * Table table = new Table(connectionProvider, "song", new String[] { "number", "title" }, null);
+ * 
+ * 
+ * + * @author Julien Roy + * @since 3.0.0 + */ +public abstract class ConnectionProviderFactory { + + private ConnectionProviderFactory() { + throw new UnsupportedOperationException(); + } + + /** + * Initiate factory with Java.sql.DataSource + * + * @param dataSource Datasource to retrieve data from database. + * @return Factory of ConnectionProvider + */ + public static DataSourceConnectionProviderFactory of(DataSource dataSource) { + return new DataSourceConnectionProviderFactory(dataSource); + } + + /** + * Initiate factory with JDBC connection information + * + * @param url JDBC url of database. + * @param user Connection username. + * @param password Connection password. + * @return Factory of ConnectionProvider + */ + public static JdbcUrlConnectionProviderFactory of(String url, String user, String password) { + return new JdbcUrlConnectionProviderFactory(url, user, password); + } + + /** + * DataSource variant of ConnectionProviderFactory + */ + public static class DataSourceConnectionProviderFactory extends AbstractConnectionProviderFactory { + private final DataSource dataSource; + + private DataSourceConnectionProviderFactory(DataSource dataSource) { + super(); + this.dataSource = dataSource; + } + + /** + * {@inheritDoc} + */ + @Override + public ConnectionProvider create() { + return new DataSourceConnectionProvider(dataSource, this.schemaMetaDataMode.getType(), this.tableLetterCase, this.columnLetterCase, this.primaryKeyLetterCase); + } + } + + /** + * Jdbc url variant of ConnectionProviderFactory + */ + public static class JdbcUrlConnectionProviderFactory extends AbstractConnectionProviderFactory { + private final String url; + private final String user; + private final String password; + + private JdbcUrlConnectionProviderFactory(String url, String user, String password) { + super(); + + this.url = url; + this.user = user; + this.password = password; + } + + /** + * {@inheritDoc} + */ + @Override + public ConnectionProvider create() { + return new JdbcUrlConnectionProvider(url, user, password, this.schemaMetaDataMode.getType(), this.tableLetterCase, this.columnLetterCase, this.primaryKeyLetterCase); + } + } + + @SuppressWarnings("unchecked") + private abstract static class AbstractConnectionProviderFactory { + + /** + * Schema metadata retrieval mode. + */ + protected SchemaMetaDataMode schemaMetaDataMode = SchemaMetaDataMode.DYNAMIC; + /** + * Tables letter case. + */ + protected LetterCase tableLetterCase = LetterCase.TABLE_DEFAULT; + /** + * Columns letter case. + */ + protected LetterCase columnLetterCase = LetterCase.COLUMN_DEFAULT; + /** + * PKs letter case. + */ + protected LetterCase primaryKeyLetterCase = LetterCase.PRIMARY_KEY_DEFAULT; + + private AbstractConnectionProviderFactory() { + } + + /** + * Modify the default letter case mode for connection provider. + * + * @param tableLetterCase Tables letter case. + * @param columnLetterCase Columns letter case. + * @param primaryKeyLetterCase PKs letter case. + * @return the current instance of factory. + */ + public T letterCase(LetterCase tableLetterCase, LetterCase columnLetterCase, LetterCase primaryKeyLetterCase) { + this.tableLetterCase = tableLetterCase; + this.columnLetterCase = columnLetterCase; + this.primaryKeyLetterCase = primaryKeyLetterCase; + return (T) this; + } + + /** + * Modify the current mode for schema metadata retrieval. + * + * @param mode The selected mode + * @return the current instance of factory. + */ + public T schemaMetaDataMode(SchemaMetaDataMode mode) { + if (mode == null) { + throw new IllegalArgumentException("SchemaMetaDataMode cannot be null"); + } + this.schemaMetaDataMode = mode; + return (T) this; + } + + /** + * Build the Connection Provider + * + * @return Connection provider to use for Table, Request or Changes + */ + public abstract ConnectionProvider create(); + } +} diff --git a/src/main/java/org/assertj/db/type/DataSourceConnectionProvider.java b/src/main/java/org/assertj/db/type/DataSourceConnectionProvider.java new file mode 100644 index 00000000..4f59e125 --- /dev/null +++ b/src/main/java/org/assertj/db/type/DataSourceConnectionProvider.java @@ -0,0 +1,55 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2024 the original author or authors. + */ +package org.assertj.db.type; + +import java.sql.Connection; +import java.sql.SQLException; +import javax.sql.DataSource; + +import org.assertj.db.type.lettercase.LetterCase; + +/** + * The implementation of {@link ConnectionProvider} based on java.sql.DataSource. + * Use {@link ConnectionProviderFactory} for instantiate. + * + * @author Julien Roy + * @since 3.0.0 + */ +public class DataSourceConnectionProvider extends AbstractConnectionProvider { + + private final DataSource dataSource; + + DataSourceConnectionProvider(DataSource dataSource, + Class schemaMetadataType, + LetterCase tableLetterCase, LetterCase columnLetterCase, LetterCase primaryKeyLetterCase) { + + super(schemaMetadataType, tableLetterCase, columnLetterCase, primaryKeyLetterCase); + this.dataSource = dataSource; + } + + /** + * {@inheritDoc} + */ + @Override + public Connection getConnection() throws SQLException { + return dataSource.getConnection(); + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return "data source"; + } +} diff --git a/src/main/java/org/assertj/db/type/DataSourceWithLetterCase.java b/src/main/java/org/assertj/db/type/DataSourceWithLetterCase.java deleted file mode 100644 index d39f43fb..00000000 --- a/src/main/java/org/assertj/db/type/DataSourceWithLetterCase.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * Copyright 2015-2024 the original author or authors. - */ -package org.assertj.db.type; - -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.logging.Logger; -import javax.sql.DataSource; - -import org.assertj.db.type.lettercase.LetterCase; -import org.assertj.db.type.lettercase.WithLetterCase; - -/** - * A data source to connect to the database with letter case. - * - * @author Régis Pouiller - * @since 1.1.0 - */ -public class DataSourceWithLetterCase implements DataSource, WithLetterCase { - - /** - * The data source. - */ - private final DataSource dataSource; - /** - * Letter case of the tables. - */ - private final LetterCase tableLetterCase; - /** - * Letter case of the columns. - */ - private final LetterCase columnLetterCase; - /** - * Letter case of the primary keys. - */ - private final LetterCase primaryKeyLetterCase; - - /** - * Constructor. - * - * @param dataSource The data source. - * @param tableLetterCase Letter case of the tables. - * @param columnLetterCase Letter case of the columns. - * @param primaryKeyLetterCase Letter case of the primary keys. - */ - public DataSourceWithLetterCase(DataSource dataSource, LetterCase tableLetterCase, - LetterCase columnLetterCase, LetterCase primaryKeyLetterCase) { - - this.dataSource = dataSource; - this.tableLetterCase = tableLetterCase; - this.columnLetterCase = columnLetterCase; - this.primaryKeyLetterCase = primaryKeyLetterCase; - } - - /** - * {@inheritDoc} - */ - @Override - public LetterCase getColumnLetterCase() { - return columnLetterCase; - } - - /** - * {@inheritDoc} - */ - @Override - public LetterCase getPrimaryKeyLetterCase() { - return primaryKeyLetterCase; - } - - /** - * {@inheritDoc} - */ - @Override - public LetterCase getTableLetterCase() { - return tableLetterCase; - } - - /** - * {@inheritDoc} - */ - @Override - public Connection getConnection() throws SQLException { - return dataSource.getConnection(); - } - - /** - * {@inheritDoc} - */ - @Override - public Connection getConnection(String username, String password) throws SQLException { - return dataSource.getConnection(username, password); - } - - /** - * {@inheritDoc} - */ - @Override - public PrintWriter getLogWriter() throws SQLException { - return dataSource.getLogWriter(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setLogWriter(PrintWriter out) throws SQLException { - dataSource.setLogWriter(out); - } - - /** - * {@inheritDoc} - */ - @Override - public int getLoginTimeout() throws SQLException { - return dataSource.getLoginTimeout(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setLoginTimeout(int seconds) throws SQLException { - dataSource.setLoginTimeout(seconds); - } - - /** - * {@inheritDoc} - */ - @Override - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - return dataSource.getParentLogger(); - } - - /** - * {@inheritDoc} - */ - @Override - public T unwrap(Class iface) throws SQLException { - return dataSource.unwrap(iface); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - return dataSource.isWrapperFor(iface); - } -} diff --git a/src/main/java/org/assertj/db/type/FromConnectionSchemaMetadata.java b/src/main/java/org/assertj/db/type/FromConnectionSchemaMetadata.java new file mode 100644 index 00000000..1dd81208 --- /dev/null +++ b/src/main/java/org/assertj/db/type/FromConnectionSchemaMetadata.java @@ -0,0 +1,119 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2024 the original author or authors. + */ +package org.assertj.db.type; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.assertj.db.exception.AssertJDBException; + +/** + * @author Julien Roy + * @since 3.0.0 + */ +class FromConnectionSchemaMetadata implements SchemaMetadata { + + private final ConnectionProvider connectionProvider; + + public FromConnectionSchemaMetadata(ConnectionProvider connectionProvider) { + this.connectionProvider = connectionProvider; + } + + /** + * Returns the catalog from a connection. + * + * @param connection The connection with the catalog + * @return The catalog from a connection. + * @throws SQLException SQL Exception + */ + private static String getCatalog(Connection connection) throws SQLException { + try { + return connection.getCatalog(); + } catch (SQLException exception) { + throw exception; + } catch (Exception throwable) { + return null; + } + } + + /** + * Returns the schema from a connection. + * + * @param connection The connection with the catalog + * @return The schema from a connection. + * @throws SQLException SQL Exception + */ + private static String getSchema(Connection connection) throws SQLException { + try { + return connection.getSchema(); + } catch (SQLException exception) { + throw exception; + } catch (Exception throwable) { + return null; + } + } + + @Override + public Collection getTablesName() { + try (Connection connection = connectionProvider.getConnection()) { + List tables = new ArrayList<>(); + DatabaseMetaData metaData = connection.getMetaData(); + try (ResultSet tableResultSet = metaData.getTables(getCatalog(connection), getSchema(connection), null, new String[]{"TABLE"})) { + while (tableResultSet.next()) { + String tableName = tableResultSet.getString("TABLE_NAME"); + tables.add(tableName); + } + } + return tables; + } catch (SQLException e) { + throw new AssertJDBException(e); + } + } + + @Override + public Collection getColumnsName(String tableName) { + try (Connection connection = connectionProvider.getConnection()) { + List columnsList = new ArrayList<>(); + try (ResultSet columnsResultSet = connection.getMetaData().getColumns(getCatalog(connection), getSchema(connection), tableName, null)) { + while (columnsResultSet.next()) { + String column = columnsResultSet.getString("COLUMN_NAME"); + columnsList.add(column); + } + } + return columnsList; + } catch (SQLException e) { + throw new AssertJDBException(e); + } + } + + @Override + public Collection getPrimaryKeys(String tableName) { + try (Connection connection = connectionProvider.getConnection()) { + List pksNameList = new ArrayList<>(); + try (ResultSet resultSet = connection.getMetaData().getPrimaryKeys(getCatalog(connection), getSchema(connection), tableName)) { + while (resultSet.next()) { + String pkName = resultSet.getString("COLUMN_NAME"); + pksNameList.add(pkName); + } + } + return pksNameList; + } catch (SQLException e) { + throw new AssertJDBException(e); + } + } +} diff --git a/src/main/java/org/assertj/db/type/JdbcUrlConnectionProvider.java b/src/main/java/org/assertj/db/type/JdbcUrlConnectionProvider.java new file mode 100644 index 00000000..a7795006 --- /dev/null +++ b/src/main/java/org/assertj/db/type/JdbcUrlConnectionProvider.java @@ -0,0 +1,59 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2024 the original author or authors. + */ +package org.assertj.db.type; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +import org.assertj.db.type.lettercase.LetterCase; + +/** + * The implementation of {@link ConnectionProvider} from JDBC url connection info. + * Use {@link ConnectionProviderFactory} for instantiate. + * + * @author Julien Roy + * @since 3.0.0 + */ +public class JdbcUrlConnectionProvider extends AbstractConnectionProvider { + + private final String url; + private final String user; + private final String password; + + JdbcUrlConnectionProvider(String url, String user, String password, + Class schemaMetadataType, + LetterCase tableLetterCase, LetterCase columnLetterCase, LetterCase primaryKeyLetterCase) { + + super(schemaMetadataType, tableLetterCase, columnLetterCase, primaryKeyLetterCase); + this.url = url; + this.user = user; + this.password = password; + } + + /** + * {@inheritDoc} + */ + @Override + public Connection getConnection() throws SQLException { + return DriverManager.getConnection(this.url, this.user, this.password); + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.user + "/" + this.url; + } +} diff --git a/src/main/java/org/assertj/db/type/Request.java b/src/main/java/org/assertj/db/type/Request.java index e4793557..41b4cd34 100644 --- a/src/main/java/org/assertj/db/type/Request.java +++ b/src/main/java/org/assertj/db/type/Request.java @@ -20,14 +20,13 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.sql.DataSource; import org.assertj.db.type.lettercase.LetterCase; /** * A request in the database to get values. *

- * The different information of the request are connection or data source, the SQL request and optionally the parameters + * The different information of the request are connectionProvider, the SQL request and optionally the parameters * of the SQL request. *

*

@@ -37,30 +36,32 @@ *

  • *

    * This {@link Request} point to a request without parameter in a H2 database in memory like indicated in the - * {@link Source}. + * {@link ConnectionProvider}. *

    * *
    
    - * Source source = new Source("jdbc:h2:mem:test", "sa", "");
    - * Request request = new Request(source, "select title from movie;");
    + * ConnectionProvider connectionProvider = ConnectionProviderFactory.of("jdbc:h2:mem:test", "sa", "").create();
    + * Request request = new Request(connectionProvider, "select title from movie;");
      * 
    * *
  • *
  • *

    * Below the {@link Request} point to a request with {@code 2000} in parameter.
    - * The {@link Request} use a {@code DataSource} instead of a {@link Source} like above. + * The {@link Request} use a {@code DataSource} in the factory of {@link ConnectionProvider} like above. *

    * *
    
      * DataSource dataSource = ...;
    - * Request request = new Request(dataSource, "select title from movie where year > ?;", 2000);
    + * ConnectionProvider connectionProvider = ConnectionProviderFactory.of(dataSource).create();
    + * Request request = new Request(connectionProvider, "select title from movie where year > ?;", 2000);
      * 
    * *
  • * * * @author Régis Pouiller + * @author Julien Roy */ public class Request extends AbstractDbData { @@ -83,25 +84,13 @@ public Request() { /** * Constructor with a connection. * - * @param source Source to connect to the database. - * @param request SQL Request to get the values. - * @param parameters Parameters of the SQL request. + * @param connectionProvider Connection provider to connect to the database. + * @param request SQL Request to get the values. + * @param parameters Parameters of the SQL request. + * @since 3.0.0 */ - public Request(Source source, String request, Object... parameters) { - super(Request.class, DataType.REQUEST, source); - setRequest(request); - this.parameters = parameters; - } - - /** - * Constructor with a data source. - * - * @param dataSource Data source. - * @param request SQL Request to get the values. - * @param parameters Parameters of the SQL request. - */ - public Request(DataSource dataSource, String request, Object... parameters) { - super(Request.class, DataType.REQUEST, dataSource); + public Request(ConnectionProvider connectionProvider, String request, Object... parameters) { + super(Request.class, DataType.REQUEST, connectionProvider); setRequest(request); this.parameters = parameters; } diff --git a/src/main/java/org/assertj/db/type/SchemaMetaDataMode.java b/src/main/java/org/assertj/db/type/SchemaMetaDataMode.java new file mode 100644 index 00000000..2f43930a --- /dev/null +++ b/src/main/java/org/assertj/db/type/SchemaMetaDataMode.java @@ -0,0 +1,48 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2024 the original author or authors. + */ +package org.assertj.db.type; + +/** + * Define existing schema metadata retrieval mode. + * + * @author Julien Roy + * @since 3.0.0 + */ +public enum SchemaMetaDataMode { + /** + * Retrieve schema metadata only once and keep in memory for all duration of connection provider. + * To use when database schema is not modified during tests. + */ + STATIC(CachedSchemaMetaData.class), + /** + * Retrieve schema metadata each time is required. + * To use when database schema is modified during tests. + */ + DYNAMIC(FromConnectionSchemaMetadata.class); + + + private final Class type; + + SchemaMetaDataMode(Class type) { + this.type = type; + } + + /** + * Return the underline java type that implement the strategy. + * + * @return Class to use for instantiate the schema retriever. + */ + Class getType() { + return type; + } +} diff --git a/src/main/java/org/assertj/db/type/SchemaMetadata.java b/src/main/java/org/assertj/db/type/SchemaMetadata.java new file mode 100644 index 00000000..ee02e8c0 --- /dev/null +++ b/src/main/java/org/assertj/db/type/SchemaMetadata.java @@ -0,0 +1,25 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2024 the original author or authors. + */ +package org.assertj.db.type; + +import java.util.Collection; + +interface SchemaMetadata { + + Collection getTablesName(); + + Collection getColumnsName(String tableName); + + Collection getPrimaryKeys(String tableName); + +} diff --git a/src/main/java/org/assertj/db/type/Source.java b/src/main/java/org/assertj/db/type/Source.java deleted file mode 100644 index afee685e..00000000 --- a/src/main/java/org/assertj/db/type/Source.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * Copyright 2015-2024 the original author or authors. - */ -package org.assertj.db.type; - -/** - * A source to indicates the information to connect to the database. It contains the url, user and password to the - * database. A source is used by a {@link Table} or a {@link Request}. - *

    Example of instantiation :

    - *
    
    - * Source source = new Source("jdbc:h2:mem:test", "sa", "");
    - * 
    - *

    That creates a source to a H2 database in memory.

    - * - * @author Régis Pouiller - */ -public class Source { - - /** - * URL to the database. - */ - private final String url; - /** - * User to connect. - */ - private final String user; - /** - * Password to connect. - */ - private final String password; - - /** - * Constructor with the information. - * - * @param url URL to the database. - * @param user User to connect. - * @param password Password to connect. - */ - public Source(String url, String user, String password) { - this.url = url; - this.user = user; - this.password = password; - } - - /** - * Returns the URL to the database. - * - * @return The URL to the database. - */ - public String getUrl() { - return url; - } - - /** - * Returns the user to connect. - * - * @return The user to connect. - */ - public String getUser() { - return user; - } - - /** - * Returns the password to connect. - * - * @return The password to connect. - */ - public String getPassword() { - return password; - } -} diff --git a/src/main/java/org/assertj/db/type/Table.java b/src/main/java/org/assertj/db/type/Table.java index 8228ea68..a9186235 100644 --- a/src/main/java/org/assertj/db/type/Table.java +++ b/src/main/java/org/assertj/db/type/Table.java @@ -30,7 +30,7 @@ /** * A table in the database to read to get the values. *

    - * The different information of the table are {@link Source} or {@link DataSource}, name of the table and optionally + * The different information of the table are {@link ConnectionProvider} or {@link DataSource}, name of the table and optionally * the columns to check and to exclude. *

    *

    @@ -40,13 +40,13 @@ *

  • *

    * This {@link Table} point to a table called {@code movie} in a H2 database in memory like indicated in the - * {@link Source}. + * {@link ConnectionProvider}. *

    * *
      * 
    - * Source source = new Source("jdbc:h2:mem:test", "sa", "");
    - * Table table = new Table(source, "movie");
    + * ConnectionProvider connectionProvider = ConnectionProviderFactory.of("jdbc:h2:mem:test", "sa", "").create();
    + * Table table = new Table(connectionProvider, "movie");
      * 
      * 
    * @@ -57,14 +57,15 @@ * {@code number} and {@code title}).
    * And the {@link Table} {@code table2} point to a table called {@code musician} (but ignore on the column called * {@code birthday}).
    - * The {@link Table} use a {@code DataSource} instead of a {@link Source} like above. + * The {@link Table} use a {@code DataSource} instead of a {@link ConnectionProvider} like above. *

    * *
      * 
      * DataSource dataSource = ...;
    - * Table table1 = new Table(dataSource, "song", new String[] { "number", "title" }, null);
    - * Table table2 = new Table(dataSource, "musician", null, new String[] { "birthday" });
    + * ConnectionProvider connectionProvider = ConnectionProviderFactory.of(dataSource).create();
    + * Table table1 = new Table(connectionProvider, "song", new String[] { "number", "title" }, null);
    + * Table table2 = new Table(connectionProvider, "musician", null, new String[] { "birthday" });
      * 
      * 
    * @@ -72,6 +73,7 @@ * * * @author Régis Pouiller + * @author Julien Roy */ public class Table extends AbstractDbData { @@ -118,241 +120,121 @@ public Table() { } /** - * Constructor with a {@link Source} and the name of the table. + * Constructor with a {@link ConnectionProvider} and the name of the table. * - * @param source {@link Source} to connect to the database. - * @param name Name of the table. + * @param connectionProvider {@link ConnectionProvider} to connect to the database. + * @param name Name of the table. + * @since 3.0.0 */ - public Table(Source source, String name) { - this(source, name, null, (String[]) null); + public Table(ConnectionProvider connectionProvider, String name) { + this(connectionProvider, name, null, (String[]) null); } /** - * Constructor with a {@link Source}, the name of the table and the columns to check and to exclude. + * Constructor with a {@link ConnectionProvider}, the name of the table and the columns to check and to exclude. * - * @param source {@link Source} to connect to the database. - * @param name Name of the table. - * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the - * columns. - * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no - * column. - */ - public Table(Source source, String name, String[] columnsToCheck, String[] columnsToExclude) { - this(source, name, null, columnsToCheck, columnsToExclude); - } - - /** - * Constructor with a dataSource and the name of the table. - * - * @param dataSource DataSource of the database. - * @param name Name of the table. - */ - public Table(DataSource dataSource, String name) { - this(dataSource, name, null, (String[]) null); - } - - /** - * Constructor with a connection, the name of the table and the columns to check and to exclude. - * - * @param dataSource DataSource of the database. - * @param name Name of the table. - * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the - * columns. - * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no - * column. - */ - public Table(DataSource dataSource, String name, String[] columnsToCheck, String[] columnsToExclude) { - this(dataSource, name, null, columnsToCheck, columnsToExclude); - } - - /** - * Constructor with a {@link Source} and the name of the table. - * - * @param source {@link Source} to connect to the database. - * @param name Name of the table. - * @param columnsToOrder List of column to use as ORDER BY - * @since 1.2.0 - */ - public Table(Source source, String name, Order[] columnsToOrder) { - this(source, name, columnsToOrder, null, null); - } - - /** - * Constructor with a {@link Source}, the name of the table and the columns to check and to exclude. - * - * @param source {@link Source} to connect to the database. - * @param name Name of the table. - * @param columnsToOrder List of column to use as ORDER BY - * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the - * columns. - * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no - * column. - * @since 1.2.0 + * @param connectionProvider {@link ConnectionProvider} to connect to the database. + * @param name Name of the table. + * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the + * columns. + * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no + * column. + * @since 3.0.0 */ - public Table(Source source, String name, Order[] columnsToOrder, String[] columnsToCheck, String[] columnsToExclude) { - this(source, name, null, null, columnsToOrder, columnsToCheck, columnsToExclude); + public Table(ConnectionProvider connectionProvider, String name, String[] columnsToCheck, String[] columnsToExclude) { + this(connectionProvider, name, null, columnsToCheck, columnsToExclude); } /** - * Constructor with a dataSource and the name of the table. + * Constructor with a {@link ConnectionProvider} and the name of the table. * - * @param dataSource DataSource of the database. - * @param name Name of the table. - * @param columnsToOrder List of column to use as ORDER BY - * @since 1.2.0 + * @param connectionProvider {@link ConnectionProvider} to connect to the database. + * @param name Name of the table. + * @param columnsToOrder List of column to use as ORDER BY + * @since 3.0.0 */ - public Table(DataSource dataSource, String name, Order[] columnsToOrder) { - this(dataSource, name, columnsToOrder, null, null); + public Table(ConnectionProvider connectionProvider, String name, Order[] columnsToOrder) { + this(connectionProvider, name, columnsToOrder, null, null); } /** - * Constructor with a connection, the name of the table and the columns to check and to exclude. + * Constructor with a {@link ConnectionProvider}, the name of the table and the columns to check and to exclude. * - * @param dataSource DataSource of the database. - * @param name Name of the table. - * @param columnsToOrder List of column to use as ORDER BY - * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the - * columns. - * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no - * column. - * @since 1.2.0 + * @param connectionProvider {@link ConnectionProvider} to connect to the database. + * @param name Name of the table. + * @param columnsToOrder List of column to use as ORDER BY + * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the + * columns. + * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no + * column. + * @since 3.0.0 */ - public Table(DataSource dataSource, String name, Order[] columnsToOrder, String[] columnsToCheck, String[] columnsToExclude) { - this(dataSource, name, null, null, columnsToOrder, columnsToCheck, columnsToExclude); + public Table(ConnectionProvider connectionProvider, String name, Order[] columnsToOrder, String[] columnsToCheck, String[] columnsToExclude) { + this(connectionProvider, name, null, null, columnsToOrder, columnsToCheck, columnsToExclude); } /** - * Constructor with a {@link Source} and the name of the table. + * Constructor with a {@link ConnectionProvider} and the name of the table. * - * @param source {@link Source} to connect to the database. - * @param name Name of the table. - * @param startDelimiter Start delimiter for column name and table name. - * @param endDelimiter End delimiter for column name and table name. - * @since 1.2.0 + * @param connectionProvider {@link ConnectionProvider} to connect to the database. + * @param name Name of the table. + * @param startDelimiter Start delimiter for column name and table name. + * @param endDelimiter End delimiter for column name and table name. + * @since 3.0.0 */ - public Table(Source source, String name, Character startDelimiter, Character endDelimiter) { - this(source, name, startDelimiter, endDelimiter, null, null, null); + public Table(ConnectionProvider connectionProvider, String name, Character startDelimiter, Character endDelimiter) { + this(connectionProvider, name, startDelimiter, endDelimiter, null, null, null); } /** - * Constructor with a {@link Source}, the name of the table and the columns to check and to exclude. + * Constructor with a {@link ConnectionProvider}, the name of the table and the columns to check and to exclude. * - * @param source {@link Source} to connect to the database. - * @param name Name of the table. - * @param startDelimiter Start delimiter for column name and table name. - * @param endDelimiter End delimiter for column name and table name. - * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the - * columns. - * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no - * column. - * @since 1.2.0 + * @param connectionProvider {@link ConnectionProvider} to connect to the database. + * @param name Name of the table. + * @param startDelimiter Start delimiter for column name and table name. + * @param endDelimiter End delimiter for column name and table name. + * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the + * columns. + * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no + * column. + * @since 3.0.0 */ - public Table(Source source, String name, Character startDelimiter, Character endDelimiter, String[] columnsToCheck, + public Table(ConnectionProvider connectionProvider, String name, Character startDelimiter, Character endDelimiter, String[] columnsToCheck, String[] columnsToExclude) { - this(source, name, startDelimiter, endDelimiter, null, columnsToCheck, columnsToExclude); + this(connectionProvider, name, startDelimiter, endDelimiter, null, columnsToCheck, columnsToExclude); } /** - * Constructor with a dataSource and the name of the table. + * Constructor with a {@link ConnectionProvider} and the name of the table. * - * @param dataSource DataSource of the database. - * @param name Name of the table. - * @param startDelimiter Start delimiter for column name and table name. - * @param endDelimiter End delimiter for column name and table name. - * @since 1.2.0 + * @param connectionProvider {@link ConnectionProvider} to connect to the database. + * @param name Name of the table. + * @param startDelimiter Start delimiter for column name and table name. + * @param endDelimiter End delimiter for column name and table name. + * @param columnsToOrder List of column to use as ORDER BY + * @since 3.0.0 */ - public Table(DataSource dataSource, String name, Character startDelimiter, Character endDelimiter) { - this(dataSource, name, startDelimiter, endDelimiter, null, null, null); + public Table(ConnectionProvider connectionProvider, String name, Character startDelimiter, Character endDelimiter, Order[] columnsToOrder) { + this(connectionProvider, name, startDelimiter, endDelimiter, columnsToOrder, null, null); } /** - * Constructor with a connection, the name of the table and the columns to check and to exclude. + * Constructor with a {@link ConnectionProvider}, the name of the table and the columns to check and to exclude. * - * @param dataSource DataSource of the database. - * @param name Name of the table. - * @param startDelimiter Start delimiter for column name and table name. - * @param endDelimiter End delimiter for column name and table name. - * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the - * columns. - * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no - * column. - * @since 1.2.0 + * @param connectionProvider {@link ConnectionProvider} to connect to the database. + * @param name Name of the table. + * @param startDelimiter Start delimiter for column name and table name. + * @param endDelimiter End delimiter for column name and table name. + * @param columnsToOrder List of column to use as ORDER BY + * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the + * columns. + * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no + * column. + * @since 3.0.0 */ - public Table(DataSource dataSource, String name, Character startDelimiter, Character endDelimiter, String[] columnsToCheck, - String[] columnsToExclude) { - this(dataSource, name, startDelimiter, endDelimiter, null, columnsToCheck, columnsToExclude); - } - - /** - * Constructor with a {@link Source} and the name of the table. - * - * @param source {@link Source} to connect to the database. - * @param name Name of the table. - * @param startDelimiter Start delimiter for column name and table name. - * @param endDelimiter End delimiter for column name and table name. - * @param columnsToOrder List of column to use as ORDER BY - * @since 1.2.0 - */ - public Table(Source source, String name, Character startDelimiter, Character endDelimiter, Order[] columnsToOrder) { - this(source, name, startDelimiter, endDelimiter, columnsToOrder, null, null); - } - - /** - * Constructor with a {@link Source}, the name of the table and the columns to check and to exclude. - * - * @param source {@link Source} to connect to the database. - * @param name Name of the table. - * @param startDelimiter Start delimiter for column name and table name. - * @param endDelimiter End delimiter for column name and table name. - * @param columnsToOrder List of column to use as ORDER BY - * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the - * columns. - * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no - * column. - * @since 1.2.0 - */ - public Table(Source source, String name, Character startDelimiter, Character endDelimiter, Order[] columnsToOrder, + public Table(ConnectionProvider connectionProvider, String name, Character startDelimiter, Character endDelimiter, Order[] columnsToOrder, String[] columnsToCheck, String[] columnsToExclude) { - super(Table.class, DataType.TABLE, source); - setName(name); - setStartDelimiter(startDelimiter); - setEndDelimiter(endDelimiter); - setColumnsToOrder(columnsToOrder); - setColumnsToCheck(columnsToCheck); - setColumnsToExclude(columnsToExclude); - } - - /** - * Constructor with a dataSource and the name of the table. - * - * @param dataSource DataSource of the database. - * @param name Name of the table. - * @param startDelimiter Start delimiter for column name and table name. - * @param endDelimiter End delimiter for column name and table name. - * @param columnsToOrder List of column to use as ORDER BY - * @since 1.2.0 - */ - public Table(DataSource dataSource, String name, Character startDelimiter, Character endDelimiter, Order[] columnsToOrder) { - this(dataSource, name, startDelimiter, endDelimiter, columnsToOrder, null, null); - } - - /** - * Constructor with a connection, the name of the table and the columns to check and to exclude. - * - * @param dataSource DataSource of the database. - * @param name Name of the table. - * @param startDelimiter Start delimiter for column name and table name. - * @param endDelimiter End delimiter for column name and table name. - * @param columnsToOrder List of column to use as ORDER BY - * @param columnsToCheck Array of the name of the columns to check. If {@code null} that means to check all the - * columns. - * @param columnsToExclude Array of the name of the columns to exclude. If {@code null} that means to exclude no - * column. - * @since 1.2.0 - */ - public Table(DataSource dataSource, String name, Character startDelimiter, Character endDelimiter, Order[] columnsToOrder, - String[] columnsToCheck, String[] columnsToExclude) { - super(Table.class, DataType.TABLE, dataSource); + super(Table.class, DataType.TABLE, connectionProvider); setName(name); setStartDelimiter(startDelimiter); setEndDelimiter(endDelimiter); @@ -391,18 +273,8 @@ public Table setName(String name) { * {@inheritDoc} */ @Override - public Table setDataSource(DataSource dataSource) { - Table table = super.setDataSource(dataSource); - setNameFromDb(); - return table; - } - - /** - * {@inheritDoc} - */ - @Override - public Table setSource(Source source) { - Table table = super.setSource(source); + public Table setConnectionProvider(ConnectionProvider connectionProvider) { + Table table = super.setConnectionProvider(connectionProvider); setNameFromDb(); return table; } @@ -411,32 +283,21 @@ public Table setSource(Source source) { * Set the name from the corresponding name in the database. */ private void setNameFromDb() { - if (name != null && (getSource() != null || getDataSource() != null)) { - try (Connection connection = getConnection()) { - LetterCase tableLetterCase = getTableLetterCase(); - LetterCase columnLetterCase = getColumnLetterCase(); - - DatabaseMetaData metaData = connection.getMetaData(); - try (ResultSet tableResultSet = metaData.getTables(getCatalog(connection), getSchema(connection), null, - new String[]{"TABLE"})) { - while (tableResultSet.next()) { - String tableName = tableResultSet.getString("TABLE_NAME"); - if (tableLetterCase.isEqual(tableName, name)) { - name = tableLetterCase.convert(tableName); - break; - } - } + if (name != null && this.getConnectionProvider() != null) { + + LetterCase tableLetterCase = getTableLetterCase(); + LetterCase columnLetterCase = getColumnLetterCase(); + SchemaMetadata metaData = getMetaData(); + for (String tableName : metaData.getTablesName()) { + if (tableLetterCase.isEqual(tableName, name)) { + name = tableLetterCase.convert(tableName); + break; } + } - columnsList = new ArrayList<>(); - try (ResultSet columnsResultSet = metaData.getColumns(getCatalog(connection), getSchema(connection), name, null)) { - while (columnsResultSet.next()) { - String column = columnsResultSet.getString("COLUMN_NAME"); - columnsList.add(columnLetterCase.convert(column)); - } - } - } catch (SQLException e) { - throw new AssertJDBException(e); + columnsList = new ArrayList<>(); + for (String column : metaData.getColumnsName(name)) { + columnsList.add(columnLetterCase.convert(column)); } } } @@ -465,7 +326,7 @@ public String[] getColumnsToCheck() { */ public Table setColumnsToCheck(String[] columnsToCheck) { if (columnsList == null) { - throw new AssertJDBException("The table name and the source or datasource must be set first"); + throw new AssertJDBException("The table name and the connectionProvider must be set first"); } if (columnsToCheck != null) { LetterCase letterCase = getColumnLetterCase(); @@ -510,7 +371,7 @@ public String[] getColumnsToExclude() { */ public Table setColumnsToExclude(String[] columnsToExclude) { if (columnsList == null) { - throw new AssertJDBException("The table name and the source or datasource must be set first"); + throw new AssertJDBException("The table name and the connectionProvider must be set first"); } if (columnsToExclude != null) { LetterCase letterCase = getColumnLetterCase(); @@ -554,7 +415,7 @@ public Order[] getColumnsToOrder() { */ public Table setColumnsToOrder(Order[] columnsToOrder) { if (columnsList == null) { - throw new AssertJDBException("The table name and the source or datasource must be set first"); + throw new AssertJDBException("The table name and the connectionProvider must be set first"); } if (columnsToOrder != null) { LetterCase letterCase = getColumnLetterCase(); @@ -725,38 +586,28 @@ private void collectColumnsNameFromResultSet(ResultSet resultSet) throws SQLExce * This method use the {@link DatabaseMetaData} from the {@code Connection} parameter to list the primary keys of the * table. *

    - * - * @param connection The {@code Connection} to the database. - * @throws SQLException SQL Exception. */ - private void collectPrimaryKeyName(Connection connection) throws SQLException { - String catalog = getCatalog(connection); - String schema = getSchema(connection); + private void collectPrimaryKeyName() { List pksNameList = new ArrayList<>(); - DatabaseMetaData metaData = connection.getMetaData(); + SchemaMetadata metaData = getMetaData(); String tableName = name; - try (ResultSet resultSet = metaData.getTables(catalog, schema, null, new String[]{"TABLE"})) { - LetterCase letterCase = getTableLetterCase(); - while (resultSet.next()) { - String tableResult = resultSet.getString("TABLE_NAME"); - if (letterCase.isEqual(tableName, tableResult)) { - tableName = tableResult; - break; - } + LetterCase letterCase = getTableLetterCase(); + for (String tableResult : metaData.getTablesName()) { + if (letterCase.isEqual(tableName, tableResult)) { + tableName = tableResult; + break; } } - try (ResultSet resultSet = metaData.getPrimaryKeys(catalog, schema, tableName)) { - LetterCase letterCase = getPrimaryKeyLetterCase(); - while (resultSet.next()) { - String columnName = resultSet.getString("COLUMN_NAME"); - if (NameComparator.INSTANCE.contains(getColumnsNameList(), columnName, letterCase)) { - String pkName = letterCase.convert(columnName); - pksNameList.add(pkName); - } + LetterCase pkLetterCase = getPrimaryKeyLetterCase(); + for (String primaryKey : metaData.getPrimaryKeys(tableName)) { + if (NameComparator.INSTANCE.contains(getColumnsNameList(), primaryKey, pkLetterCase)) { + String pkName = pkLetterCase.convert(primaryKey); + pksNameList.add(pkName); } } + setPksNameList(pksNameList); } @@ -780,7 +631,7 @@ protected void loadImpl(Connection connection) throws SQLException { collectRowsFromResultSet(resultSet); } } - collectPrimaryKeyName(connection); + collectPrimaryKeyName(); if (columnsToOrder == null) { sortRows(); } diff --git a/src/main/java/org/assertj/db/util/Descriptions.java b/src/main/java/org/assertj/db/util/Descriptions.java index 07a0ae04..e69f9d0e 100644 --- a/src/main/java/org/assertj/db/util/Descriptions.java +++ b/src/main/java/org/assertj/db/util/Descriptions.java @@ -20,7 +20,6 @@ import org.assertj.db.type.ChangeType; import org.assertj.db.type.Changes; import org.assertj.db.type.Request; -import org.assertj.db.type.Source; import org.assertj.db.type.Table; import org.assertj.db.type.Value; @@ -91,12 +90,7 @@ public static String getDescription(Changes changes) { stringBuilder.append("Changes"); } } - if (changes.getSource() != null) { - Source source = changes.getSource(); - stringBuilder.append(" of '").append(source.getUser()).append("/").append(source.getUrl()).append("' source"); - } else { - stringBuilder.append(" of a data source"); - } + stringBuilder.append(" of '").append(changes.getConnectionProvider().toString()).append("'"); return stringBuilder.toString(); } diff --git a/src/test/java/org/assertj/db/api/AssertOnColumnOfChangeEquality_HasValues_One_Character_Test.java b/src/test/java/org/assertj/db/api/AssertOnColumnOfChangeEquality_HasValues_One_Character_Test.java index 1fb23ebd..e38f5048 100644 --- a/src/test/java/org/assertj/db/api/AssertOnColumnOfChangeEquality_HasValues_One_Character_Test.java +++ b/src/test/java/org/assertj/db/api/AssertOnColumnOfChangeEquality_HasValues_One_Character_Test.java @@ -26,6 +26,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(Character)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_One_Character_Test extends AbstractTest { @@ -35,7 +36,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_One_Character_Test extends @Test @NeedReload public void test_have_values_equal_to() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_have_values_equal_to() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var16) values(5, 'X')"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var16").hasValues('X'); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 15 (column name : VAR16) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 15 (column name : VAR16) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -73,7 +74,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -81,7 +82,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var16").hasValues('T'); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 15 (column name : VAR16) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 15 (column name : VAR16) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/DefaultDescription_Test.java b/src/test/java/org/assertj/db/api/DefaultDescription_Test.java index 7aab2386..d7ba0120 100644 --- a/src/test/java/org/assertj/db/api/DefaultDescription_Test.java +++ b/src/test/java/org/assertj/db/api/DefaultDescription_Test.java @@ -12,6 +12,11 @@ */ package org.assertj.db.api; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.db.api.Assertions.assertThat; + +import java.lang.reflect.Field; + import org.assertj.core.api.WritableAssertionInfo; import org.assertj.db.common.AbstractTest; import org.assertj.db.common.NeedReload; @@ -21,15 +26,11 @@ import org.assertj.db.type.Table; import org.junit.Test; -import java.lang.reflect.Field; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.db.api.Assertions.assertThat; - /** * Test on default descriptions. * * @author Régis Pouiller + * @author Julien Roy */ public class DefaultDescription_Test extends AbstractTest { @@ -43,9 +44,9 @@ public void test_default_description_for_change_with_different_information() thr field.setAccessible(true); - Table actorTable = new Table(dataSource, "actor"); - Request request = new Request(dataSource, "select * from actor"); - Changes changes = new Changes(dataSource).setStartPointNow(); + Table actorTable = new Table(dsConnectionProvider, "actor"); + Request request = new Request(dsConnectionProvider, "select * from actor"); + Changes changes = new Changes(dsConnectionProvider).setStartPointNow(); Changes changesOnActorTable = new Changes(actorTable).setStartPointNow(); Changes changesOnRequest = new Changes(request).setStartPointNow(); updateChangesForTests(); @@ -59,10 +60,10 @@ public void test_default_description_for_change_with_different_information() thr WritableAssertionInfo infoOnActorTable = (WritableAssertionInfo) field.get(assertThat(changesOnActorTable).change()); WritableAssertionInfo infoOnTestTable = (WritableAssertionInfo) field.get(assertThat(changes).change(8)); WritableAssertionInfo infoOnRequest = (WritableAssertionInfo) field.get(assertThat(changesOnRequest).change()); - assertThat(info.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of a data source"); - assertThat(infoOnActorTable.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of a data source"); - assertThat(infoOnTestTable.descriptionText()).isEqualTo("Change at index 8 (on table : TEST2) of Changes on tables of a data source"); - assertThat(infoOnRequest.descriptionText()).isEqualTo("Change at index 0 of Changes on 'select * from actor' request of a data source"); + assertThat(info.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'data source'"); + assertThat(infoOnActorTable.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'data source'"); + assertThat(infoOnTestTable.descriptionText()).isEqualTo("Change at index 8 (on table : TEST2) of Changes on tables of 'data source'"); + assertThat(infoOnRequest.descriptionText()).isEqualTo("Change at index 0 of Changes on 'select * from actor' request of 'data source'"); } /** @@ -75,8 +76,8 @@ public void test_default_description_of_changes() throws Exception { field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -87,10 +88,10 @@ public void test_default_description_of_changes() throws Exception { WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of 'data source'"); } /** @@ -103,8 +104,8 @@ public void test_default_description_of_all_changes() throws Exception { field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -115,10 +116,10 @@ public void test_default_description_of_all_changes() throws Exception { WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of 'data source'"); } /** @@ -131,8 +132,8 @@ public void test_default_description_of_creation_changes() throws Exception { field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -143,10 +144,10 @@ public void test_default_description_of_creation_changes() throws Exception { WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' source (only creation changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' (only creation changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of a data source (only creation changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of 'data source' (only creation changes)"); } /** @@ -159,8 +160,8 @@ public void test_default_description_of_modification_changes() throws Exception field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -171,10 +172,10 @@ public void test_default_description_of_modification_changes() throws Exception WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' source (only modification changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' (only modification changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of a data source (only modification changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of 'data source' (only modification changes)"); } /** @@ -187,8 +188,8 @@ public void test_default_description_of_deletion_changes() throws Exception { field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -199,10 +200,10 @@ public void test_default_description_of_deletion_changes() throws Exception { WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' source (only deletion changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' (only deletion changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of a data source (only deletion changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of 'data source' (only deletion changes)"); } /** @@ -215,8 +216,8 @@ public void test_default_description_of_creation_on_table_changes() throws Excep field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -227,10 +228,10 @@ public void test_default_description_of_creation_on_table_changes() throws Excep WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' source (only creation changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' (only creation changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of a data source (only creation changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of 'data source' (only creation changes on actor table)"); } /** @@ -243,8 +244,8 @@ public void test_default_description_of_modification_on_table_changes() throws E field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -255,10 +256,10 @@ public void test_default_description_of_modification_on_table_changes() throws E WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' source (only modification changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' (only modification changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of a data source (only modification changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of 'data source' (only modification changes on actor table)"); } /** @@ -271,8 +272,8 @@ public void test_default_description_of_deletion_on_table_changes() throws Excep field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -283,10 +284,10 @@ public void test_default_description_of_deletion_on_table_changes() throws Excep WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' source (only deletion changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' (only deletion changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of a data source (only deletion changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of 'data source' (only deletion changes on actor table)"); } /** @@ -299,8 +300,8 @@ public void test_default_description_on_table_changes() throws Exception { field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -311,10 +312,10 @@ public void test_default_description_on_table_changes() throws Exception { WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' source (only changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' (only changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of a data source (only changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on tables of 'data source' (only changes on actor table)"); } /** @@ -327,8 +328,8 @@ public void test_default_description_of_changes_on_table() throws Exception { field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); Changes changesFromSource = new Changes(tableFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(tableFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -341,10 +342,10 @@ public void test_default_description_of_changes_on_table() throws Exception { WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on ACTOR table of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on ACTOR table of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on ACTOR table of 'data source'"); } /** @@ -357,8 +358,8 @@ public void test_default_description_of_changes_on_request() throws Exception { field.setAccessible(true); - Request requestFromSource = new Request(source, "select * from actor").setPksName("ID"); - Request requestFromDataSource = new Request(dataSource, "select * from actor").setPksName("ID"); + Request requestFromSource = new Request(jdbcConnectionProvider, "select * from actor").setPksName("ID"); + Request requestFromDataSource = new Request(dsConnectionProvider, "select * from actor").setPksName("ID"); Changes changesFromSource = new Changes(requestFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(requestFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -371,10 +372,10 @@ public void test_default_description_of_changes_on_request() throws Exception { WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on 'select * from actor' request of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Changes on 'select * from actor' request of 'data source'"); } /** @@ -387,8 +388,8 @@ public void test_default_description_of_change_of_changes() throws Exception { field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -399,10 +400,10 @@ public void test_default_description_of_change_of_changes() throws Exception { WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of 'data source'"); } /** @@ -415,8 +416,8 @@ public void test_default_description_of_change_of_changes_on_table() throws Exce field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); Changes changesFromSource = new Changes(tableFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(tableFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -428,10 +429,10 @@ public void test_default_description_of_change_of_changes_on_table() throws Exce ChangeAssert assertionFromDataSource = assertThat(changesFromDataSource).change(2); WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 2 (with primary key : [3]) of Changes on ACTOR table of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 2 (with primary key : [3]) of Changes on ACTOR table of 'data source'"); } /** @@ -444,8 +445,8 @@ public void test_default_description_of_change_of_changes_on_request() throws Ex field.setAccessible(true); - Request requestFromSource = new Request(source, "select id, name, firstname, birth from actor where id = 1").setPksName("ID"); - Request requestFromDataSource = new Request(dataSource, "select * from actor").setPksName("ID"); + Request requestFromSource = new Request(jdbcConnectionProvider, "select id, name, firstname, birth from actor where id = 1").setPksName("ID"); + Request requestFromDataSource = new Request(dsConnectionProvider, "select * from actor").setPksName("ID"); Changes changesFromSource = new Changes(requestFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(requestFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -458,10 +459,10 @@ public void test_default_description_of_change_of_changes_on_request() throws Ex WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on 'select id, name, firstname, bi...' request of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on 'select id, name, firstname, bi...' request of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 2 (with primary key : [3]) of Changes on 'select * from actor' request of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 2 (with primary key : [3]) of Changes on 'select * from actor' request of 'data source'"); } /** @@ -474,8 +475,8 @@ public void test_default_description_of_creation_change_of_changes() throws Exce field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -486,10 +487,10 @@ public void test_default_description_of_creation_change_of_changes() throws Exce WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only creation changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only creation changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of a data source (only creation changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'data source' (only creation changes)"); } /** @@ -502,8 +503,8 @@ public void test_default_description_of_creation_change_of_changes_on_table() th field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); Changes changesFromSource = new Changes(tableFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(tableFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -516,10 +517,10 @@ public void test_default_description_of_creation_change_of_changes_on_table() th WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source (only creation changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' (only creation changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of a data source (only creation changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'data source' (only creation changes)"); } /** @@ -532,8 +533,8 @@ public void test_default_description_of_creation_change_of_changes_on_request() field.setAccessible(true); - Request requestFromSource = new Request(source, "select * from actor").setPksName("ID"); - Request requestFromDataSource = new Request(dataSource, "select * from actor").setPksName("ID"); + Request requestFromSource = new Request(jdbcConnectionProvider, "select * from actor").setPksName("ID"); + Request requestFromDataSource = new Request(dsConnectionProvider, "select * from actor").setPksName("ID"); Changes changesFromSource = new Changes(requestFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(requestFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -546,10 +547,10 @@ public void test_default_description_of_creation_change_of_changes_on_request() WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source (only creation changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' (only creation changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on 'select * from actor' request of a data source (only creation changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on 'select * from actor' request of 'data source' (only creation changes)"); } /** @@ -562,8 +563,8 @@ public void test_default_description_of_modification_change_of_changes() throws field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -574,10 +575,10 @@ public void test_default_description_of_modification_change_of_changes() throws WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only modification changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only modification changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of a data source (only modification changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'data source' (only modification changes)"); } /** @@ -590,8 +591,8 @@ public void test_default_description_of_modification_change_of_changes_on_table( field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); Changes changesFromSource = new Changes(tableFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(tableFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -604,10 +605,10 @@ public void test_default_description_of_modification_change_of_changes_on_table( WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source (only modification changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' (only modification changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on ACTOR table of a data source (only modification changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on ACTOR table of 'data source' (only modification changes)"); } /** @@ -620,8 +621,8 @@ public void test_default_description_of_modification_change_of_changes_on_reques field.setAccessible(true); - Request requestFromSource = new Request(source, "select * from actor").setPksName("ID"); - Request requestFromDataSource = new Request(dataSource, "select * from actor").setPksName("ID"); + Request requestFromSource = new Request(jdbcConnectionProvider, "select * from actor").setPksName("ID"); + Request requestFromDataSource = new Request(dsConnectionProvider, "select * from actor").setPksName("ID"); Changes changesFromSource = new Changes(requestFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(requestFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -633,10 +634,10 @@ public void test_default_description_of_modification_change_of_changes_on_reques WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source (only modification changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' (only modification changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on 'select * from actor' request of a data source (only modification changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on 'select * from actor' request of 'data source' (only modification changes)"); } /** @@ -649,8 +650,8 @@ public void test_default_description_of_deletion_change_of_changes() throws Exce field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -661,10 +662,10 @@ public void test_default_description_of_deletion_change_of_changes() throws Exce WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [3]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only deletion changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [3]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only deletion changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [3]) of Changes on tables of a data source (only deletion changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [3]) of Changes on tables of 'data source' (only deletion changes)"); } /** @@ -677,8 +678,8 @@ public void test_default_description_of_deletion_change_of_changes_on_table() th field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); Changes changesFromSource = new Changes(tableFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(tableFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -691,10 +692,10 @@ public void test_default_description_of_deletion_change_of_changes_on_table() th WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source (only deletion changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' (only deletion changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on ACTOR table of a data source (only deletion changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on ACTOR table of 'data source' (only deletion changes)"); } /** @@ -707,8 +708,8 @@ public void test_default_description_of_deletion_change_of_changes_on_request() field.setAccessible(true); - Request requestFromSource = new Request(source, "select * from actor").setPksName("ID"); - Request requestFromDataSource = new Request(dataSource, "select * from actor").setPksName("ID"); + Request requestFromSource = new Request(jdbcConnectionProvider, "select * from actor").setPksName("ID"); + Request requestFromDataSource = new Request(dsConnectionProvider, "select * from actor").setPksName("ID"); Changes changesFromSource = new Changes(requestFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(requestFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -721,10 +722,10 @@ public void test_default_description_of_deletion_change_of_changes_on_request() WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source (only deletion changes)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' (only deletion changes)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on 'select * from actor' request of a data source (only deletion changes)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on 'select * from actor' request of 'data source' (only deletion changes)"); } /** @@ -737,8 +738,8 @@ public void test_default_description_of_creation_change_on_table_of_changes() th field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -749,10 +750,10 @@ public void test_default_description_of_creation_change_on_table_of_changes() th WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only creation changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only creation changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of a data source (only creation changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'data source' (only creation changes on actor table)"); } /** @@ -765,8 +766,8 @@ public void test_default_description_of_creation_change_on_table_of_changes_on_t field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); Changes changesFromSource = new Changes(tableFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(tableFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -779,10 +780,10 @@ public void test_default_description_of_creation_change_on_table_of_changes_on_t WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source (only creation changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' (only creation changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of a data source (only creation changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'data source' (only creation changes on actor table)"); } /** @@ -795,8 +796,8 @@ public void test_default_description_of_modification_change_on_table_of_changes( field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -807,10 +808,10 @@ public void test_default_description_of_modification_change_on_table_of_changes( WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only modification changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only modification changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of a data source (only modification changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'data source' (only modification changes on actor table)"); } /** @@ -823,8 +824,8 @@ public void test_default_description_of_modification_change_on_table_of_changes_ field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); Changes changesFromSource = new Changes(tableFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(tableFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -837,10 +838,10 @@ public void test_default_description_of_modification_change_on_table_of_changes_ WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source (only modification changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' (only modification changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on ACTOR table of a data source (only modification changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [1]) of Changes on ACTOR table of 'data source' (only modification changes on actor table)"); } /** @@ -853,8 +854,8 @@ public void test_default_description_of_deletion_change_on_table_of_changes() th field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -865,10 +866,10 @@ public void test_default_description_of_deletion_change_on_table_of_changes() th WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [3]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only deletion changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [3]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only deletion changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [3]) of Changes on tables of a data source (only deletion changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [3]) of Changes on tables of 'data source' (only deletion changes on actor table)"); } /** @@ -881,8 +882,8 @@ public void test_default_description_of_deletion_change_on_table_of_changes_on_t field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); Changes changesFromSource = new Changes(tableFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(tableFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -895,10 +896,10 @@ public void test_default_description_of_deletion_change_on_table_of_changes_on_t WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source (only deletion changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' (only deletion changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on ACTOR table of a data source (only deletion changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [3]) of Changes on ACTOR table of 'data source' (only deletion changes on actor table)"); } /** @@ -911,8 +912,8 @@ public void test_default_description_of_change_on_table_of_changes() throws Exce field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -922,10 +923,10 @@ public void test_default_description_of_change_on_table_of_changes() throws Exce ChangeAssert assertionFromDataSource = assertThat(changesFromDataSource).changeOnTable("actor", 0); WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of a data source (only changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'data source' (only changes on actor table)"); } /** @@ -938,8 +939,8 @@ public void test_default_description_of_change_on_table_of_changes_on_table() th field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); Changes changesFromSource = new Changes(tableFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(tableFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -952,10 +953,10 @@ public void test_default_description_of_change_on_table_of_changes_on_table() th WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source (only changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' (only changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of a data source (only changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'data source' (only changes on actor table)"); } /** @@ -968,8 +969,8 @@ public void test_default_description_of_change_on_table_with_pks_of_changes() th field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -980,10 +981,10 @@ public void test_default_description_of_change_on_table_with_pks_of_changes() th WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 1 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 1 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 1 (on table : ACTOR and with primary key : [1]) of Changes on tables of a data source (only changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 1 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'data source' (only changes on actor table)"); } /** @@ -996,8 +997,8 @@ public void test_default_description_of_change_on_table_with_pks_of_changes_on_t field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); Changes changesFromSource = new Changes(tableFromSource).setStartPointNow(); Changes changesFromDataSource = new Changes(tableFromDataSource).setStartPointNow(); updateChangesForTests(); @@ -1010,10 +1011,10 @@ public void test_default_description_of_change_on_table_with_pks_of_changes_on_t WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 1 (with primary key : [1]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source (only changes on actor table)"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Change at index 1 (with primary key : [1]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' (only changes on actor table)"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 1 (with primary key : [1]) of Changes on ACTOR table of a data source (only changes on actor table)"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Change at index 1 (with primary key : [1]) of Changes on ACTOR table of 'data source' (only changes on actor table)"); } /** @@ -1026,8 +1027,8 @@ public void test_default_description_column_of_change_of_changes() throws Except field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -1038,10 +1039,10 @@ public void test_default_description_column_of_change_of_changes() throws Except WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Column at index 0 (column name : ID) of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Column at index 0 (column name : ID) of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of 'data source'"); } /** @@ -1054,8 +1055,8 @@ public void test_default_description_row_at_start_point_of_change_of_changes() t field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -1066,10 +1067,10 @@ public void test_default_description_row_at_start_point_of_change_of_changes() t WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Row at start point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Row at start point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Row at start point of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Row at start point of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of 'data source'"); } /** @@ -1082,8 +1083,8 @@ public void test_default_description_row_at_end_point_of_change_of_changes() thr field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -1094,10 +1095,10 @@ public void test_default_description_row_at_end_point_of_change_of_changes() thr WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Row at end point of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Row at end point of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of 'data source'"); } /** @@ -1110,8 +1111,8 @@ public void test_default_description_value_at_start_point_of_column_of_change_of field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -1123,10 +1124,10 @@ public void test_default_description_value_at_start_point_of_column_of_change_of WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Value at start point of Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Value at start point of Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Value at start point of Column at index 0 (column name : ID) of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Value at start point of Column at index 0 (column name : ID) of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of 'data source'"); } /** @@ -1139,8 +1140,8 @@ public void test_default_description_value_at_end_point_of_column_of_change_of_c field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -1152,10 +1153,10 @@ public void test_default_description_value_at_end_point_of_column_of_change_of_c WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Value at end point of Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Value at end point of Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Value at end point of Column at index 0 (column name : ID) of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Value at end point of Column at index 0 (column name : ID) of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of 'data source'"); } /** @@ -1168,8 +1169,8 @@ public void test_default_description_value_of_row_at_start_point_of_change_of_ch field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -1180,10 +1181,10 @@ public void test_default_description_value_of_row_at_start_point_of_change_of_ch WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Value at index 0 (column name : ID) of Row at start point of Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Value at index 0 (column name : ID) of Row at start point of Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Value at index 0 (column name : ID) of Row at start point of Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Value at index 0 (column name : ID) of Row at start point of Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'data source'"); } /** @@ -1196,8 +1197,8 @@ public void test_default_description_value_of_row_at_end_point_of_change_of_chan field.setAccessible(true); - Changes changesFromSource = new Changes(source).setStartPointNow(); - Changes changesFromDataSource = new Changes(dataSource).setStartPointNow(); + Changes changesFromSource = new Changes(jdbcConnectionProvider).setStartPointNow(); + Changes changesFromDataSource = new Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); changesFromSource.setEndPointNow(); changesFromDataSource.setEndPointNow(); @@ -1208,10 +1209,10 @@ public void test_default_description_value_of_row_at_end_point_of_change_of_chan WritableAssertionInfo infoFromSource = (WritableAssertionInfo) field.get(assertionFromSource); - assertThat(infoFromSource.descriptionText()).isEqualTo("Value at index 0 (column name : ID) of Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source"); + assertThat(infoFromSource.descriptionText()).isEqualTo("Value at index 0 (column name : ID) of Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'"); WritableAssertionInfo infoFromDataSource = (WritableAssertionInfo) field.get(assertionFromDataSource); - assertThat(infoFromDataSource.descriptionText()).isEqualTo("Value at index 0 (column name : ID) of Row at end point of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of a data source"); + assertThat(infoFromDataSource.descriptionText()).isEqualTo("Value at index 0 (column name : ID) of Row at end point of Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of 'data source'"); } /** @@ -1223,8 +1224,8 @@ public void test_default_description_of_table() throws Exception { field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); TableAssert assertionFromSource = assertThat(tableFromSource); @@ -1247,8 +1248,8 @@ public void test_default_description_of_request() throws Exception { field.setAccessible(true); - Request requestFromSource = new Request(source, "select id, name, firstname, birth from actor where id = 1").setPksName("ID"); - Request requestFromDataSource = new Request(dataSource, "select * from actor").setPksName("ID"); + Request requestFromSource = new Request(jdbcConnectionProvider, "select id, name, firstname, birth from actor where id = 1").setPksName("ID"); + Request requestFromDataSource = new Request(dsConnectionProvider, "select * from actor").setPksName("ID"); RequestAssert assertionFromSource = assertThat(requestFromSource); @@ -1271,8 +1272,8 @@ public void test_default_description_of_column_of_table() throws Exception { field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); TableColumnAssert assertionFromSource = assertThat(tableFromSource).column(); @@ -1295,8 +1296,8 @@ public void test_default_description_of_row_of_table() throws Exception { field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); TableRowAssert assertionFromSource = assertThat(tableFromSource).row(); @@ -1319,8 +1320,8 @@ public void test_default_description_of_column_of_request() throws Exception { field.setAccessible(true); - Request requestFromSource = new Request(source, "select * from actor").setPksName("ID"); - Request requestFromDataSource = new Request(dataSource, "select * from actor").setPksName("ID"); + Request requestFromSource = new Request(jdbcConnectionProvider, "select * from actor").setPksName("ID"); + Request requestFromDataSource = new Request(dsConnectionProvider, "select * from actor").setPksName("ID"); RequestColumnAssert assertionFromSource = assertThat(requestFromSource).column(); @@ -1343,8 +1344,8 @@ public void test_default_description_of_row_of_request() throws Exception { field.setAccessible(true); - Request requestFromSource = new Request(source, "select * from actor").setPksName("ID"); - Request requestFromDataSource = new Request(dataSource, "select * from actor").setPksName("ID"); + Request requestFromSource = new Request(jdbcConnectionProvider, "select * from actor").setPksName("ID"); + Request requestFromDataSource = new Request(dsConnectionProvider, "select * from actor").setPksName("ID"); RequestRowAssert assertionFromSource = assertThat(requestFromSource).row(); @@ -1367,8 +1368,8 @@ public void test_default_description_of_value_of_column_of_table() throws Except field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); TableColumnValueAssert assertionFromSource = assertThat(tableFromSource).column().value(); @@ -1391,8 +1392,8 @@ public void test_default_description_of_value_of_row_of_table() throws Exception field.setAccessible(true); - Table tableFromSource = new Table(source, "actor"); - Table tableFromDataSource = new Table(dataSource, "actor"); + Table tableFromSource = new Table(jdbcConnectionProvider, "actor"); + Table tableFromDataSource = new Table(dsConnectionProvider, "actor"); TableRowValueAssert assertionFromSource = assertThat(tableFromSource).row().value(); @@ -1415,8 +1416,8 @@ public void test_default_description_of_value_of_column_of_request() throws Exce field.setAccessible(true); - Request requestFromSource = new Request(source, "select * from actor").setPksName("ID"); - Request requestFromDataSource = new Request(dataSource, "select * from actor").setPksName("ID"); + Request requestFromSource = new Request(jdbcConnectionProvider, "select * from actor").setPksName("ID"); + Request requestFromDataSource = new Request(dsConnectionProvider, "select * from actor").setPksName("ID"); RequestColumnValueAssert assertionFromSource = assertThat(requestFromSource).column().value(); @@ -1439,8 +1440,8 @@ public void test_default_description_of_value_of_row_of_request() throws Excepti field.setAccessible(true); - Request requestFromSource = new Request(source, "select * from actor").setPksName("ID"); - Request requestFromDataSource = new Request(dataSource, "select * from actor").setPksName("ID"); + Request requestFromSource = new Request(jdbcConnectionProvider, "select * from actor").setPksName("ID"); + Request requestFromDataSource = new Request(dsConnectionProvider, "select * from actor").setPksName("ID"); RequestRowValueAssert assertionFromSource = assertThat(requestFromSource).row().value(); diff --git a/src/test/java/org/assertj/db/api/Descriptable_Test.java b/src/test/java/org/assertj/db/api/Descriptable_Test.java index b0484cfd..9cca5d4a 100644 --- a/src/test/java/org/assertj/db/api/Descriptable_Test.java +++ b/src/test/java/org/assertj/db/api/Descriptable_Test.java @@ -29,6 +29,7 @@ * Test on {@code Descriptable} interface methods. * * @author Régis Pouiller + * @author Julien Roy */ public class Descriptable_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class Descriptable_Test extends AbstractTest { public void test_as() throws Exception { Field field = AbstractElement.class.getDeclaredField("info"); field.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableRowAssert assertion = assertThat(table).row(); WritableAssertionInfo info1 = (WritableAssertionInfo) field.get(assertion); diff --git a/src/test/java/org/assertj/db/api/SoftAssertions_Test.java b/src/test/java/org/assertj/db/api/SoftAssertions_Test.java index 5c64be6d..06707c51 100644 --- a/src/test/java/org/assertj/db/api/SoftAssertions_Test.java +++ b/src/test/java/org/assertj/db/api/SoftAssertions_Test.java @@ -12,6 +12,9 @@ */ package org.assertj.db.api; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + import org.assertj.core.api.SoftAssertionError; import org.assertj.core.api.ThrowableAssert; import org.assertj.db.common.AbstractTest; @@ -21,9 +24,6 @@ import org.assertj.db.type.Table; import org.junit.Test; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - /** * Test on the utility class {@code SoftAssertions}. * @@ -37,7 +37,7 @@ public class SoftAssertions_Test extends AbstractTest { @Test @NeedReload public void test_soft_assert_table() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); final SoftAssertions softly = new SoftAssertions(); softly.assertThat(table).as("Show be Zero").column("var1").value().isEqualTo(0); softly.assertThat(table).column("var2").value().isFalse(); @@ -67,7 +67,7 @@ public void call() { @Test @NeedReload public void test_soft_assert_request() { - Request request = new Request(source, "select * from test"); + Request request = new Request(jdbcConnectionProvider, "select * from test"); final SoftAssertions softly = new SoftAssertions(); softly.assertThat(request).column("var1").value(0).isEqualTo(0); softly.assertThat(request).column("var2").value(0).isFalse(); @@ -97,7 +97,7 @@ public void call() { @Test @NeedReload public void test_soft_assert_changes() { - Changes changes = new Changes(source); + Changes changes = new Changes(jdbcConnectionProvider); changes.setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsCreation_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsCreation_Test.java index b75fc10e..fba5f299 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsCreation_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsCreation_Test.java @@ -27,6 +27,7 @@ * {@link AssertOnChangeType#isCreation()}} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnChangeType_IsCreation_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnChangeType_IsCreation_Test extends AbstractTest { @Test @NeedReload public void test_is_creation() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_is_creation() throws Exception { @Test @NeedReload public void should_fail_because_type_of_change_is_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_type_of_change_is_different() throws Exception { assertThat(changes).change(3).isCreation(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + "to be of type%n" + " %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsDeletion_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsDeletion_Test.java index 7af6e086..ccbfa0cd 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsDeletion_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsDeletion_Test.java @@ -27,6 +27,7 @@ * {@link AssertOnChangeType#isDeletion()}} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnChangeType_IsDeletion_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnChangeType_IsDeletion_Test extends AbstractTest { @Test @NeedReload public void test_is_deletion() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_is_deletion() throws Exception { @Test @NeedReload public void should_fail_because_type_of_change_is_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_type_of_change_is_different() throws Exception { assertThat(changes).change(3).isDeletion(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + "to be of type%n" + " %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsModification_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsModification_Test.java index c5bd83fb..8192788d 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsModification_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsModification_Test.java @@ -12,9 +12,6 @@ */ package org.assertj.db.api.assertions; -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeAssert; import org.assertj.db.common.AbstractTest; @@ -22,49 +19,53 @@ import org.assertj.db.type.Changes; import org.junit.Test; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + /** * Tests on {@link AssertOnChangeType} class : * {@link AssertOnChangeType#isModification()}} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnChangeType_IsModification_Test extends AbstractTest { - /** - * This method tests the {@code isModification} assertion method. - */ - @Test - @NeedReload - public void test_is_modification() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); - updateChangesForTests(); - changes.setEndPointNow(); + /** + * This method tests the {@code isModification} assertion method. + */ + @Test + @NeedReload + public void test_is_modification() throws Exception { + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); + updateChangesForTests(); + changes.setEndPointNow(); - ChangeAssert changeAssert = assertThat(changes).change(3); - ChangeAssert changeAssert2 = changeAssert.isModification(); - Assertions.assertThat(changeAssert).isSameAs(changeAssert2); - } + ChangeAssert changeAssert = assertThat(changes).change(3); + ChangeAssert changeAssert2 = changeAssert.isModification(); + Assertions.assertThat(changeAssert).isSameAs(changeAssert2); + } - /** - * This method should fail because the type of change is different. - */ - @Test - @NeedReload - public void should_fail_because_type_of_change_is_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); - updateChangesForTests(); - changes.setEndPointNow(); + /** + * This method should fail because the type of change is different. + */ + @Test + @NeedReload + public void should_fail_because_type_of_change_is_different() throws Exception { + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); + updateChangesForTests(); + changes.setEndPointNow(); - try { - assertThat(changes).change().isModification(); - fail("An exception must be raised"); - } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" - + "Expecting:%n" - + "to be of type%n" - + " %n" - + "but was of type%n" - + " ")); + try { + assertThat(changes).change().isModification(); + fail("An exception must be raised"); + } catch (AssertionError e) { + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + + "Expecting:%n" + + "to be of type%n" + + " %n" + + "but was of type%n" + + " ")); + } } - } } diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsOfType_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsOfType_Test.java index 4dce3796..3d372386 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsOfType_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnChangeType_IsOfType_Test.java @@ -28,6 +28,7 @@ * {@link AssertOnChangeType#isOfType(org.assertj.db.type.ChangeType)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnChangeType_IsOfType_Test extends AbstractTest { @@ -37,7 +38,7 @@ public class AssertOnChangeType_IsOfType_Test extends AbstractTest { @Test @NeedReload public void test_is_of_type() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -52,7 +53,7 @@ public void test_is_of_type() throws Exception { @Test @NeedReload public void should_fail_because_type_of_change_is_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -60,7 +61,7 @@ public void should_fail_because_type_of_change_is_different() throws Exception { assertThat(changes).change(3).isOfType(ChangeType.CREATION); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + "to be of type%n" + " %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnClass_IsOfClass_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnClass_IsOfClass_Test.java index 0c9f1d90..35abedfe 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnClass_IsOfClass_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnClass_IsOfClass_Test.java @@ -29,6 +29,7 @@ * {@link AssertOnColumnClass#isOfClass(Class, boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnClass_IsOfClass_Test extends AbstractTest { @@ -38,12 +39,12 @@ public class AssertOnColumnClass_IsOfClass_Test extends AbstractTest { @Test @NeedReload public void test_is_of_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var2"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isOfClass(Boolean.class, true); @@ -65,18 +66,18 @@ public void test_is_of_type() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var2").isOfClass(Boolean.class, false); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of class%n" @@ -86,7 +87,7 @@ public void should_fail_because_value_have_different_type() { assertThat(changes).change(1).column("var1").isOfClass(Boolean.class, true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " <1>%n" + "to be of class%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Boolean_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Boolean_Test.java index 9382938a..947be5d0 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Boolean_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Boolean_Test.java @@ -26,6 +26,7 @@ * {@link AssertOnColumnContent#containsValues(Boolean...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnContent_ContainsValues_Boolean_Test extends AbstractTest { @@ -34,12 +35,12 @@ public class AssertOnColumnContent_ContainsValues_Boolean_Test extends AbstractT */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var2"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.containsValues(true, false, false, false); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var2"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.containsValues(true, null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -50,7 +51,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var2"); try { tableColumnAssert.containsValues(true, false, true, false); @@ -63,7 +64,7 @@ public void should_fail_because_values_are_different() throws Exception { + " <[true, false, true, false]>%n" + " (parameter at index 2 is not found)")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var2"); try { tableColumnAssert2.containsValues(true, true); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Bytes_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Bytes_Test.java index ce578d1f..85f332cc 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Bytes_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Bytes_Test.java @@ -27,6 +27,7 @@ * {@link AssertOnColumnContent#containsValues(byte[]...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnContent_ContainsValues_Bytes_Test extends AbstractTest { @@ -38,12 +39,12 @@ public void test_has_values() throws Exception { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); byte[] bytesDev = bytesContentFromClassPathOf("logo-dev.jpg"); - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var11"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.containsValues(bytesH2, bytesDev, bytesDev, bytesDev); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var11"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.containsValues(bytesH2, null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -56,7 +57,7 @@ public void test_has_values() throws Exception { public void should_fail_because_values_are_different() throws Exception { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var11"); try { tableColumnAssert.containsValues(bytesH2, bytesH2, bytesH2, bytesH2); @@ -67,7 +68,7 @@ public void should_fail_because_values_are_different() throws Exception { + " (parameter at index 1 is not found)")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var11"); try { tableColumnAssert2.containsValues(bytesH2, bytesH2); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Character_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Character_Test.java index 7144dfd4..fd67e39c 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Character_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Character_Test.java @@ -26,6 +26,7 @@ * {@link AssertOnColumnContent#containsValues(Character...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnContent_ContainsValues_Character_Test extends AbstractTest { @@ -34,12 +35,12 @@ public class AssertOnColumnContent_ContainsValues_Character_Test extends Abstrac */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var16"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.containsValues('T', 'e', 's', 't'); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var17"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.containsValues(null, 'T'); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -50,7 +51,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var16"); try { tableColumnAssert.containsValues('t', 'e', 's', 't'); @@ -63,7 +64,7 @@ public void should_fail_because_values_are_different() throws Exception { + " <['t', 'e', 's', 't']>%n" + " (parameter <'t'> at index 3 is not found)")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var17"); try { tableColumnAssert2.containsValues('T', 'T'); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_DateTimeValue_Test.java index d0cd0dc5..36167327 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_DateTimeValue_Test.java @@ -29,6 +29,7 @@ * {@link AssertOnColumnContent#containsValues(org.assertj.db.type.DateTimeValue...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnContent_ContainsValues_DateTimeValue_Test extends AbstractTest { @@ -37,7 +38,7 @@ public class AssertOnColumnContent_ContainsValues_DateTimeValue_Test extends Abs */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var10"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.containsValues( DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30)), @@ -46,7 +47,7 @@ public void test_has_values() throws Exception { DateTimeValue.of(DateValue.of(2014, 5, 30))); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var10"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.containsValues( DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30)), @@ -73,7 +74,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var10"); try { tableColumnAssert.containsValues(DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30)), @@ -95,7 +96,7 @@ public void should_fail_because_values_are_different() throws Exception { + " 2014-05-30T00:00:00.000000000]>%n" + " (parameter <2014-05-30T13:29:49.000000000> at index 1 is not found)")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var10"); try { tableColumnAssert2.containsValues(DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30)), diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_DateValue_Test.java index b75ecddd..2987b77c 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_DateValue_Test.java @@ -28,6 +28,7 @@ * {@link AssertOnColumnContent#containsValues(org.assertj.db.type.DateValue...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnContent_ContainsValues_DateValue_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnColumnContent_ContainsValues_DateValue_Test extends Abstrac @NeedReload public void test_has_values() throws Exception { update("update test2 set var10 = '2014-05-24' where var1 = 1"); - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var9"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.containsValues( DateValue.of(2014, 5, 24), @@ -47,7 +48,7 @@ public void test_has_values() throws Exception { DateValue.of(2014, 5, 30)); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var9"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.containsValues(DateValue.of(2014, 5, 24), null); @@ -63,7 +64,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var9"); try { tableColumnAssert.containsValues(DateValue.of(2014, 5, 24), @@ -82,7 +83,7 @@ public void should_fail_because_values_are_different() throws Exception { + " <[2014-05-24, 2014-05-29, 2014-05-30, 2014-05-30]>%n" + " (parameter <2014-05-29> at index 1 is not found)")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var9"); try { tableColumnAssert2.containsValues(DateValue.of(2014, 5, 24), diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Number_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Number_Test.java index e3b6d3cb..6dc649a5 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Number_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_Number_Test.java @@ -26,6 +26,7 @@ * {@link AssertOnColumnContent#containsValues(Number...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnContent_ContainsValues_Number_Test extends AbstractTest { @@ -34,12 +35,12 @@ public class AssertOnColumnContent_ContainsValues_Number_Test extends AbstractTe */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var3"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.containsValues(2, 20, 25, 0); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var3"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.containsValues(2, null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -98,7 +99,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var3"); try { tableColumnAssert.containsValues(2, 20, 35, 0); @@ -111,7 +112,7 @@ public void should_fail_because_values_are_different() throws Exception { + " <[2, 20, 35, 0]>%n" + " (parameter <35> at index 2 is not found)")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var3"); try { tableColumnAssert2.containsValues(2, 2); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_String_Test.java index 3ac469c7..d81c2e8e 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_ContainsValues_String_Test.java @@ -27,6 +27,7 @@ * {@link AssertOnColumnContent#containsValues(String...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnContent_ContainsValues_String_Test extends AbstractTest { @@ -36,12 +37,12 @@ public class AssertOnColumnContent_ContainsValues_String_Test extends AbstractTe @Test @NeedReload public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var3"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.containsValues("2", "20", "25", "0"); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var3"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.containsValues("2", null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -154,7 +155,7 @@ public void test_has_values() throws Exception { Assertions.assertThat(tableColumnAssert18).isSameAs(tableColumnAssertReturn18); update("update test2 set var10 = '2014-05-24' where var1 = 1"); - table2 = new Table(source, "test2"); + table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert19 = assertThat(table2).column("var10"); TableColumnAssert tableColumnAssertReturn19 = tableColumnAssert19.containsValues("2014-05-24", null); @@ -172,7 +173,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var3"); try { tableColumnAssert.containsValues("2", "20", "35", "0"); @@ -185,7 +186,7 @@ public void should_fail_because_values_are_different() throws Exception { + " <[\"2\", \"20\", \"35\", \"0\"]>%n" + " (parameter <\"35\"> at index 2 is not found)")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var3"); try { tableColumnAssert2.containsValues("2", "2"); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_HasValues_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_HasValues_TimeValue_Test.java index 99f7336a..e2a07984 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_HasValues_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_HasValues_TimeValue_Test.java @@ -27,6 +27,7 @@ * {@link AssertOnColumnContent#containsValues(org.assertj.db.type.TimeValue...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnContent_HasValues_TimeValue_Test extends AbstractTest { @@ -35,7 +36,7 @@ public class AssertOnColumnContent_HasValues_TimeValue_Test extends AbstractTest */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var8"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.containsValues(TimeValue.of(9, 46, 30), TimeValue.of(12, 29, 49), @@ -43,7 +44,7 @@ public void test_has_values() throws Exception { TimeValue.of(12, 29, 49)); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var8"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.containsValues(TimeValue.of(9, 46, 30), null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -54,7 +55,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var8"); try { tableColumnAssert.containsValues(TimeValue.of(12, 29, 49), @@ -76,7 +77,7 @@ public void should_fail_because_values_are_different() throws Exception { + "12:29:49.000000000]>%n" + " (parameter <12:29:49.000000000> at index 3 is not found)")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var8"); try { tableColumnAssert2.containsValues(TimeValue.of(9, 46, 30), diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_HasValues_UUID_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_HasValues_UUID_Test.java index b1d87aeb..9deb4bec 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_HasValues_UUID_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnContent_HasValues_UUID_Test.java @@ -36,7 +36,7 @@ public class AssertOnColumnContent_HasValues_UUID_Test extends AbstractTest { */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var15"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.containsValues( UUID.fromString("30B443AE-C0C9-4790-9BEC-CE1380808435"), @@ -46,7 +46,7 @@ public void test_has_values() throws Exception { ); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var16"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2 .containsValues(UUID.fromString("30B443AE-C0C9-4790-9BEC-CE1380808435"), null); @@ -58,7 +58,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var15"); try { tableColumnAssert.containsValues(UUID.fromString("F96EC595-CE91-47CC-9152-CCC8AC48AAD6"), @@ -81,7 +81,7 @@ public void should_fail_because_values_are_different() throws Exception { + " f96ec595-ce91-47cc-9152-ccc8ac48aad6]>%n" + " (parameter at index 0 is not found)")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var16"); try { tableColumnAssert2.containsValues(UUID.fromString("30B443AE-C0C9-4790-9BEC-CE1380808435"), diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Boolean_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Boolean_Test.java index ee0a4c2b..35ccfe9c 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Boolean_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Boolean_Test.java @@ -26,6 +26,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnEquality#hasValues(Boolean...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnEquality_HasValues_Boolean_Test extends AbstractTest { @@ -34,12 +35,12 @@ public class AssertOnColumnEquality_HasValues_Boolean_Test extends AbstractTest */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var2"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.hasValues(true, false, false, false); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var2"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.hasValues(true, null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -50,7 +51,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var2"); try { tableColumnAssert.hasValues(true, false, true, false); @@ -62,7 +63,7 @@ public void should_fail_because_values_are_different() throws Exception { + "to be equal to: %n" + " ")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var2"); try { tableColumnAssert2.hasValues(true, true); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Bytes_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Bytes_Test.java index dbc74e51..22c901c4 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Bytes_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Bytes_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnEquality#hasValues(byte[]...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnEquality_HasValues_Bytes_Test extends AbstractTest { @@ -38,12 +39,12 @@ public void test_has_values() throws Exception { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); byte[] bytesDev = bytesContentFromClassPathOf("logo-dev.jpg"); - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var11"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.hasValues(bytesH2, bytesDev, bytesDev, bytesDev); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var11"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.hasValues(bytesH2, null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -56,7 +57,7 @@ public void test_has_values() throws Exception { public void should_fail_because_values_are_different() throws Exception { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var11"); try { tableColumnAssert.hasValues(bytesH2, bytesH2, bytesH2, bytesH2); @@ -66,7 +67,7 @@ public void should_fail_because_values_are_different() throws Exception { + "Expecting that the value at index 1 to be equal to the expected value but was not equal")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var11"); try { tableColumnAssert2.hasValues(bytesH2, bytesH2); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Character_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Character_Test.java index 5e0ddc2d..f14313e1 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Character_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Character_Test.java @@ -26,6 +26,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnEquality#hasValues(Character...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnEquality_HasValues_Character_Test extends AbstractTest { @@ -34,12 +35,12 @@ public class AssertOnColumnEquality_HasValues_Character_Test extends AbstractTes */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var16"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.hasValues('T', 'e', 's', 't'); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var17"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.hasValues('T', null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -50,7 +51,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var16"); try { tableColumnAssert.hasValues('t', 'e', 's', 'T'); @@ -62,7 +63,7 @@ public void should_fail_because_values_are_different() throws Exception { + "to be equal to: %n" + " <'t'>")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var17"); try { tableColumnAssert2.hasValues('T', 'T'); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_DateTimeValue_Test.java index 5b5d454e..08fcdcbe 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_DateTimeValue_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnEquality#hasValues(org.assertj.db.type.DateTimeValue...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnEquality_HasValues_DateTimeValue_Test extends AbstractTest { @@ -37,7 +38,7 @@ public class AssertOnColumnEquality_HasValues_DateTimeValue_Test extends Abstrac */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var10"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.hasValues( DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30)), @@ -46,7 +47,7 @@ public void test_has_values() throws Exception { DateTimeValue.of(DateValue.of(2014, 5, 30))); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var10"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.hasValues( DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30)), @@ -73,7 +74,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var10"); try { tableColumnAssert.hasValues(DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30)), @@ -88,7 +89,7 @@ public void should_fail_because_values_are_different() throws Exception { + "to be equal to: %n" + " <2014-05-30T13:29:49.000000000>")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var10"); try { tableColumnAssert2.hasValues(DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30)), diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_DateValue_Test.java index a25c480c..08de07ff 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_DateValue_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnEquality#hasValues(org.assertj.db.type.DateValue...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnEquality_HasValues_DateValue_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnColumnEquality_HasValues_DateValue_Test extends AbstractTes @NeedReload public void test_has_values() throws Exception { update("update test2 set var10 = '2014-05-24' where var1 = 1"); - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var9"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.hasValues( DateValue.of(2014, 5, 24), @@ -47,7 +48,7 @@ public void test_has_values() throws Exception { DateValue.of(2014, 5, 30)); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var9"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.hasValues(DateValue.of(2014, 5, 24), null); @@ -63,7 +64,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var9"); try { tableColumnAssert.hasValues(DateValue.of(2014, 5, 24), @@ -78,7 +79,7 @@ public void should_fail_because_values_are_different() throws Exception { + "to be equal to: %n" + " <2014-05-29>")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var9"); try { tableColumnAssert2.hasValues(DateValue.of(2014, 5, 24), diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Number_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Number_Test.java index ca13e0f5..22ea82e0 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Number_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_Number_Test.java @@ -26,6 +26,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnEquality#hasValues(Number...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnEquality_HasValues_Number_Test extends AbstractTest { @@ -34,12 +35,12 @@ public class AssertOnColumnEquality_HasValues_Number_Test extends AbstractTest { */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var3"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.hasValues(2, 20, 25, 0); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var3"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.hasValues(2, null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -98,7 +99,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var3"); try { tableColumnAssert.hasValues(2, 20, 35, 0); @@ -110,7 +111,7 @@ public void should_fail_because_values_are_different() throws Exception { + "to be equal to: %n" + " <35>")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var3"); try { tableColumnAssert2.hasValues(2, 2); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_String_Test.java index 2829f3ba..6a06df36 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_String_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnEquality#hasValues(String...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnEquality_HasValues_String_Test extends AbstractTest { @@ -36,12 +37,12 @@ public class AssertOnColumnEquality_HasValues_String_Test extends AbstractTest { @Test @NeedReload public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var3"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.hasValues("2", "20", "25", "0"); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var3"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.hasValues("2", null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -154,7 +155,7 @@ public void test_has_values() throws Exception { Assertions.assertThat(tableColumnAssert18).isSameAs(tableColumnAssertReturn18); update("update test2 set var10 = '2014-05-24' where var1 = 1"); - table2 = new Table(source, "test2"); + table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert19 = assertThat(table2).column("var10"); TableColumnAssert tableColumnAssertReturn19 = tableColumnAssert19.hasValues("2014-05-24", null); @@ -171,7 +172,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var3"); try { tableColumnAssert.hasValues("2", "20", "35", "0"); @@ -183,7 +184,7 @@ public void should_fail_because_values_are_different() throws Exception { + "to be equal to: %n" + " <\"35\">")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var3"); try { tableColumnAssert2.hasValues("2", "2"); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_TimeValue_Test.java index 16bdbf15..df1b4b2e 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_TimeValue_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnEquality#hasValues(org.assertj.db.type.TimeValue...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnEquality_HasValues_TimeValue_Test extends AbstractTest { @@ -35,7 +36,7 @@ public class AssertOnColumnEquality_HasValues_TimeValue_Test extends AbstractTes */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var8"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.hasValues(TimeValue.of(9, 46, 30), TimeValue.of(12, 29, 49), @@ -43,7 +44,7 @@ public void test_has_values() throws Exception { TimeValue.of(12, 29, 49)); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var8"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2.hasValues(TimeValue.of(9, 46, 30), null); Assertions.assertThat(tableColumnAssert2).isSameAs(tableColumnAssertReturn2); @@ -54,7 +55,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var8"); try { tableColumnAssert.hasValues(TimeValue.of(12, 29, 49), @@ -69,7 +70,7 @@ public void should_fail_because_values_are_different() throws Exception { + "to be equal to: %n" + " <12:29:49.000000000>")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var8"); try { tableColumnAssert2.hasValues(TimeValue.of(9, 46, 30), diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_UUID_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_UUID_Test.java index d69796ff..adfc7262 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_UUID_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnEquality_HasValues_UUID_Test.java @@ -36,7 +36,7 @@ public class AssertOnColumnEquality_HasValues_UUID_Test extends AbstractTest { */ @Test public void test_has_values() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var15"); TableColumnAssert tableColumnAssertReturn = tableColumnAssert.hasValues( UUID.fromString("30B443AE-C0C9-4790-9BEC-CE1380808435"), @@ -46,7 +46,7 @@ public void test_has_values() throws Exception { ); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssertReturn); - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var16"); TableColumnAssert tableColumnAssertReturn2 = tableColumnAssert2 .hasValues(UUID.fromString("30B443AE-C0C9-4790-9BEC-CE1380808435"), null); @@ -58,7 +58,7 @@ public void test_has_values() throws Exception { */ @Test public void should_fail_because_values_are_different() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var15"); try { tableColumnAssert.hasValues(UUID.fromString("F96EC595-CE91-47CC-9152-CCC8AC48AAD6"), @@ -74,7 +74,7 @@ public void should_fail_because_values_are_different() throws Exception { + "to be equal to: %n" + " ")); } - Table table2 = new Table(source, "test2"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert2 = assertThat(table2).column("var16"); try { tableColumnAssert2.hasValues(UUID.fromString("30B443AE-C0C9-4790-9BEC-CE1380808435"), diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnName_HasColumnName_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnName_HasColumnName_Test.java index 4ca2e35b..7132241d 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnName_HasColumnName_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnName_HasColumnName_Test.java @@ -33,6 +33,7 @@ * {@link AssertOnColumnName#hasColumnName(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnName_HasColumnName_Test extends AbstractTest { @@ -42,7 +43,7 @@ public class AssertOnColumnName_HasColumnName_Test extends AbstractTest { @Test @NeedReload public void test_has_column_name() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -54,7 +55,7 @@ public void test_has_column_name() throws Exception { ChangeRowValueAssert changeRowValueAssert2 = changeRowValueAssert.hasColumnName("id"); Assertions.assertThat(changeRowValueAssert).isSameAs(changeRowValueAssert2); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableColumnAssert tableColumnAssert = tableAssert.column(); TableColumnAssert tableColumnAssert2 = tableColumnAssert.hasColumnName("id"); @@ -70,7 +71,7 @@ public void test_has_column_name() throws Exception { @Test @NeedReload public void should_fail_because_column_name_is_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -79,7 +80,7 @@ public void should_fail_because_column_name_is_different() throws Exception { changeAssert.column().hasColumnName("ID2"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " \"ID2\"%n" + "to be the name of the column but was:%n" @@ -89,14 +90,14 @@ public void should_fail_because_column_name_is_different() throws Exception { changeAssert.rowAtEndPoint().value().hasColumnName("ID2"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 (column name : ID) of Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 (column name : ID) of Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " \"ID2\"%n" + "to be the name of the column but was:%n" + " \"ID\"")); } - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); try { tableAssert.column().hasColumnName("ID2"); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnNullity_HasOnlyNotNullValues_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnNullity_HasOnlyNotNullValues_Test.java index b56dc5bb..6ff53c24 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnNullity_HasOnlyNotNullValues_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnNullity_HasOnlyNotNullValues_Test.java @@ -26,6 +26,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnNullity#hasOnlyNotNullValues()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnNullity_HasOnlyNotNullValues_Test extends AbstractTest { @@ -34,7 +35,7 @@ public class AssertOnColumnNullity_HasOnlyNotNullValues_Test extends AbstractTes */ @Test public void test_has_only_not_null_values() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableColumnAssert tableColumnAssert = assertThat(table).column("var14"); TableColumnAssert tableColumnAssert2 = tableColumnAssert.hasOnlyNotNullValues(); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssert2); @@ -45,7 +46,7 @@ public void test_has_only_not_null_values() { */ @Test public void should_fail_because_column_has_null_value() throws Exception { - Table table = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert = assertThat(table).column("var14"); try { tableColumnAssert.hasOnlyNotNullValues(); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnNullity_HasOnlyNullValues_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnNullity_HasOnlyNullValues_Test.java index a5df95af..c8a6d2cd 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnNullity_HasOnlyNullValues_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnNullity_HasOnlyNullValues_Test.java @@ -26,6 +26,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnNullity#hasOnlyNullValues()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnNullity_HasOnlyNullValues_Test extends AbstractTest { @@ -34,7 +35,7 @@ public class AssertOnColumnNullity_HasOnlyNullValues_Test extends AbstractTest { */ @Test public void test_has_only_null_values() { - Table table = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert = assertThat(table).column("var15"); TableColumnAssert tableColumnAssert2 = tableColumnAssert.hasOnlyNullValues(); Assertions.assertThat(tableColumnAssert).isSameAs(tableColumnAssert2); @@ -45,7 +46,7 @@ public void test_has_only_null_values() { */ @Test public void should_fail_because_column_has_not_null_value() throws Exception { - Table table = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test2"); TableColumnAssert tableColumnAssert = assertThat(table).column("var14"); try { tableColumnAssert.hasOnlyNullValues(); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Boolean_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Boolean_Test.java index e501d5e3..07b192f9 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Boolean_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Boolean_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(Boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_One_Boolean_Test extends AbstractTest { @@ -37,7 +38,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_One_Boolean_Test extends A @Test @NeedReload public void test_have_values_equal_to() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -53,7 +54,7 @@ public void test_have_values_equal_to() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var2) values(5, true)"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var2").hasValues(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -75,7 +76,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -83,7 +84,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var2").hasValues(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Bytes_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Bytes_Test.java index d8d8ea74..4a76ede4 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Bytes_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Bytes_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(byte[])} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_One_Bytes_Test extends AbstractTest { @@ -40,7 +41,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_One_Bytes_Test extends Abs public void test_have_values_equal_to() { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_have_values_equal_to() { public void should_fail_because_value_at_start_point_is_different() { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var11) values(5, FILE_READ('classpath:h2-logo-2.png'))"); changes.setEndPointNow(); @@ -66,7 +67,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var11").hasValues(bytesH2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 10 (column name : VAR11) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 10 (column name : VAR11) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point to be equal to the expected value but was not equal")); } } @@ -79,7 +80,7 @@ public void should_fail_because_value_at_start_point_is_different() { public void should_fail_because_value_at_end_point_is_different() { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -87,7 +88,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var11").hasValues(bytesH2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 10 (column name : VAR11) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 10 (column name : VAR11) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point to be equal to the expected value but was not equal")); } } diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_DateTimeValue_Test.java index dc0b14c9..459de5c2 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_DateTimeValue_Test.java @@ -31,6 +31,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_One_DateTimeValue_Test extends AbstractTest { @@ -40,7 +41,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_One_DateTimeValue_Test ext @Test @NeedReload public void test_have_values_equal_to() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -57,7 +58,7 @@ public void test_have_values_equal_to() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var10) values(5, '2014-05-24 09:46:30')"); changes.setEndPointNow(); @@ -66,7 +67,7 @@ public void should_fail_because_value_at_start_point_is_different() { DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30))); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 9 (column name : VAR10) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 9 (column name : VAR10) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -80,7 +81,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -89,7 +90,7 @@ public void should_fail_because_value_at_end_point_is_different() { DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30))); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 9 (column name : VAR10) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 9 (column name : VAR10) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_DateValue_Test.java index b8e868db..baac0c38 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_DateValue_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(org.assertj.db.type.DateValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_One_DateValue_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_One_DateValue_Test extends @Test @NeedReload public void test_have_values_equal_to() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -54,7 +55,7 @@ public void test_have_values_equal_to() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var9) values(5, '2014-05-24')"); changes.setEndPointNow(); @@ -62,7 +63,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var9").hasValues(DateValue.of(2014, 5, 24)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 8 (column name : VAR9) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 8 (column name : VAR9) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -76,7 +77,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -84,7 +85,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var9").hasValues(DateValue.of(2014, 5, 24)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 8 (column name : VAR9) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 8 (column name : VAR9) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Number_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Number_Test.java index 30dd2f4d..de0ede87 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Number_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_Number_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(Number)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_One_Number_Test extends AbstractTest { @@ -37,7 +38,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_One_Number_Test extends Ab @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -53,7 +54,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var3) values(5, 3)"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var3").hasValues(3); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 2 (column name : VAR3) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 2 (column name : VAR3) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -75,7 +76,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -83,7 +84,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var3").hasValues(2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 2 (column name : VAR3) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 2 (column name : VAR3) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_String_Test.java index 8a559f5d..213c162b 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_String_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_One_String_Test extends AbstractTest { @@ -37,7 +38,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_One_String_Test extends Ab @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -56,7 +57,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var12, var15) values(5, 'test', '88838129-291E-40A9-A94C-A15BE36CF7C3')"); changes.setEndPointNow(); @@ -64,7 +65,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var12").hasValues("test"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 11 (column name : VAR12) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 11 (column name : VAR12) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -74,7 +75,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var15").hasValues("88838129-291E-40A9-A94C-A15BE36CF7C3"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -88,7 +89,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -96,7 +97,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var12").hasValues("text"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 11 (column name : VAR12) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 11 (column name : VAR12) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" @@ -106,7 +107,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var15").hasValues("30B443AE-C0C9-4790-9BEC-CE1380808435"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_TimeValue_Test.java index 9a9410f4..eec9e11c 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_TimeValue_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_One_TimeValue_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_One_TimeValue_Test extends @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -54,7 +55,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var8) values(5, '09:46:30')"); changes.setEndPointNow(); @@ -62,7 +63,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var8").hasValues(TimeValue.of(9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 7 (column name : VAR8) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 7 (column name : VAR8) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -76,7 +77,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -84,7 +85,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var8").hasValues(TimeValue.of(9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 7 (column name : VAR8) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 7 (column name : VAR8) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_UUID_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_UUID_Test.java index f032a2c9..e06b9b27 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_UUID_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_One_UUID_Test.java @@ -39,7 +39,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_One_UUID_Test extends Abst @Test @NeedReload public void test_have_values_equal_to() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -56,7 +56,7 @@ public void test_have_values_equal_to() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var15) values(5, 'F96EC595-CE91-47CC-9152-CCC8AC48AAD6')"); changes.setEndPointNow(); @@ -65,7 +65,7 @@ public void should_fail_because_value_at_start_point_is_different() { fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + "[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -79,7 +79,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -88,7 +88,7 @@ public void should_fail_because_value_at_end_point_is_different() { fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + "[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Boolean_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Boolean_Test.java index 5842676e..d1ddbf52 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Boolean_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Boolean_Test.java @@ -12,9 +12,6 @@ */ package org.assertj.db.api.assertions; -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeAssert; import org.assertj.db.api.ChangeColumnAssert; @@ -23,11 +20,15 @@ import org.assertj.db.type.Changes; import org.junit.Test; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + /** * Tests on {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality} class : * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(Boolean, Boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_Two_Boolean_Test extends AbstractTest { @@ -37,7 +38,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_Two_Boolean_Test extends A @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -53,7 +54,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var2) values(5, true)"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var2").hasValues(true, true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -75,7 +76,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -83,7 +84,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var2").hasValues(true, true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Bytes_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Bytes_Test.java index 6c94a8fa..642704d0 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Bytes_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Bytes_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(byte[], byte[])} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_Two_Bytes_Test extends AbstractTest { @@ -40,7 +41,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_Two_Bytes_Test extends Abs public void test_has_values() { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_has_values() { public void should_fail_because_value_at_start_point_is_different() { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var11) values(5, FILE_READ('classpath:h2-logo-2.png'))"); changes.setEndPointNow(); @@ -66,7 +67,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var11").hasValues(bytesH2, bytesH2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 10 (column name : VAR11) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 10 (column name : VAR11) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point to be equal to the expected value but was not equal")); } } @@ -79,7 +80,7 @@ public void should_fail_because_value_at_start_point_is_different() { public void should_fail_because_value_at_end_point_is_different() { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -87,7 +88,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var11").hasValues(bytesH2, bytesH2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 10 (column name : VAR11) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 10 (column name : VAR11) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point to be equal to the expected value but was not equal")); } } diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Character_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Character_Test.java index 85e1623e..9a2b29e6 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Character_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Character_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(Character, Character)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_Two_Character_Test extends AbstractTest { @@ -37,7 +38,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_Two_Character_Test extends @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -53,7 +54,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var2) values(5, true)"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var16").hasValues('T', 'T'); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 15 (column name : VAR16) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 15 (column name : VAR16) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -75,7 +76,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -83,7 +84,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var16").hasValues('T', 'T'); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 15 (column name : VAR16) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 15 (column name : VAR16) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_DateTimeValue_Test.java index 224914e0..67f70f2c 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_DateTimeValue_Test.java @@ -31,6 +31,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(org.assertj.db.type.DateTimeValue, org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_Two_DateTimeValue_Test extends AbstractTest { @@ -40,7 +41,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_Two_DateTimeValue_Test ext @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var10) values(5, '2014-05-24 09:46:30')"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_at_start_point_is_different() { DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30))); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 9 (column name : VAR10) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 9 (column name : VAR10) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -82,7 +83,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -92,7 +93,7 @@ public void should_fail_because_value_at_end_point_is_different() { DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 30))); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 9 (column name : VAR10) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 9 (column name : VAR10) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_DateValue_Test.java index 985a407b..097ccc59 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_DateValue_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(org.assertj.db.type.DateValue, org.assertj.db.type.DateValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_Two_DateValue_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_Two_DateValue_Test extends @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -55,7 +56,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var9) values(5, '2014-05-24')"); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var9").hasValues(DateValue.of(2014, 5, 24), DateValue.of(2014, 5, 24)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 8 (column name : VAR9) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 8 (column name : VAR9) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -77,7 +78,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -85,7 +86,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var9").hasValues(DateValue.of(2014, 5, 24), DateValue.of(2014, 5, 24)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 8 (column name : VAR9) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 8 (column name : VAR9) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Number_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Number_Test.java index 599e8c80..756b4a11 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Number_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_Number_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(Number, Number)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_Two_Number_Test extends AbstractTest { @@ -37,7 +38,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_Two_Number_Test extends Ab @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -53,7 +54,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var3) values(5, 3)"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var3").hasValues(3, 3); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 2 (column name : VAR3) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 2 (column name : VAR3) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -75,7 +76,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -83,7 +84,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var3").hasValues(2, 2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 2 (column name : VAR3) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 2 (column name : VAR3) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_String_Test.java index 1718cc24..e0193752 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_String_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(String, String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_Two_String_Test extends AbstractTest { @@ -37,7 +38,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_Two_String_Test extends Ab @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -56,7 +57,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var12, var15) values(5, 'test', '88838129-291E-40A9-A94C-A15BE36CF7C3')"); changes.setEndPointNow(); @@ -64,7 +65,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var12").hasValues("test", "test"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 11 (column name : VAR12) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 11 (column name : VAR12) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -74,7 +75,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var15").hasValues("88838129-291E-40A9-A94C-A15BE36CF7C3", "88838129-291E-40A9-A94C-A15BE36CF7C3"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -88,7 +89,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -96,7 +97,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var12").hasValues("text", "text"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 11 (column name : VAR12) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 11 (column name : VAR12) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" @@ -106,7 +107,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var15").hasValues("30B443AE-C0C9-4790-9BEC-CE1380808435", "30B443AE-C0C9-4790-9BEC-CE1380808435"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_TimeValue_Test.java index aa8f046b..6d07f3b5 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_TimeValue_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnOfChangeEquality#hasValues(org.assertj.db.type.TimeValue, org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnOfChangeEquality_HasValues_Two_TimeValue_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_Two_TimeValue_Test extends @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -55,7 +56,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var8) values(5, '09:46:30')"); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void should_fail_because_value_at_start_point_is_different() { assertThat(changes).change().column("var8").hasValues(TimeValue.of(9, 46, 30), TimeValue.of(9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 7 (column name : VAR8) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 7 (column name : VAR8) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -77,7 +78,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -85,7 +86,7 @@ public void should_fail_because_value_at_end_point_is_different() { assertThat(changes).change().column("var8").hasValues(TimeValue.of(9, 46, 30), TimeValue.of(9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 7 (column name : VAR8) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 7 (column name : VAR8) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_UUID_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_UUID_Test.java index 50ff516e..a8e4c693 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_UUID_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnOfChangeEquality_HasValues_Two_UUID_Test.java @@ -39,7 +39,7 @@ public class AssertOnColumnOfChangeEquality_HasValues_Two_UUID_Test extends Abst @Test @NeedReload public void test_has_values() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var15 = '0E2A1269-EFF0-4233-B87B-B53E8B6F164D' where var1 = 1"); changes.setEndPointNow(); @@ -57,7 +57,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_value_at_start_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("insert into test(var1, var15) values(5, '0E2A1269-EFF0-4233-B87B-B53E8B6F164D')"); changes.setEndPointNow(); @@ -67,7 +67,7 @@ public void should_fail_because_value_at_start_point_is_different() { fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + "[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that start point:%n" + " %n" + "to be equal to: %n" @@ -81,7 +81,7 @@ public void should_fail_because_value_at_start_point_is_different() { @Test @NeedReload public void should_fail_because_value_at_end_point_is_different() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("delete from test where var1 = 1"); changes.setEndPointNow(); @@ -91,7 +91,7 @@ public void should_fail_because_value_at_end_point_is_different() { fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + "[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that end point:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsBoolean_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsBoolean_Test.java index 39d2555e..faa1c5e0 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsBoolean_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsBoolean_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnType#isBoolean(boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnType_IsBoolean_Test extends AbstractTest { @@ -38,12 +39,12 @@ public class AssertOnColumnType_IsBoolean_Test extends AbstractTest { @Test @NeedReload public void test_is_boolean() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var2"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isBoolean(true); @@ -65,18 +66,18 @@ public void test_is_boolean() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var2").isBoolean(false); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" @@ -88,7 +89,7 @@ public void should_fail_because_value_have_different_type() { assertThat(changes).change(1).column("var1").isBoolean(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsBytes_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsBytes_Test.java index 28386c6f..3bca0c4f 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsBytes_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsBytes_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnType#isBytes(boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnType_IsBytes_Test extends AbstractTest { @@ -38,12 +39,12 @@ public class AssertOnColumnType_IsBytes_Test extends AbstractTest { @Test @NeedReload public void test_is_bytes() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var11"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isBytes(true); @@ -65,18 +66,18 @@ public void test_is_bytes() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var11").isBytes(false); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 10 (column name : VAR11) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 10 (column name : VAR11) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" @@ -88,7 +89,7 @@ public void should_fail_because_value_have_different_type() { assertThat(changes).change(1).column("var1").isBytes(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsDateTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsDateTime_Test.java index e3e5d0ac..6f251b44 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsDateTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsDateTime_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnType#isDateTime(boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnType_IsDateTime_Test extends AbstractTest { @@ -38,12 +39,12 @@ public class AssertOnColumnType_IsDateTime_Test extends AbstractTest { @Test @NeedReload public void test_is_date_time() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var10"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isDateTime(true); @@ -65,18 +66,18 @@ public void test_is_date_time() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var10").isDateTime(false); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 9 (column name : VAR10) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 9 (column name : VAR10) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" @@ -88,7 +89,7 @@ public void should_fail_because_value_have_different_type() { assertThat(changes).change(1).column("var1").isDateTime(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsDate_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsDate_Test.java index cbcf2687..9b50336e 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsDate_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsDate_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnType#isDate(boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnType_IsDate_Test extends AbstractTest { @@ -38,12 +39,12 @@ public class AssertOnColumnType_IsDate_Test extends AbstractTest { @Test @NeedReload public void test_is_date() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var9"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isDate(true); @@ -65,18 +66,18 @@ public void test_is_date() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var9").isDate(false); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 8 (column name : VAR9) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 8 (column name : VAR9) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" @@ -88,7 +89,7 @@ public void should_fail_because_value_have_different_type() { assertThat(changes).change(1).column("var1").isDate(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsNumber_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsNumber_Test.java index 477754fd..570a5f8b 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsNumber_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsNumber_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnType#isNumber(boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnType_IsNumber_Test extends AbstractTest { @@ -38,12 +39,12 @@ public class AssertOnColumnType_IsNumber_Test extends AbstractTest { @Test @NeedReload public void test_is_number() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var3"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isNumber(true); @@ -65,18 +66,18 @@ public void test_is_number() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var3").isNumber(false); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 2 (column name : VAR3) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 2 (column name : VAR3) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" @@ -88,7 +89,7 @@ public void should_fail_because_value_have_different_type() { assertThat(changes).change(1).column("var2").isNumber(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsOfAnyTypeIn_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsOfAnyTypeIn_Test.java index ea1e7432..de35075a 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsOfAnyTypeIn_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsOfAnyTypeIn_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnType#isOfAnyTypeIn(org.assertj.db.type.ValueType...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnType_IsOfAnyTypeIn_Test extends AbstractTest { @@ -39,12 +40,12 @@ public class AssertOnColumnType_IsOfAnyTypeIn_Test extends AbstractTest { @Test @NeedReload public void test_is_of_any_of_types() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var2"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isOfAnyTypeIn(ValueType.BOOLEAN, @@ -68,18 +69,18 @@ public void test_is_of_any_of_types() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var2").isOfAnyTypeIn(ValueType.BOOLEAN, ValueType.TEXT); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" @@ -92,7 +93,7 @@ public void should_fail_because_value_have_different_type() { ValueType.NOT_IDENTIFIED); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsOfType_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsOfType_Test.java index df82c6f9..50160006 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsOfType_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsOfType_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnType#isOfType(org.assertj.db.type.ValueType, boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnType_IsOfType_Test extends AbstractTest { @@ -39,12 +40,12 @@ public class AssertOnColumnType_IsOfType_Test extends AbstractTest { @Test @NeedReload public void test_is_of_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var2"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isOfType(ValueType.BOOLEAN, true); @@ -66,18 +67,18 @@ public void test_is_of_type() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var2").isOfType(ValueType.BOOLEAN, false); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 1 (column name : VAR2) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" @@ -89,7 +90,7 @@ public void should_fail_because_value_have_different_type() { assertThat(changes).change(1).column("var1").isOfType(ValueType.BOOLEAN, true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsText_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsText_Test.java index 78456154..ddc1a9f5 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsText_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsText_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnType#isText(boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnType_IsText_Test extends AbstractTest { @@ -38,12 +39,12 @@ public class AssertOnColumnType_IsText_Test extends AbstractTest { @Test @NeedReload public void test_is_text() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var12"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isText(true); @@ -65,18 +66,18 @@ public void test_is_text() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var12").isText(false); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 11 (column name : VAR12) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 11 (column name : VAR12) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" @@ -88,7 +89,7 @@ public void should_fail_because_value_have_different_type() { assertThat(changes).change(1).column("var1").isText(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsTime_Test.java index ae9d13d5..8b12a6e2 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsTime_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnColumnType#isTime(boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnColumnType_IsTime_Test extends AbstractTest { @@ -38,12 +39,12 @@ public class AssertOnColumnType_IsTime_Test extends AbstractTest { @Test @NeedReload public void test_is_time() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var8"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isTime(true); @@ -65,18 +66,18 @@ public void test_is_time() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); update("insert into test(var1, var2, var11, var10, var9, var3, var12, var8) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var8").isTime(false); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 7 (column name : VAR8) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 7 (column name : VAR8) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" @@ -88,7 +89,7 @@ public void should_fail_because_value_have_different_type() { assertThat(changes).change(1).column("var1").isTime(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsUUID_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsUUID_Test.java index 57876eff..50b7fcc1 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsUUID_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnColumnType_IsUUID_Test.java @@ -38,13 +38,13 @@ public class AssertOnColumnType_IsUUID_Test extends AbstractTest { @Test @NeedReload public void test_is_UUID() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var15 = '0E2A1269-EFF0-4233-B87B-B53E8B6F164D' where var1 = 1"); update( "insert into test(var1, var2, var11, var10, var9, var3, var12, var8, var15) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30', '2B0D1BDD-909E-4362-BA10-C930BA82718D')"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); ChangeColumnAssert changeColumnAssert1 = assertThat(changes).change().column("var15"); ChangeColumnAssert changeColumnAssertReturn1 = changeColumnAssert1.isUUID(true); @@ -66,20 +66,20 @@ public void test_is_UUID() { @Test @NeedReload public void should_fail_because_value_have_different_type() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); update("update test set var15 = null where var1 = 1"); update( "insert into test(var1, var2, var11, var10, var9, var3, var12, var8, var15) values(5, true, FILE_READ('classpath:h2-logo-2.png'), '2014-05-24 09:46:30', '2014-05-24', 3, 'test', '09:46:30', null)"); changes.setEndPointNow(); - Table table = new Table(source, "test"); - Table table2 = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test"); + Table table2 = new Table(jdbcConnectionProvider, "test2"); try { assertThat(changes).change().column("var15").isUUID(false); fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + "[Column at index 14 (column name : VAR15) of Change at index 0 (on table : TEST and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " %n" + "to be of type%n" @@ -92,7 +92,7 @@ public void should_fail_because_value_have_different_type() { fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + "[Column at index 0 (column name : VAR1) of Change at index 1 (on table : TEST and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at start point:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnDataType_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnDataType_Test.java index 300b4bcb..f54e0a4b 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnDataType_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnDataType_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnDataType#isOnDataType(org.assertj.db.type.DataType)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnDataType_IsOnDataType_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnDataType_IsOnDataType_Test extends AbstractTest { @Test @NeedReload public void test_is_on_data_type() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -55,7 +56,7 @@ public void test_is_on_data_type() throws Exception { @Test @NeedReload public void should_fail_because_data_type_is_different() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -64,7 +65,7 @@ public void should_fail_because_data_type_is_different() throws Exception { assertThat(changes).change().isOnDataType(DataType.TABLE); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + "to be on data type%n" + "
    %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnRequest_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnRequest_Test.java index ae68b6e2..2307acf1 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnRequest_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnRequest_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnDataType#isOnRequest()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnDataType_IsOnRequest_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnDataType_IsOnRequest_Test extends AbstractTest { @Test @NeedReload public void test_is_on_request() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -54,7 +55,7 @@ public void test_is_on_request() throws Exception { @Test @NeedReload public void should_fail_because_data_type_is_different() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void should_fail_because_data_type_is_different() throws Exception { assertThat(changes).change().isOnRequest(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + "to be on data type%n" + " %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnTable_Name_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnTable_Name_Test.java index 5cb2a755..fe9260ea 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnTable_Name_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnTable_Name_Test.java @@ -12,9 +12,6 @@ */ package org.assertj.db.api.assertions; -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeAssert; import org.assertj.db.common.AbstractTest; @@ -24,11 +21,15 @@ import org.assertj.db.type.Table; import org.junit.Test; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + /** * Tests on {@link org.assertj.db.api.assertions.AssertOnDataType} class : * {@link org.assertj.db.api.assertions.AssertOnDataType#isOnTable(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnDataType_IsOnTable_Name_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnDataType_IsOnTable_Name_Test extends AbstractTest { @Test @NeedReload public void test_is_on_table() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -54,7 +55,7 @@ public void test_is_on_table() throws Exception { @Test @NeedReload public void should_fail_because_data_type_is_different() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void should_fail_because_data_type_is_different() throws Exception { assertThat(changes).change().isOnTable("actor"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + "to be on data type%n" + "
    %n" @@ -78,7 +79,7 @@ public void should_fail_because_data_type_is_different() throws Exception { @Test @NeedReload public void should_fail_because_table_name_is_different() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -87,7 +88,7 @@ public void should_fail_because_table_name_is_different() throws Exception { assertThat(changes).change().isOnTable("movie"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting to be on the table:%n" + " <\"movie\">%n" + "but was on the table:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnTable_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnTable_Test.java index b42898c0..c1bcba49 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnTable_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnDataType_IsOnTable_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnDataType#isOnTable()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnDataType_IsOnTable_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnDataType_IsOnTable_Test extends AbstractTest { @Test @NeedReload public void test_is_on_table() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -54,7 +55,7 @@ public void test_is_on_table() throws Exception { @Test @NeedReload public void should_fail_because_data_type_is_different() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void should_fail_because_data_type_is_different() throws Exception { assertThat(changes).change().isOnTable(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + "to be on data type%n" + "
    %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnExistence_DoesNotExist_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnExistence_DoesNotExist_Test.java index 2b8b1c98..a03dadef 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnExistence_DoesNotExist_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnExistence_DoesNotExist_Test.java @@ -36,7 +36,7 @@ public class AssertOnExistence_DoesNotExist_Test extends AbstractTest { @Test @NeedReload public void test_table_does_not_exist() { - Table table = new Table(source, "not-exist-test"); + Table table = new Table(jdbcConnectionProvider, "not-exist-test"); TableAssert tableAssert = assertThat(table); TableAssert tableAssertExistReturn = tableAssert.doesNotExist(); Assertions.assertThat(tableAssert).isSameAs(tableAssertExistReturn); @@ -48,7 +48,7 @@ public void test_table_does_not_exist() { @Test @NeedReload public void should_fail_because_table_exist() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); try { assertThat(table).doesNotExist(); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnExistence_Exists_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnExistence_Exists_Test.java index 42fa7ead..2260b6be 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnExistence_Exists_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnExistence_Exists_Test.java @@ -36,7 +36,7 @@ public class AssertOnExistence_Exists_Test extends AbstractTest { @Test @NeedReload public void test_table_exists() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableAssert tableAssert = assertThat(table); TableAssert tableAssertExistReturn = tableAssert.exists(); Assertions.assertThat(tableAssert).isSameAs(tableAssertExistReturn); @@ -48,7 +48,7 @@ public void test_table_exists() { @Test @NeedReload public void should_fail_because_table_not_exist() { - Table table = new Table(source, "not-exist-test"); + Table table = new Table(jdbcConnectionProvider, "not-exist-test"); try { assertThat(table).exists(); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumn_IsModified_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumn_IsModified_Test.java index d9dd743c..44ede8e8 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumn_IsModified_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumn_IsModified_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnModifiedColumn#isModified()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnModifiedColumn_IsModified_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnModifiedColumn_IsModified_Test extends AbstractTest { @Test @NeedReload public void test_is_modified() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_is_modified() { @Test @NeedReload public void should_fail_because_column_is_not_modified() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_column_is_not_modified() { assertThat(changes).change(3).column().isModified(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : ID) of Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : ID) of Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " <1>%n" + "is modified but is still:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumn_IsNotModified_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumn_IsNotModified_Test.java index 6883bb31..bb56e7ce 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumn_IsNotModified_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumn_IsNotModified_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnModifiedColumn#isNotModified()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnModifiedColumn_IsNotModified_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnModifiedColumn_IsNotModified_Test extends AbstractTest { @Test @NeedReload public void test_is_not_modified() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_is_not_modified() { @Test @NeedReload public void should_fail_because_column_is_modified() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_column_is_modified() { assertThat(changes).change().column().isNotModified(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " %n" + "is not modified but is :%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasModifiedColumns_Integer_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasModifiedColumns_Integer_Test.java index 6b91bc06..c23be81e 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasModifiedColumns_Integer_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasModifiedColumns_Integer_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnModifiedColumns#hasModifiedColumns(Integer...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnModifiedColumns_HasModifiedColumns_Integer_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnModifiedColumns_HasModifiedColumns_Integer_Test extends Abs @Test @NeedReload public void test_has_modified_columns() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_has_modified_columns() throws Exception { @Test @NeedReload public void should_fail_because_modified_columns_are_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_modified_columns_are_different() throws Exceptio assertThat(changes).change(3).hasModifiedColumns(1); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " [1]%n" + "as indexes of modified columns but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasModifiedColumns_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasModifiedColumns_String_Test.java index 697039f7..7acb7bd1 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasModifiedColumns_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasModifiedColumns_String_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnModifiedColumns(String...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnModifiedColumns_HasModifiedColumns_String_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnModifiedColumns_HasModifiedColumns_String_Test extends Abst @Test @NeedReload public void test_has_modified_columns() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_has_modified_columns() throws Exception { @Test @NeedReload public void should_fail_because_modified_columns_are_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_modified_columns_are_different() throws Exceptio assertThat(changes).change(3).hasModifiedColumns("ID"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " [\"ID\"]%n" + "as modified columns but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThanOrEqualTo_Test.java index 065c1f0d..e6e24dba 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThanOrEqualTo_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnModifiedColumns#hasNumberOfModifiedColumnsGreaterThanOrEqualTo(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThanOrEqualTo_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThanOrEqua @Test @NeedReload public void test_has_number_of_modified_columns_greater_than_or_equal_to() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_has_number_of_modified_columns_greater_than_or_equal_to() throw @Test @NeedReload public void should_fail_because_number_of_modified_columns_is_less() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_number_of_modified_columns_is_less() throws Exce assertThat(changes).change(3).hasNumberOfModifiedColumnsGreaterThanOrEqualTo(2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " number of modifications is greater than or equal to 2%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThan_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThan_Test.java index 660899b0..7e9ef9af 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThan_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThan_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnModifiedColumns#hasNumberOfModifiedColumnsGreaterThan(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThan_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnModifiedColumns_HasNumberOfModifiedColumnsGreaterThan_Test @Test @NeedReload public void test_has_number_of_modified_columns_greater_than() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_has_number_of_modified_columns_greater_than() throws Exception @Test @NeedReload public void should_fail_because_number_of_modified_columns_is_less_or_equal() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_number_of_modified_columns_is_less_or_equal() th assertThat(changes).change(3).hasNumberOfModifiedColumnsGreaterThan(1); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " number of modifications is greater than 1%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThanOrEqualTo_Test.java index 0086442c..fc2f954f 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThanOrEqualTo_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnModifiedColumns#hasNumberOfModifiedColumnsLessThanOrEqualTo(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThanOrEqualTo_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThanOrEqualTo @Test @NeedReload public void test_has_number_of_modified_columns_less_than_or_equal_to() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_has_number_of_modified_columns_less_than_or_equal_to() throws E @Test @NeedReload public void should_fail_because_number_of_modified_columns_is_greater() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_number_of_modified_columns_is_greater() throws E assertThat(changes).change(3).hasNumberOfModifiedColumnsLessThanOrEqualTo(0); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " number of modifications is less than or equal to 0%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThan_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThan_Test.java index a285a6ef..952d2122 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThan_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThan_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnModifiedColumns#hasNumberOfModifiedColumnsLessThan(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThan_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnModifiedColumns_HasNumberOfModifiedColumnsLessThan_Test ext @Test @NeedReload public void test_has_number_of_modified_columns_less_than() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_has_number_of_modified_columns_less_than() throws Exception { @Test @NeedReload public void should_fail_because_number_of_modified_columns_is_greater_or_equal() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_number_of_modified_columns_is_greater_or_equal() assertThat(changes).change(3).hasNumberOfModifiedColumnsLessThan(1); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " number of modifications is less than 1%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumns_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumns_Test.java index f902b90f..54ab0e04 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumns_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnModifiedColumns_HasNumberOfModifiedColumns_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnModifiedColumns#hasNumberOfModifiedColumns(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnModifiedColumns_HasNumberOfModifiedColumns_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnModifiedColumns_HasNumberOfModifiedColumns_Test extends Abs @Test @NeedReload public void test_has_number_of_modified_columns() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_has_number_of_modified_columns() throws Exception { @Test @NeedReload public void should_fail_because_number_of_modified_columns_is_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_number_of_modified_columns_is_different() throws assertThat(changes).change(3).hasNumberOfModifiedColumns(2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " 2 modifications%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesGreaterThanOrEqualTo_Test.java index 78c3e623..7d1f467f 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesGreaterThanOrEqualTo_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfChanges#hasNumberOfChangesGreaterThanOrEqualTo(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfChanges_HasNumberOfChangesGreaterThanOrEqualTo_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnNumberOfChanges_HasNumberOfChangesGreaterThanOrEqualTo_Test @Test @NeedReload public void test_has_number_of_changes_greater_than_or_equal_to() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -54,7 +55,7 @@ public void test_has_number_of_changes_greater_than_or_equal_to() throws Excepti @Test @NeedReload public void should_fail_because_number_of_changes_is_less() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void should_fail_because_number_of_changes_is_less() throws Exception { assertThat(changes).hasNumberOfChangesGreaterThanOrEqualTo(9); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of changes) to be greater than or equal to :%n" + " <9>%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesGreaterThan_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesGreaterThan_Test.java index f66b834c..455ca024 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesGreaterThan_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesGreaterThan_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfChanges#hasNumberOfChangesGreaterThan(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfChanges_HasNumberOfChangesGreaterThan_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnNumberOfChanges_HasNumberOfChangesGreaterThan_Test extends @Test @NeedReload public void test_has_number_of_changes_greater_than() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -54,7 +55,7 @@ public void test_has_number_of_changes_greater_than() throws Exception { @Test @NeedReload public void should_fail_because_number_of_changes_is_less_or_equal() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void should_fail_because_number_of_changes_is_less_or_equal() throws Exce assertThat(changes).hasNumberOfChangesGreaterThan(4); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of changes) to be greater than :%n" + " <4>%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesLessThanOrEqualTo_Test.java index 7e72be01..413f80b8 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesLessThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesLessThanOrEqualTo_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfChanges#hasNumberOfChangesLessThanOrEqualTo(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfChanges_HasNumberOfChangesLessThanOrEqualTo_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnNumberOfChanges_HasNumberOfChangesLessThanOrEqualTo_Test ex @Test @NeedReload public void test_has_number_of_changes_greater_than_or_equal_to() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -54,7 +55,7 @@ public void test_has_number_of_changes_greater_than_or_equal_to() throws Excepti @Test @NeedReload public void should_fail_because_number_of_changes_is_greater() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void should_fail_because_number_of_changes_is_greater() throws Exception assertThat(changes).hasNumberOfChangesLessThanOrEqualTo(2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of changes) to be less than or equal to :%n" + " <2>%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesLessThan_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesLessThan_Test.java index ca8bfef4..3388ff65 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesLessThan_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChangesLessThan_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfChanges#hasNumberOfChangesLessThan(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfChanges_HasNumberOfChangesLessThan_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnNumberOfChanges_HasNumberOfChangesLessThan_Test extends Abs @Test @NeedReload public void test_has_number_of_changes_greater_than() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -54,7 +55,7 @@ public void test_has_number_of_changes_greater_than() throws Exception { @Test @NeedReload public void should_fail_because_number_of_changes_is_greater_or_equal() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void should_fail_because_number_of_changes_is_greater_or_equal() throws E assertThat(changes).hasNumberOfChangesLessThan(2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of changes) to be less than :%n" + " <2>%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChanges_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChanges_Test.java index def35ac6..5ec3713e 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChanges_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfChanges_HasNumberOfChanges_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfChanges#hasNumberOfChanges(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfChanges_HasNumberOfChanges_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnNumberOfChanges_HasNumberOfChanges_Test extends AbstractTes @Test @NeedReload public void test_has_number_of_changes() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -56,7 +57,7 @@ public void test_has_number_of_changes() throws Exception { @Test @NeedReload public void should_fail_because_number_of_changes_is_different() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -65,7 +66,7 @@ public void should_fail_because_number_of_changes_is_different() throws Exceptio assertThat(changes).hasNumberOfChanges(9); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of changes) to be equal to :%n" + " <9>%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThanOrEqualTo_Test.java index d2d495d2..31c353a8 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThanOrEqualTo_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfColumns#hasNumberOfColumnsGreaterThanOrEqualTo(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThanOrEqualTo_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThanOrEqualTo_Test @Test @NeedReload public void test_has_number_of_columns() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -69,7 +70,7 @@ public void test_has_number_of_columns() { @Test @NeedReload public void should_fail_because_number_of_columns_is_greater() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -78,7 +79,7 @@ public void should_fail_because_number_of_columns_is_greater() { assertThat(changes).change().hasNumberOfColumnsGreaterThanOrEqualTo(6); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of columns) to be greater than or equal to :%n" + " <6>%n" + "but was:%n" @@ -88,7 +89,7 @@ public void should_fail_because_number_of_columns_is_greater() { assertThat(changes).change().rowAtEndPoint().hasNumberOfColumnsGreaterThanOrEqualTo(6); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of columns) to be greater than or equal to :%n" + " <6>%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThan_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThan_Test.java index d93b8201..d89e1a12 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThan_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThan_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfColumns#hasNumberOfColumnsGreaterThan(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThan_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnNumberOfColumns_HasNumberOfColumnsGreaterThan_Test extends @Test @NeedReload public void test_has_number_of_columns() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -69,7 +70,7 @@ public void test_has_number_of_columns() { @Test @NeedReload public void should_fail_because_number_of_columns_is_different() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -78,7 +79,7 @@ public void should_fail_because_number_of_columns_is_different() { assertThat(changes).change().hasNumberOfColumnsGreaterThan(9); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of columns) to be greater than :%n" + " <9>%n" + "but was:%n" @@ -88,7 +89,7 @@ public void should_fail_because_number_of_columns_is_different() { assertThat(changes).change().rowAtEndPoint().hasNumberOfColumnsGreaterThan(9); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of columns) to be greater than :%n" + " <9>%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsLessThanOrEqualTo_Test.java index df96b2ea..f18270f7 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsLessThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsLessThanOrEqualTo_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfColumns#hasNumberOfColumnsLessThanOrEqualTo(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfColumns_HasNumberOfColumnsLessThanOrEqualTo_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnNumberOfColumns_HasNumberOfColumnsLessThanOrEqualTo_Test ex @Test @NeedReload public void test_has_number_of_columns_less_than_or_equal() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -69,7 +70,7 @@ public void test_has_number_of_columns_less_than_or_equal() { @Test @NeedReload public void should_fail_because_number_of_columns_is_less() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -78,7 +79,7 @@ public void should_fail_because_number_of_columns_is_less() { assertThat(changes).change().hasNumberOfColumnsLessThanOrEqualTo(4); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of columns) to be less than or equal to :%n" + " <4>%n" + "but was:%n" @@ -88,7 +89,7 @@ public void should_fail_because_number_of_columns_is_less() { assertThat(changes).change().rowAtEndPoint().hasNumberOfColumnsLessThanOrEqualTo(4); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of columns) to be less than or equal to :%n" + " <4>%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsLessThan_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsLessThan_Test.java index ace13f09..60a360f8 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsLessThan_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumnsLessThan_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfColumns#hasNumberOfColumnsLessThan(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfColumns_HasNumberOfColumnsLessThan_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnNumberOfColumns_HasNumberOfColumnsLessThan_Test extends Abs @Test @NeedReload public void test_has_number_of_columns_less_than() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -69,7 +70,7 @@ public void test_has_number_of_columns_less_than() { @Test @NeedReload public void should_fail_because_number_of_columns_is_greater_or_equal() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -78,7 +79,7 @@ public void should_fail_because_number_of_columns_is_greater_or_equal() { assertThat(changes).change().hasNumberOfColumnsLessThan(5); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of columns) to be less than :%n" + " <5>%n" + "but was:%n" @@ -88,7 +89,7 @@ public void should_fail_because_number_of_columns_is_greater_or_equal() { assertThat(changes).change().rowAtEndPoint().hasNumberOfColumnsLessThan(4); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of columns) to be less than :%n" + " <4>%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumns_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumns_Test.java index 2ce8c180..2faca76c 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumns_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfColumns_HasNumberOfColumns_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfColumns#hasNumberOfColumns(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfColumns_HasNumberOfColumns_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnNumberOfColumns_HasNumberOfColumns_Test extends AbstractTes @Test @NeedReload public void test_has_number_of_columns() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -69,7 +70,7 @@ public void test_has_number_of_columns() { @Test @NeedReload public void should_fail_because_number_of_columns_is_different() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); Changes changes = new Changes(request).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -78,7 +79,7 @@ public void should_fail_because_number_of_columns_is_different() { assertThat(changes).change().hasNumberOfColumns(9); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of columns) to be equal to :%n" + " <9>%n" + "but was:%n" @@ -88,7 +89,7 @@ public void should_fail_because_number_of_columns_is_different() { assertThat(changes).change().rowAtEndPoint().hasNumberOfColumns(9); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'] %n" + "Expecting size (number of columns) to be equal to :%n" + " <9>%n" + "but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsGreaterThanOrEqualTo_Test.java index a4fd5c97..6e0b2c9a 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsGreaterThanOrEqualTo_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfRows#hasNumberOfRowsGreaterThanOrEqualTo(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfRows_HasNumberOfRowsGreaterThanOrEqualTo_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnNumberOfRows_HasNumberOfRowsGreaterThanOrEqualTo_Test exten */ @Test public void test_has_number_of_rows_greater_than_or_equal_to() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableAssert tableAssert2 = tableAssert.hasNumberOfRowsGreaterThanOrEqualTo(3); Assertions.assertThat(tableAssert).isSameAs(tableAssert2); @@ -50,7 +51,7 @@ public void test_has_number_of_rows_greater_than_or_equal_to() { */ @Test public void should_fail_because_number_of_rows_is_less() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); try { assertThat(request).hasNumberOfRowsGreaterThanOrEqualTo(9); fail("An exception must be raised"); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsGreaterThan_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsGreaterThan_Test.java index fb6b4563..a1398277 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsGreaterThan_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsGreaterThan_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfRows#hasNumberOfRowsGreaterThan(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfRows_HasNumberOfRowsGreaterThan_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnNumberOfRows_HasNumberOfRowsGreaterThan_Test extends Abstra */ @Test public void test_has_number_of_rows_greater_than() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableAssert tableAssert2 = tableAssert.hasNumberOfRowsGreaterThan(2); Assertions.assertThat(tableAssert).isSameAs(tableAssert2); @@ -50,7 +51,7 @@ public void test_has_number_of_rows_greater_than() { */ @Test public void should_fail_because_number_of_rows_is_less_or_equal() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); try { assertThat(request).hasNumberOfRowsGreaterThan(9); fail("An exception must be raised"); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsLessThanOrEqualTo_Test.java index 29c51993..148c8cbe 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsLessThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsLessThanOrEqualTo_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfRows#hasNumberOfRowsLessThanOrEqualTo(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfRows_HasNumberOfRowsLessThanOrEqualTo_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnNumberOfRows_HasNumberOfRowsLessThanOrEqualTo_Test extends */ @Test public void test_has_number_of_rows_less_than_or_equal_to() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableAssert tableAssert2 = tableAssert.hasNumberOfRowsLessThanOrEqualTo(3); Assertions.assertThat(tableAssert).isSameAs(tableAssert2); @@ -50,7 +51,7 @@ public void test_has_number_of_rows_less_than_or_equal_to() { */ @Test public void should_fail_because_number_of_rows_is_greater() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); try { assertThat(request).hasNumberOfRowsLessThanOrEqualTo(2); fail("An exception must be raised"); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsLessThan_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsLessThan_Test.java index aae43606..4669ee4e 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsLessThan_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRowsLessThan_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfRows#hasNumberOfRowsLessThan(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfRows_HasNumberOfRowsLessThan_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnNumberOfRows_HasNumberOfRowsLessThan_Test extends AbstractT */ @Test public void test_has_number_of_rows_less_than() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableAssert tableAssert2 = tableAssert.hasNumberOfRowsLessThan(4); Assertions.assertThat(tableAssert).isSameAs(tableAssert2); @@ -50,7 +51,7 @@ public void test_has_number_of_rows_less_than() { */ @Test public void should_fail_because_number_of_rows_is_greater_or_equal() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); try { assertThat(request).hasNumberOfRowsLessThan(2); fail("An exception must be raised"); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRows_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRows_Test.java index aec45441..76cdf01a 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRows_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_HasNumberOfRows_Test.java @@ -28,6 +28,7 @@ * {@link org.assertj.db.api.assertions.AssertOnNumberOfRows#hasNumberOfRows(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnNumberOfRows_HasNumberOfRows_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnNumberOfRows_HasNumberOfRows_Test extends AbstractTest { */ @Test public void test_has_number_of_rows() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableAssert tableAssert2 = tableAssert.hasNumberOfRows(3); Assertions.assertThat(tableAssert).isSameAs(tableAssert2); @@ -50,7 +51,7 @@ public void test_has_number_of_rows() { */ @Test public void should_fail_because_number_of_rows_is_different() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); try { assertThat(request).hasNumberOfRows(9); fail("An exception must be raised"); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_IsEmpty_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_IsEmpty_Test.java index f9752ca0..f9a3e927 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_IsEmpty_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnNumberOfRows_IsEmpty_Test.java @@ -37,7 +37,7 @@ public class AssertOnNumberOfRows_IsEmpty_Test extends AbstractTest { @Test public void test_is_empty() { update("delete from test"); - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableAssert tableAssert = assertThat(table); TableAssert tableAssert2 = tableAssert.isEmpty(); Assertions.assertThat(tableAssert).isSameAs(tableAssert2); @@ -51,7 +51,7 @@ public void test_is_empty() { */ @Test public void should_fail_because_table_is_not_empty() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); try { assertThat(request).isEmpty(); fail("An exception must be raised"); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnPrimaryKey_HasPksNames_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnPrimaryKey_HasPksNames_Test.java index 06e8a4b2..6292ab5f 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnPrimaryKey_HasPksNames_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnPrimaryKey_HasPksNames_Test.java @@ -27,6 +27,7 @@ * {@link org.assertj.db.api.assertions.AssertOnPrimaryKey#hasPksNames(String...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnPrimaryKey_HasPksNames_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnPrimaryKey_HasPksNames_Test extends AbstractTest { @Test @NeedReload public void test_has_pks_names() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_has_pks_names() throws Exception { @Test @NeedReload public void should_fail_because_pks_names_are_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_pks_names_are_different() throws Exception { assertThat(changes).change().hasPksNames("ID2"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " [\"ID2\"]%n" + "to be the name of the columns of the primary keys but was:%n" @@ -73,7 +74,7 @@ public void should_fail_because_pks_names_are_different() throws Exception { @Test @NeedReload public void should_fail_because_number_of_pks_names_are_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -81,7 +82,7 @@ public void should_fail_because_number_of_pks_names_are_different() throws Excep assertThat(changes).change().hasPksNames("ID", "ID2"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " [\"ID\", \"ID2\"]%n" + "to be the name of the columns of the primary keys but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnPrimaryKey_HasPksValues_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnPrimaryKey_HasPksValues_Test.java index c3b19419..049b9c90 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnPrimaryKey_HasPksValues_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnPrimaryKey_HasPksValues_Test.java @@ -12,9 +12,6 @@ */ package org.assertj.db.api.assertions; -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeAssert; import org.assertj.db.common.AbstractTest; @@ -22,11 +19,15 @@ import org.assertj.db.type.Changes; import org.junit.Test; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + /** * Tests on {@link org.assertj.db.api.assertions.AssertOnPrimaryKey} class : * {@link org.assertj.db.api.assertions.AssertOnPrimaryKey#hasPksValues(Object...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnPrimaryKey_HasPksValues_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class AssertOnPrimaryKey_HasPksValues_Test extends AbstractTest { @Test @NeedReload public void test_has_pks_values() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -51,7 +52,7 @@ public void test_has_pks_values() throws Exception { @Test @NeedReload public void should_fail_because_pks_values_are_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void should_fail_because_pks_values_are_different() throws Exception { assertThat(changes).change().hasPksValues(5); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " [5]%n" + "to be the values of the columns of the primary keys but was:%n" @@ -73,7 +74,7 @@ public void should_fail_because_pks_values_are_different() throws Exception { @Test @NeedReload public void should_fail_because_number_of_pks_values_are_different() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -81,7 +82,7 @@ public void should_fail_because_number_of_pks_values_are_different() throws Exce assertThat(changes).change().hasPksValues(4, "ID2"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting :%n" + " [4, \"ID2\"]%n" + "to be the values of the columns of the primary keys but was:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnRowCondition_HasValuesSatisfying_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnRowCondition_HasValuesSatisfying_Test.java index 5dc3b4a9..16cdc3e4 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnRowCondition_HasValuesSatisfying_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnRowCondition_HasValuesSatisfying_Test.java @@ -42,7 +42,7 @@ public class AssertOnRowCondition_HasValuesSatisfying_Test extends AbstractTest @Test @NeedReload public void test_has_values() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -90,7 +90,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_values_are_different() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -106,7 +106,7 @@ public void should_fail_because_values_are_different() { ); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Row at end point of Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source] %n" + "[Row at end point of Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at index 2:%n" + " \"Bill\"%n" + "to satisfy: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnRowEquality_HasValues_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnRowEquality_HasValues_Test.java index dc37ea4f..63a6dc52 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnRowEquality_HasValues_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnRowEquality_HasValues_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnRowEquality#hasValues(Object...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnRowEquality_HasValues_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnRowEquality_HasValues_Test extends AbstractTest { @Test @NeedReload public void test_has_values() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -62,7 +63,7 @@ public void test_has_values() { @Test @NeedReload public void should_fail_because_values_are_different() { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Changes changes = new Changes(table).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -70,7 +71,7 @@ public void should_fail_because_values_are_different() { try { assertThat(changes).change().rowAtEndPoint().hasValues(4, "Murray", "Billy", "1950-09-21", UUID.fromString("30B443AE-C0C9-4790-9BEC-CE1380808435")); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting that the value at index 2:%n" + " <\"Bill\">%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnRowNullity_HasOnlyNotNullValues_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnRowNullity_HasOnlyNotNullValues_Test.java index 8d9418be..13b1343e 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnRowNullity_HasOnlyNotNullValues_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnRowNullity_HasOnlyNotNullValues_Test.java @@ -32,7 +32,7 @@ public class AssertOnRowNullity_HasOnlyNotNullValues_Test extends AbstractTest { */ @Test public void test_has_only_not_null_values() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); TableRowAssert tableRowAssert = assertThat(table).row(); TableRowAssert tableRowAssert2 = tableRowAssert.hasOnlyNotNullValues(); Assertions.assertThat(tableRowAssert).isSameAs(tableRowAssert2); @@ -43,7 +43,7 @@ public void test_has_only_not_null_values() { */ @Test public void should_fail_because_row_has_null_value() throws Exception { - Table table = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test2"); TableRowAssert tableRowAssert = assertThat(table).row().row(); try { tableRowAssert.hasOnlyNotNullValues(); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnRowOfChangeExistence_DoesNotExist_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnRowOfChangeExistence_DoesNotExist_Test.java index 341399db..e90fa6a6 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnRowOfChangeExistence_DoesNotExist_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnRowOfChangeExistence_DoesNotExist_Test.java @@ -26,6 +26,7 @@ * {@link org.assertj.db.api.assertions.AssertOnRowOfChangeExistence#doesNotExist()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnRowOfChangeExistence_DoesNotExist_Test extends AbstractTest { @@ -35,7 +36,7 @@ public class AssertOnRowOfChangeExistence_DoesNotExist_Test extends AbstractTest @Test @NeedReload public void test_does_not_exists() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -50,14 +51,14 @@ public void test_does_not_exists() throws Exception { @Test @NeedReload public void should_fail_because_row_exists() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); try { assertThat(changes).change().rowAtEndPoint().doesNotExist(); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting not exist but exists")); } } diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnRowOfChangeExistence_Exists_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnRowOfChangeExistence_Exists_Test.java index f14aad04..d76ee90a 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnRowOfChangeExistence_Exists_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnRowOfChangeExistence_Exists_Test.java @@ -26,6 +26,7 @@ * {@link org.assertj.db.api.assertions.AssertOnRowOfChangeExistence#exists()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnRowOfChangeExistence_Exists_Test extends AbstractTest { @@ -35,7 +36,7 @@ public class AssertOnRowOfChangeExistence_Exists_Test extends AbstractTest { @Test @NeedReload public void test_exists() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -50,14 +51,14 @@ public void test_exists() throws Exception { @Test @NeedReload public void should_fail_because_row_does_not_exist() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); try { assertThat(changes).change().rowAtStartPoint().exists(); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at start point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Row at start point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test'] %n" + "Expecting exist but do not exist")); } } diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_DateTimeValue_Test.java index d6320924..68b7dc6c 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_DateTimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isAfterOrEqualTo(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsAfterOrEqualTo_DateTimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsAfterOrEqualTo_DateTimeValue_Test extends @Test @NeedReload public void test_is_after_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void test_is_after_or_equal_to() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_before() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -73,7 +74,7 @@ public void should_fail_because_value_is_before() throws ParseException { DateTimeValue.parse("2014-05-24T09:46:31")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be after or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_DateValue_Test.java index 41cb9189..909e154b 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_DateValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isAfterOrEqualTo(org.assertj.db.type.DateValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsAfterOrEqualTo_DateValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsAfterOrEqualTo_DateValue_Test extends Abs @Test @NeedReload public void test_is_after_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void test_is_after_or_equal_to() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_before() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -72,7 +73,7 @@ public void should_fail_because_value_is_before() throws ParseException { assertThat(changes).change().column("var10").valueAtEndPoint().isAfterOrEqualTo(DateValue.parse("2014-05-25")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be after or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalDateTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalDateTime_Test.java index c9ccb311..63dedeb3 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalDateTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalDateTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsAfterOrEqualTo_LocalDateTime_Test extends @Test @NeedReload public void test_is_after_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_after_or_equal_to() { @Test @NeedReload public void should_fail_because_value_is_before() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_before() { assertThat(changes).change().column("var10").valueAtEndPoint().isAfterOrEqualTo(LocalDateTime.of(2014, 5, 24, 9, 46, 31)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be after or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalDate_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalDate_Test.java index b4068fe9..099bc8f8 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalDate_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalDate_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsAfterOrEqualTo_LocalDate_Test extends Abs @Test @NeedReload public void test_is_after_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_after_or_equal_to() { @Test @NeedReload public void should_fail_because_value_is_before() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_before() { assertThat(changes).change().column("var10").valueAtEndPoint().isAfterOrEqualTo(LocalDate.of(2014, 5, 25)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be after or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalTime_Test.java index 9e27a4fe..04af4ae3 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_LocalTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsAfterOrEqualTo_LocalTime_Test extends Abs @Test @NeedReload public void test_is_after_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_after_or_equal_to() { @Test @NeedReload public void should_fail_because_value_is_before() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_before() { assertThat(changes).change().column("var8").valueAtEndPoint().isAfterOrEqualTo(LocalTime.of(9, 46, 31)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be after or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_String_Test.java index 508ebe6c..9c60dca2 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_String_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isAfterOrEqualTo(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsAfterOrEqualTo_String_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueChronology_IsAfterOrEqualTo_String_Test extends Abstra @Test @NeedReload public void test_is_after_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_after_or_equal_to() { @Test @NeedReload public void should_fail_because_value_is_before() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_before() { assertThat(changes).change().column("var10").valueAtEndPoint().isAfterOrEqualTo("2014-05-25"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be after or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_TimeValue_Test.java index 9c754458..6ee24bdb 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfterOrEqualTo_TimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isAfterOrEqualTo(org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsAfterOrEqualTo_TimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsAfterOrEqualTo_TimeValue_Test extends Abs @Test @NeedReload public void test_is_after_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void test_is_after_or_equal_to() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_before() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -72,7 +73,7 @@ public void should_fail_because_value_is_before() throws ParseException { assertThat(changes).change().column("var8").valueAtEndPoint().isAfterOrEqualTo(TimeValue.parse("09:46:31")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be after or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_DateTimeValue_Test.java index fc7dc21b..9fada804 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_DateTimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isAfter(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsAfter_DateTimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsAfter_DateTimeValue_Test extends Abstract @Test @NeedReload public void test_is_after() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void test_is_after() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_before_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -70,7 +71,7 @@ public void should_fail_because_value_is_before_or_equal_to() throws ParseExcept assertThat(changes).change().column("var10").valueAtEndPoint().isAfter(DateTimeValue.parse("2014-05-24T09:46:30")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be after %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_DateValue_Test.java index f7e3d1ba..67f12022 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_DateValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isAfter(org.assertj.db.type.DateValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsAfter_DateValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsAfter_DateValue_Test extends AbstractTest @Test @NeedReload public void test_is_after() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -62,7 +63,7 @@ public void test_is_after() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_before_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -71,7 +72,7 @@ public void should_fail_because_value_is_before_or_equal_to() throws ParseExcept assertThat(changes).change().column("var10").valueAtEndPoint().isAfter(DateValue.parse("2014-05-25")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be after %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalDateTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalDateTime_Test.java index 1d73a65d..50c76b8e 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalDateTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalDateTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsAfter_LocalDateTime_Test extends Abstract @Test @NeedReload public void test_is_after() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_after() { @Test @NeedReload public void should_fail_because_value_is_before_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_before_or_equal_to() { assertThat(changes).change().column("var10").valueAtEndPoint().isAfter(LocalDateTime.of(2014, 5, 24, 9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be after %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalDate_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalDate_Test.java index 09e9a9f3..58408a0d 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalDate_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalDate_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsAfter_LocalDate_Test extends AbstractTest @Test @NeedReload public void test_is_after() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_after() { @Test @NeedReload public void should_fail_because_value_is_before_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_before_or_equal_to() { assertThat(changes).change().column("var10").valueAtEndPoint().isAfter(LocalDate.of(2014, 5, 25)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be after %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalTime_Test.java index 54f60a52..e9d4f258 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_LocalTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsAfter_LocalTime_Test extends AbstractTest @Test @NeedReload public void test_is_after() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_after() { @Test @NeedReload public void should_fail_because_value_is_before_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_before_or_equal_to() { assertThat(changes).change().column("var8").valueAtEndPoint().isAfter(LocalTime.of(9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be after %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_String_Test.java index 7160cb78..3b084e6b 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_String_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isAfter(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsAfter_String_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueChronology_IsAfter_String_Test extends AbstractTest { @Test @NeedReload public void test_is_after() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_after() { @Test @NeedReload public void should_fail_because_value_is_before_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_before_or_equal_to() { assertThat(changes).change().column("var10").valueAtEndPoint().isAfter("2014-05-25"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be after %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_TimeValue_Test.java index aa3498fe..65a77924 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsAfter_TimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isAfter(org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsAfter_TimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsAfter_TimeValue_Test extends AbstractTest @Test @NeedReload public void test_is_after() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void test_is_after() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_before_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -70,7 +71,7 @@ public void should_fail_because_value_is_before_or_equal_to() throws ParseExcept assertThat(changes).change().column("var8").valueAtEndPoint().isAfter(TimeValue.parse("09:46:30")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be after %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_DateTimeValue_Test.java index a2751337..3acd718b 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_DateTimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isBeforeOrEqualTo(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsBeforeOrEqualTo_DateTimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsBeforeOrEqualTo_DateTimeValue_Test extend @Test @NeedReload public void test_is_before_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -62,7 +63,7 @@ public void test_is_before_or_equal_to() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_after() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -71,7 +72,7 @@ public void should_fail_because_value_is_after() throws ParseException { assertThat(changes).change().column("var10").valueAtEndPoint().isBeforeOrEqualTo(DateTimeValue.parse("2014-05-24T09:46:29")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be before or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_DateValue_Test.java index aedf5558..396dcff9 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_DateValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isBeforeOrEqualTo(org.assertj.db.type.DateValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsBeforeOrEqualTo_DateValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsBeforeOrEqualTo_DateValue_Test extends Ab @Test @NeedReload public void test_is_before_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void test_is_before_or_equal_to() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_after() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -72,7 +73,7 @@ public void should_fail_because_value_is_after() throws ParseException { assertThat(changes).change().column("var10").valueAtEndPoint().isBeforeOrEqualTo(DateValue.parse("2014-05-24")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be before or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalDateTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalDateTime_Test.java index 271d1783..c9d05b93 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalDateTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalDateTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsBeforeOrEqualTo_LocalDateTime_Test extend @Test @NeedReload public void test_is_before_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_before_or_equal_to() { @Test @NeedReload public void should_fail_because_value_is_after() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_after() { assertThat(changes).change().column("var10").valueAtEndPoint().isBeforeOrEqualTo(LocalDateTime.of(2014, 5, 24, 9, 46, 29)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be before or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalDate_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalDate_Test.java index fe45307f..dc209045 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalDate_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalDate_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsBeforeOrEqualTo_LocalDate_Test extends Ab @Test @NeedReload public void test_is_before_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_before_or_equal_to() { @Test @NeedReload public void should_fail_because_value_is_after() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_after() { assertThat(changes).change().column("var10").valueAtEndPoint().isBeforeOrEqualTo(LocalDate.of(2014, 5, 24)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be before or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalTime_Test.java index 3b5f9e22..de667aed 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsBeforeOrEqualTo_LocalTime_Test extends Ab @Test @NeedReload public void test_is_before_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_before_or_equal_to() { @Test @NeedReload public void should_fail_because_value_is_after() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_after() { assertThat(changes).change().column("var8").valueAtEndPoint().isBeforeOrEqualTo(LocalTime.of(9, 46, 29)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be before or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_String_Test.java index c8492dc6..27045cc5 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_String_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isBeforeOrEqualTo(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsBeforeOrEqualTo_String_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueChronology_IsBeforeOrEqualTo_String_Test extends Abstr @Test @NeedReload public void test_is_before_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_before_or_equal_to() { @Test @NeedReload public void should_fail_because_value_is_after() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_after() { assertThat(changes).change().column("var10").valueAtEndPoint().isBeforeOrEqualTo("2014-05-24"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be before or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_TimeValue_Test.java index 1d3e2d44..78a7a45f 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_TimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isBeforeOrEqualTo(org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsBeforeOrEqualTo_TimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsBeforeOrEqualTo_TimeValue_Test extends Ab @Test @NeedReload public void test_is_before_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void test_is_before_or_equal_to() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_after() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -72,7 +73,7 @@ public void should_fail_because_value_is_after() throws ParseException { assertThat(changes).change().column("var8").valueAtEndPoint().isBeforeOrEqualTo(TimeValue.parse("09:46:29")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be before or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_DateTimeValue_Test.java index 840d67a3..dee9c3f0 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_DateTimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isBefore(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsBefore_DateTimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsBefore_DateTimeValue_Test extends Abstrac @Test @NeedReload public void test_is_before() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void test_is_before() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_after_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -73,7 +74,7 @@ public void should_fail_because_value_is_after_or_equal_to() throws ParseExcepti DateTimeValue.parse("2014-05-24T09:46:30")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be before %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_DateValue_Test.java index 57812d72..8dc6ec1d 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_DateValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isBefore(org.assertj.db.type.DateValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsBefore_DateValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsBefore_DateValue_Test extends AbstractTes @Test @NeedReload public void test_is_before() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -62,7 +63,7 @@ public void test_is_before() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_after_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -71,7 +72,7 @@ public void should_fail_because_value_is_after_or_equal_to() throws ParseExcepti assertThat(changes).change().column("var10").valueAtEndPoint().isBefore(DateValue.parse("2014-05-24")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be before %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalDateTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalDateTime_Test.java index ee80bc61..032bcd4d 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalDateTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalDateTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsBefore_LocalDateTime_Test extends Abstrac @Test @NeedReload public void test_is_before() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_before() { @Test @NeedReload public void should_fail_because_value_is_after_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_after_or_equal_to() { assertThat(changes).change().column("var10").valueAtEndPoint().isBefore(LocalDateTime.of(2014, 5, 24, 9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be before %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalDate_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalDate_Test.java index fcc5fd82..1a75cb7a 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalDate_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalDate_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsBefore_LocalDate_Test extends AbstractTes @Test @NeedReload public void test_is_before() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_before() { @Test @NeedReload public void should_fail_because_value_is_after_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_after_or_equal_to() { assertThat(changes).change().column("var10").valueAtEndPoint().isBefore(LocalDate.of(2014, 5, 24)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be before %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalTime_Test.java index 5f4bfa40..97afce5c 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_LocalTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueChronology_IsBefore_LocalTime_Test extends AbstractTes @Test @NeedReload public void test_is_before() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_before() { @Test @NeedReload public void should_fail_because_value_is_after_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_after_or_equal_to() { assertThat(changes).change().column("var8").valueAtEndPoint().isBefore(LocalTime.of(9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be before %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_String_Test.java index 70e34457..56f1d69d 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_String_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isBefore(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsBefore_String_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueChronology_IsBefore_String_Test extends AbstractTest { @Test @NeedReload public void test_is_before() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_before() { @Test @NeedReload public void should_fail_because_value_is_after_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_after_or_equal_to() { assertThat(changes).change().column("var10").valueAtEndPoint().isBefore("2014-05-24"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be before %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_TimeValue_Test.java index 1a00d7d5..baa7f6b7 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBefore_TimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isBefore(org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueChronology_IsBefore_TimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueChronology_IsBefore_TimeValue_Test extends AbstractTes @Test @NeedReload public void test_is_before() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void test_is_before() throws ParseException { @Test @NeedReload public void should_fail_because_value_is_after_or_equal_to() throws ParseException { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -70,7 +71,7 @@ public void should_fail_because_value_is_after_or_equal_to() throws ParseExcepti assertThat(changes).change().column("var8").valueAtEndPoint().isBefore(TimeValue.parse("09:46:30")); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be before %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueClass_IsOfClass_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueClass_IsOfClass_Test.java index f5d61c90..aaa71923 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueClass_IsOfClass_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueClass_IsOfClass_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueClass#isOfClass(Class)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueClass_IsOfClass_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueClass_IsOfClass_Test extends AbstractTest { @Test @NeedReload public void test_is_of_type() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_of_type() { @Test @NeedReload public void should_fail_because_value_is_not_of_type() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_of_type() { assertThat(changes).change().column("var1").valueAtEndPoint().isOfClass(Boolean.class); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <1>%n" + "to be of class%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateTimeValue_Test.java index c1e89d53..250d5b81 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateTimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueCloseness#isCloseTo(org.assertj.db.type.DateTimeValue, org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateTimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateTimeValue_Test e @Test @NeedReload public void test_is_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -64,7 +65,7 @@ public void test_is_close_to() { @Test @NeedReload public void should_fail_because_value_is_not_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -74,7 +75,7 @@ public void should_fail_because_value_is_not_close_to() { DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 31)), DateTimeValue.of(DateValue.of(0, 0, 0))); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be close to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateValue_Test.java index dd91b910..bdba0fde 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueCloseness#isCloseTo(org.assertj.db.type.DateTimeValue, org.assertj.db.type.DateValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueCloseness_IsCloseTo_DateTimeValue_DateValue_Test exten @Test @NeedReload public void test_is_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -64,7 +65,7 @@ public void test_is_close_to() { @Test @NeedReload public void should_fail_because_value_is_not_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -74,7 +75,7 @@ public void should_fail_because_value_is_not_close_to() { DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 31)), DateValue.of(0, 0, 0)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be close to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_TimeValue_Test.java index 6a12db9d..1411a3a4 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateTimeValue_TimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueCloseness#isCloseTo(org.assertj.db.type.DateTimeValue, org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueCloseness_IsCloseTo_DateTimeValue_TimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueCloseness_IsCloseTo_DateTimeValue_TimeValue_Test exten @Test @NeedReload public void test_is_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -64,7 +65,7 @@ public void test_is_close_to() { @Test @NeedReload public void should_fail_because_value_is_not_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -74,7 +75,7 @@ public void should_fail_because_value_is_not_close_to() { DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 31)), TimeValue.of(0, 0, 0, 1)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be close to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_DateTimeValue_Test.java index eab13dea..f3739bc4 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_DateTimeValue_Test.java @@ -31,6 +31,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueCloseness#isCloseTo(org.assertj.db.type.DateValue, org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueCloseness_IsCloseTo_DateValue_DateTimeValue_Test extends AbstractTest { @@ -40,7 +41,7 @@ public class AssertOnValueCloseness_IsCloseTo_DateValue_DateTimeValue_Test exten @Test @NeedReload public void test_is_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void test_is_close_to() { @Test @NeedReload public void should_fail_because_value_is_not_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -70,7 +71,7 @@ public void should_fail_because_value_is_not_close_to() { assertThat(changes).change().column("var9").valueAtEndPoint().isCloseTo(DateValue.of(2014, 5, 23), DateTimeValue.of(DateValue.of(0, 0, 0))); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24>%n" + "to be close to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_DateValue_Test.java index f7c95a9d..f8e1ece9 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_DateValue_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueCloseness#isCloseTo(org.assertj.db.type.DateValue, org.assertj.db.type.DateValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueCloseness_IsCloseTo_DateValue_DateValue_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueCloseness_IsCloseTo_DateValue_DateValue_Test extends A @Test @NeedReload public void test_is_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_close_to() { @Test @NeedReload public void should_fail_because_value_is_not_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_not_close_to() { assertThat(changes).change().column("var9").valueAtEndPoint().isCloseTo(DateValue.of(2014, 5, 23), DateValue.of(0, 0, 0)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24>%n" + "to be close to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_TimeValue_Test.java index 12fadb2b..044b71d5 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_DateValue_TimeValue_Test.java @@ -31,6 +31,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueCloseness#isCloseTo(org.assertj.db.type.DateValue, org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueCloseness_IsCloseTo_DateValue_TimeValue_Test extends AbstractTest { @@ -40,7 +41,7 @@ public class AssertOnValueCloseness_IsCloseTo_DateValue_TimeValue_Test extends A @Test @NeedReload public void test_is_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +61,7 @@ public void test_is_close_to() { @Test @NeedReload public void should_fail_because_value_is_not_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -70,7 +71,7 @@ public void should_fail_because_value_is_not_close_to() { .of(0, 1, 0)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24>%n" + "to be close to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_Number_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_Number_Test.java index 03f64d2e..3e4de844 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_Number_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_Number_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueCloseness#isCloseTo(Number, Number)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueCloseness_IsCloseTo_Number_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueCloseness_IsCloseTo_Number_Test extends AbstractTest { @Test @NeedReload public void test_is_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_close_to() { @Test @NeedReload public void should_fail_because_value_is_not_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_close_to() { assertThat(changes).change().column("var3").valueAtEndPoint().isCloseTo(3, 0.5); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2>%n" + "to be close to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_TimeValue_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_TimeValue_TimeValue_Test.java index a0b5a6f9..9b70bdbb 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_TimeValue_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCloseness_IsCloseTo_TimeValue_TimeValue_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueCloseness#isCloseTo(org.assertj.db.type.TimeValue, org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueCloseness_IsCloseTo_TimeValue_TimeValue_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueCloseness_IsCloseTo_TimeValue_TimeValue_Test extends A @Test @NeedReload public void test_is_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_close_to() { @Test @NeedReload public void should_fail_because_value_is_not_close_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +70,7 @@ public void should_fail_because_value_is_not_close_to() { fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + "[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be close to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsGreaterThanOrEqualTo_Test.java index 89a284ed..a1e7612d 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsGreaterThanOrEqualTo_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueComparison#isGreaterThanOrEqualTo(Number)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueComparison_IsGreaterThanOrEqualTo_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueComparison_IsGreaterThanOrEqualTo_Test extends Abstrac @Test @NeedReload public void test_is_greater_than_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_greater_than_or_equal_to() { @Test @NeedReload public void should_fail_because_value_is_less_than() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_less_than() { assertThat(changes).change().column("var3").valueAtEndPoint().isGreaterThanOrEqualTo(3); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2>%n" + "to be greater than or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsGreaterThan_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsGreaterThan_Test.java index 6e6812d8..c76b1c67 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsGreaterThan_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsGreaterThan_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueComparison#isGreaterThan(Number)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueComparison_IsGreaterThan_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueComparison_IsGreaterThan_Test extends AbstractTest { @Test @NeedReload public void test_is_less_than() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_less_than() { @Test @NeedReload public void should_fail_because_value_is_greater_than_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_greater_than_or_equal_to() { assertThat(changes).change().column("var3").valueAtEndPoint().isGreaterThan(2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2>%n" + "to be greater than %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsLessThanOrEqualTo_Test.java index 0f67f5e8..ddd01fda 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsLessThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsLessThanOrEqualTo_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueComparison#isLessThanOrEqualTo(Number)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueComparison_IsLessThanOrEqualTo_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueComparison_IsLessThanOrEqualTo_Test extends AbstractTe @Test @NeedReload public void test_is_less_than_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_less_than_or_equal_to() { @Test @NeedReload public void should_fail_because_value_is_greater_than() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_greater_than() { assertThat(changes).change().column("var3").valueAtEndPoint().isLessThanOrEqualTo(1); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2>%n" + "to be less than or equal to %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsLessThan_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsLessThan_Test.java index de5bff08..24e58102 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsLessThan_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueComparison_IsLessThan_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueComparison#isLessThan(Number)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueComparison_IsLessThan_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueComparison_IsLessThan_Test extends AbstractTest { @Test @NeedReload public void test_is_less_than() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_less_than() { @Test @NeedReload public void should_fail_because_value_is_greater_than_or_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_greater_than_or_equal_to() { assertThat(changes).change().column("var3").valueAtEndPoint().isLessThan(2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2>%n" + "to be less than %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_DoesNotHave_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_DoesNotHave_Test.java index 031300dd..44b8b430 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_DoesNotHave_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_DoesNotHave_Test.java @@ -46,7 +46,7 @@ public boolean matches(Byte value) { @Test @NeedReload public void test_does_not_have() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -66,7 +66,7 @@ public void test_does_not_have() { @Test @NeedReload public void should_fail_because_value_not_match_with_condition() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1000"); changes.setEndPointNow(); @@ -77,7 +77,7 @@ public void should_fail_because_value_not_match_with_condition() { } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( "[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1000]) of " - + "Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + + "Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting actual:%n" + " 0%n" + "not to be isZero")); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Has_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Has_Test.java index 12e4e905..7c2acfba 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Has_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Has_Test.java @@ -46,7 +46,7 @@ public boolean matches(Byte value) { @Test @NeedReload public void test_has() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1000"); changes.setEndPointNow(); @@ -66,7 +66,7 @@ public void test_has() { @Test @NeedReload public void should_fail_because_value_not_match_with_condition() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -77,7 +77,7 @@ public void should_fail_because_value_not_match_with_condition() { } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( "[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of " - + "Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + + "Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting actual:%n" + " 2%n" + "to be isZero")); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_IsNot_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_IsNot_Test.java index 340eb1a3..b9951e6b 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_IsNot_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_IsNot_Test.java @@ -46,7 +46,7 @@ public boolean matches(Byte value) { @Test @NeedReload public void test_is_not() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -66,7 +66,7 @@ public void test_is_not() { @Test @NeedReload public void should_fail_because_value_not_match_with_condition() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1000"); changes.setEndPointNow(); @@ -77,7 +77,7 @@ public void should_fail_because_value_not_match_with_condition() { } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( "[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1000]) of " - + "Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + + "Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting actual:%n" + " 0%n" + "not to be isZero")); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Is_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Is_Test.java index 2f4786e1..77722515 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Is_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Is_Test.java @@ -46,7 +46,7 @@ public boolean matches(Byte value) { @Test @NeedReload public void test_is() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1000"); changes.setEndPointNow(); @@ -66,7 +66,7 @@ public void test_is() { @Test @NeedReload public void should_fail_because_value_not_match_with_condition() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -77,7 +77,7 @@ public void should_fail_because_value_not_match_with_condition() { } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( "[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of " - + "Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + + "Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting actual:%n" + " 2%n" + "to be isZero")); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Satisfies_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Satisfies_Test.java index b7a31cb5..ddc1eab8 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Satisfies_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueCondition_Satisfies_Test.java @@ -46,7 +46,7 @@ public boolean matches(Byte value) { @Test @NeedReload public void test_satisfies() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1000"); changes.setEndPointNow(); @@ -66,7 +66,7 @@ public void test_satisfies() { @Test @NeedReload public void should_fail_because_value_not_match_with_condition() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -77,7 +77,7 @@ public void should_fail_because_value_not_match_with_condition() { } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( "[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of " - + "Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + + "Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting actual:%n" + " 2%n" + "to satisfy:%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Boolean_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Boolean_Test.java index 7d1659c1..576fa572 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Boolean_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Boolean_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isEqualTo(Boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsEqualTo_Boolean_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueEquality_IsEqualTo_Boolean_Test extends AbstractTest { @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 10"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_equal_to() { assertThat(changes).change().column("var2").valueAtEndPoint().isEqualTo(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : VAR2) of Change at index 0 (with primary key : [10]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : VAR2) of Change at index 0 (with primary key : [10]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Bytes_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Bytes_Test.java index 271edcd9..3c862cdd 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Bytes_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Bytes_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isEqualTo(byte[])} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsEqualTo_Bytes_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueEquality_IsEqualTo_Bytes_Test extends AbstractTest { public void test_is_equal_to() { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -70,7 +71,7 @@ public void should_fail_because_value_is_not_equal_to() { assertThat(changes).change().column("var11").valueAtEndPoint().isEqualTo(new byte[0]); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 10 (column name : VAR11) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 10 (column name : VAR11) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting to be equal to the expected value but was not equal")); } try { diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Character_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Character_Test.java index 11003d17..6ab020ff 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Character_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Character_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isEqualTo(Character)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsEqualTo_Character_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueEquality_IsEqualTo_Character_Test extends AbstractTest @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 10"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_equal_to() { assertThat(changes).change().column("var16").valueAtEndPoint().isEqualTo('t'); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 15 (column name : VAR16) of Change at index 0 (with primary key : [10]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 15 (column name : VAR16) of Change at index 0 (with primary key : [10]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <\"e\">%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_DateTimeValue_Test.java index 5c50f530..e2fd68ff 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_DateTimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isEqualTo(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsEqualTo_DateTimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueEquality_IsEqualTo_DateTimeValue_Test extends Abstract @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -62,7 +63,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -72,7 +73,7 @@ public void should_fail_because_value_is_not_equal_to() { DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 31))); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_DateValue_Test.java index 26636b2c..7d0b9c2d 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_DateValue_Test.java @@ -12,6 +12,9 @@ */ package org.assertj.db.api.assertions; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeColumnValueAssert; import org.assertj.db.api.TableColumnValueAssert; @@ -22,14 +25,12 @@ import org.assertj.db.type.Table; import org.junit.Test; -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - /** * Tests on {@link org.assertj.db.api.assertions.AssertOnValueEquality} class : * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isEqualTo(org.assertj.db.type.DateValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsEqualTo_DateValue_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueEquality_IsEqualTo_DateValue_Test extends AbstractTest @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_not_equal_to() { assertThat(changes).change().column("var9").valueAtEndPoint().isEqualTo(DateValue.of(2014, 5, 23)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24>%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalDateTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalDateTime_Test.java index a9d99854..a5564720 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalDateTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalDateTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueEquality_IsEqualTo_LocalDateTime_Test extends Abstract @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_not_equal_to() { assertThat(changes).change().column("var10").valueAtEndPoint().isEqualTo(LocalDateTime.of(2014, 5, 24, 9, 46, 31)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalDate_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalDate_Test.java index 9782936f..cd2692b4 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalDate_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalDate_Test.java @@ -12,6 +12,11 @@ */ package org.assertj.db.api.assertions; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + +import java.time.LocalDate; + import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeColumnValueAssert; import org.assertj.db.api.TableColumnValueAssert; @@ -21,11 +26,6 @@ import org.assertj.db.type.Table; import org.junit.Test; -import java.time.LocalDate; - -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - /** * Tests on {@link org.assertj.db.api.assertions.AssertOnValueEquality} class : * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isEqualTo(java.time.LocalDate)} method. @@ -40,7 +40,7 @@ public class AssertOnValueEquality_IsEqualTo_LocalDate_Test extends AbstractTest @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_not_equal_to() { assertThat(changes).change().column("var9").valueAtEndPoint().isEqualTo(LocalDate.of(2014, 5, 23)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24>%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalTime_Test.java index f5e6fff4..916bf203 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_LocalTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueEquality_IsEqualTo_LocalTime_Test extends AbstractTest @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_not_equal_to() { assertThat(changes).change().column("var8").valueAtEndPoint().isEqualTo(LocalTime.of(9, 46, 31)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Number_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Number_Test.java index 1c1c9a07..81bf99ee 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Number_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Number_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isEqualTo(Number)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsEqualTo_Number_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueEquality_IsEqualTo_Number_Test extends AbstractTest { @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_equal_to() { assertThat(changes).change().column("var3").valueAtEndPoint().isEqualTo(3); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2>%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Object_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Object_Test.java index e1f881cd..990d4d49 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Object_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_Object_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isEqualTo(Object)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsEqualTo_Object_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueEquality_IsEqualTo_Object_Test extends AbstractTest { @Test @NeedReload public void test_is_null() { - Table table = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test2"); Changes changes = new Changes(table).setStartPointNow(); update("update test2 set var14 = 1 where var1 is null"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_null() { @Test @NeedReload public void should_fail_because_value_is_not_null() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_null() { assertThat(changes).change().column("var3").valueAtEndPoint().isEqualTo((Object) null); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2>%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_String_Test.java index 9ad380f7..f1aae8a9 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_String_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isEqualTo(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsEqualTo_String_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueEquality_IsEqualTo_String_Test extends AbstractTest { @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_equal_to() { assertThat(changes).change().column("var12").valueAtEndPoint().isEqualTo("-"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 11 (column name : VAR12) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 11 (column name : VAR12) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <\"text\">%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_TimeValue_Test.java index 95ac1ff5..12f5e628 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_TimeValue_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isEqualTo(org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsEqualTo_TimeValue_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueEquality_IsEqualTo_TimeValue_Test extends AbstractTest @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_not_equal_to() { assertThat(changes).change().column("var8").valueAtEndPoint().isEqualTo(TimeValue.of(9, 46, 31)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_UUID_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_UUID_Test.java index 37b1b79d..f8d676f1 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_UUID_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsEqualTo_UUID_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueEquality_IsEqualTo_UUID_Test extends AbstractTest { @Test @NeedReload public void test_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var15 = '2B0D1BDD-909E-4362-BA10-C930BA82718D' where var1 = 1"); changes.setEndPointNow(); @@ -62,7 +62,7 @@ public void test_is_equal_to() { @Test @NeedReload public void should_fail_because_value_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var15 = '2B0D1BDD-909E-4362-BA10-C930BA82718D' where var1 = 10"); changes.setEndPointNow(); @@ -73,7 +73,7 @@ public void should_fail_because_value_is_not_equal_to() { fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Value at end point of Column at index 14 (column name : VAR15) of Change at index 0 (with primary key : [10]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + "[Value at end point of Column at index 14 (column name : VAR15) of Change at index 0 (with primary key : [10]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2b0d1bdd-909e-4362-ba10-c930ba82718d>%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsFalse_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsFalse_Test.java index 4141fadb..bbe14623 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsFalse_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsFalse_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isFalse()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsFalse_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueEquality_IsFalse_Test extends AbstractTest { @Test @NeedReload public void test_is_false() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 10"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_false() { @Test @NeedReload public void should_fail_because_value_is_true() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_true() { assertThat(changes).change().column("var2").valueAtEndPoint().isFalse(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : VAR2) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : VAR2) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsTrue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsTrue_Test.java index d3749bf5..003f7dd0 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsTrue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsTrue_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isTrue()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsTrue_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueEquality_IsTrue_Test extends AbstractTest { @Test @NeedReload public void test_is_true() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_true() { @Test @NeedReload public void should_fail_because_value_is_false() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 10"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_false() { assertThat(changes).change().column("var2").valueAtEndPoint().isTrue(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : VAR2) of Change at index 0 (with primary key : [10]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : VAR2) of Change at index 0 (with primary key : [10]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " %n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsZero_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsZero_Test.java index cedb3d5e..0a59d8b9 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsZero_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueEquality_IsZero_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueEquality#isZero()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueEquality_IsZero_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueEquality_IsZero_Test extends AbstractTest { @Test @NeedReload public void test_is_zero() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1000"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_zero() { @Test @NeedReload public void should_fail_because_value_is_not_zero() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_zero() { assertThat(changes).change().column("var3").valueAtEndPoint().isZero(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2>%n" + "to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Boolean_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Boolean_Test.java index 9e944944..9dcb4cf5 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Boolean_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Boolean_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueInequality#isNotEqualTo(Boolean)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueInequality_IsNotEqualTo_Boolean_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueInequality_IsNotEqualTo_Boolean_Test extends AbstractT @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 10"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var2").valueAtEndPoint().isNotEqualTo(true); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : VAR2) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : VAR2) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " %n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Bytes_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Bytes_Test.java index cc72a6d0..779fe075 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Bytes_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Bytes_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueInequality#isNotEqualTo(byte[])} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueInequality_IsNotEqualTo_Bytes_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueInequality_IsNotEqualTo_Bytes_Test extends AbstractTes @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void test_is_not_equal_to() { public void should_fail_because_value_is_equal_to() { byte[] bytesH2 = bytesContentFromClassPathOf("h2-logo-2.png"); - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -70,7 +71,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var11").valueAtEndPoint().isNotEqualTo(bytesH2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 10 (column name : VAR11) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 10 (column name : VAR11) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting to be not equal to the value but was equal")); } try { diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Character_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Character_Test.java index 6f967c46..348ef178 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Character_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Character_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueInequality#isNotEqualTo(Character)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueInequality_IsNotEqualTo_Character_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueInequality_IsNotEqualTo_Character_Test extends Abstrac @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 10"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var16").valueAtEndPoint().isNotEqualTo('T'); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 15 (column name : VAR16) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 15 (column name : VAR16) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <\"T\">%n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_DateTimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_DateTimeValue_Test.java index abda9f4c..79d4204e 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_DateTimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_DateTimeValue_Test.java @@ -32,6 +32,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueInequality#isNotEqualTo(org.assertj.db.type.DateTimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueInequality_IsNotEqualTo_DateTimeValue_Test extends AbstractTest { @@ -41,7 +42,7 @@ public class AssertOnValueInequality_IsNotEqualTo_DateTimeValue_Test extends Abs @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -63,7 +64,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -73,7 +74,7 @@ public void should_fail_because_value_is_equal_to() { .of(9, 46, 30))); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_DateValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_DateValue_Test.java index aee43532..897957ee 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_DateValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_DateValue_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueInequality#isNotEqualTo(org.assertj.db.type.DateValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueInequality_IsNotEqualTo_DateValue_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueInequality_IsNotEqualTo_DateValue_Test extends Abstrac @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var9").valueAtEndPoint().isNotEqualTo(DateValue.of(2014, 5, 24)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24>%n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalDateTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalDateTime_Test.java index dd5f978a..2f5be9d5 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalDateTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalDateTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueInequality_IsNotEqualTo_LocalDateTime_Test extends Abs @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var10").valueAtEndPoint().isNotEqualTo(LocalDateTime.of(2014, 5, 24, 9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24T09:46:30.000000000>%n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalDate_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalDate_Test.java index e8b2ad2b..75c85962 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalDate_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalDate_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueInequality_IsNotEqualTo_LocalDate_Test extends Abstrac @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var9").valueAtEndPoint().isNotEqualTo(LocalDate.of(2014, 5, 24)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 8 (column name : VAR9) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2014-05-24>%n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalTime_Test.java index 742cfbd4..6612d846 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_LocalTime_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueInequality_IsNotEqualTo_LocalTime_Test extends Abstrac @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -60,7 +60,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -69,7 +69,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var8").valueAtEndPoint().isNotEqualTo(LocalTime.of(9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Number_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Number_Test.java index 17c12660..c8186b75 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Number_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Number_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueInequality#isNotEqualTo(Number)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueInequality_IsNotEqualTo_Number_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueInequality_IsNotEqualTo_Number_Test extends AbstractTe @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var3").valueAtEndPoint().isNotEqualTo(2); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <2>%n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Object_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Object_Test.java index b925765c..b8aa4663 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Object_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_Object_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueInequality#isNotEqualTo(Object)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueInequality_IsNotEqualTo_Object_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueInequality_IsNotEqualTo_Object_Test extends AbstractTe @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test2"); Changes changes = new Changes(table).setStartPointNow(); update("update test2 set var14 = 1 where var1 is null"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var3").valueAtEndPoint().isNotEqualTo((Object) null); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 of Changes on TEST2 table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 of Changes on TEST2 table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " %n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_String_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_String_Test.java index c491f36a..948928d2 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_String_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_String_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueInequality#isNotEqualTo(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueInequality_IsNotEqualTo_String_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueInequality_IsNotEqualTo_String_Test extends AbstractTe @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var12").valueAtEndPoint().isNotEqualTo("text"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 11 (column name : VAR12) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 11 (column name : VAR12) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <\"text\">%n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_TimeValue_Test.java index 7fdc6825..11ea8036 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_TimeValue_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueInequality#isNotEqualTo(org.assertj.db.type.TimeValue)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueInequality_IsNotEqualTo_TimeValue_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueInequality_IsNotEqualTo_TimeValue_Test extends Abstrac @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_equal_to() { assertThat(changes).change().column("var8").valueAtEndPoint().isNotEqualTo(TimeValue.of(9, 46, 30)); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_UUID_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_UUID_Test.java index 9774ce14..c53aff5f 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_UUID_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotEqualTo_UUID_Test.java @@ -40,7 +40,7 @@ public class AssertOnValueInequality_IsNotEqualTo_UUID_Test extends AbstractTest @Test @NeedReload public void test_is_not_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var15 = 'F96EC595-CE91-47CC-9152-CCC8AC48AAD6' where var1 = 10"); changes.setEndPointNow(); @@ -62,7 +62,7 @@ public void test_is_not_equal_to() { @Test @NeedReload public void should_fail_because_value_is_equal_to() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var15 = 'F96EC595-CE91-47CC-9152-CCC8AC48AAD6' where var1 = 1"); changes.setEndPointNow(); @@ -73,7 +73,7 @@ public void should_fail_because_value_is_equal_to() { fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Value at end point of Column at index 14 (column name : VAR15) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + "[Value at end point of Column at index 14 (column name : VAR15) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " %n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotZero_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotZero_Test.java index 316670d0..262fe947 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotZero_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueInequality_IsNotZero_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueInequality#isNotZero()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueInequality_IsNotZero_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueInequality_IsNotZero_Test extends AbstractTest { @Test @NeedReload public void test_is_not_zero() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_not_zero() { @Test @NeedReload public void should_fail_because_value_is_zero() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1000"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_zero() { assertThat(changes).change().column("var3").valueAtEndPoint().isNotZero(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1000]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1000]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <0>%n" + "not to be equal to: %n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueNullity_IsNotNull_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueNullity_IsNotNull_Test.java index 2d878b8f..93067a89 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueNullity_IsNotNull_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueNullity_IsNotNull_Test.java @@ -12,9 +12,6 @@ */ package org.assertj.db.api.assertions; -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeColumnValueAssert; import org.assertj.db.api.TableColumnValueAssert; @@ -24,11 +21,15 @@ import org.assertj.db.type.Table; import org.junit.Test; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + /** * Tests on {@link org.assertj.db.api.assertions.AssertOnValueNullity} class : * {@link org.assertj.db.api.assertions.AssertOnValueNullity#isNotNull()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueNullity_IsNotNull_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueNullity_IsNotNull_Test extends AbstractTest { @Test @NeedReload public void test_is_not_null() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_not_null() { @Test @NeedReload public void should_fail_because_value_is_null() { - Table table = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test2"); Changes changes = new Changes(table).setStartPointNow(); update("update test2 set var14 = 1 where var1 is null"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_null() { assertThat(changes).change().column("var3").valueAtEndPoint().isNotNull(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 of Changes on TEST2 table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 of Changes on TEST2 table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting actual not to be null")); } try { diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueNullity_IsNull_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueNullity_IsNull_Test.java index b786ed8c..bb58a844 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueNullity_IsNull_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueNullity_IsNull_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueNullity#isNull()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueNullity_IsNull_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueNullity_IsNull_Test extends AbstractTest { @Test @NeedReload public void test_is_null() { - Table table = new Table(source, "test2"); + Table table = new Table(jdbcConnectionProvider, "test2"); Changes changes = new Changes(table).setStartPointNow(); update("update test2 set var14 = 1 where var1 is null"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_null() { @Test @NeedReload public void should_fail_because_value_is_not_null() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_null() { assertThat(changes).change().column("var3").valueAtEndPoint().isNull(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] expected: but was:<2>")); + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 2 (column name : VAR3) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] expected: but was:<2>")); } try { assertThat(table).column("var3").value().isNull(); diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsBoolean_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsBoolean_Test.java index 4d583307..739dc3f3 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsBoolean_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsBoolean_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueType#isBoolean()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueType_IsBoolean_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueType_IsBoolean_Test extends AbstractTest { @Test @NeedReload public void test_is_boolean() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_boolean() { @Test @NeedReload public void should_fail_because_value_is_not_a_boolean() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_a_boolean() { assertThat(changes).change().column("var1").valueAtEndPoint().isBoolean(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsBytes_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsBytes_Test.java index f1551b72..01142997 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsBytes_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsBytes_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueType#isBytes()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueType_IsBytes_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueType_IsBytes_Test extends AbstractTest { @Test @NeedReload public void test_is_bytes() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_bytes() { @Test @NeedReload public void should_fail_because_value_is_not_bytes() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_bytes() { assertThat(changes).change().column("var1").valueAtEndPoint().isBytes(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsDateTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsDateTime_Test.java index f9ddc273..43cca907 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsDateTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsDateTime_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueType#isDateTime()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueType_IsDateTime_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueType_IsDateTime_Test extends AbstractTest { @Test @NeedReload public void test_is_date_time() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_date_time() { @Test @NeedReload public void should_fail_because_value_is_not_a_date_time() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_a_date_time() { assertThat(changes).change().column("var1").valueAtEndPoint().isDateTime(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsDate_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsDate_Test.java index 84296047..af5400a6 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsDate_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsDate_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueType#isDate()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueType_IsDate_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueType_IsDate_Test extends AbstractTest { @Test @NeedReload public void test_is_date() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_date() { @Test @NeedReload public void should_fail_because_value_is_not_a_date() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_a_date() { assertThat(changes).change().column("var1").valueAtEndPoint().isDate(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsNumber_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsNumber_Test.java index 7f8789d9..a0acdb49 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsNumber_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsNumber_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueType#isNumber()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueType_IsNumber_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueType_IsNumber_Test extends AbstractTest { @Test @NeedReload public void test_is_number() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_number() { @Test @NeedReload public void should_fail_because_value_is_not_a_number() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_a_number() { assertThat(changes).change().column("var2").valueAtEndPoint().isNumber(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : VAR2) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : VAR2) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " %n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsOfAnyTypeIn_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsOfAnyTypeIn_Test.java index 1f67c697..7149a422 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsOfAnyTypeIn_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsOfAnyTypeIn_Test.java @@ -12,9 +12,6 @@ */ package org.assertj.db.api.assertions; -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeColumnValueAssert; import org.assertj.db.api.TableColumnValueAssert; @@ -25,11 +22,15 @@ import org.assertj.db.type.ValueType; import org.junit.Test; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + /** * Tests on {@link org.assertj.db.api.assertions.AssertOnValueType} class : * {@link org.assertj.db.api.assertions.AssertOnValueType#isOfAnyTypeIn(org.assertj.db.type.ValueType...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueType_IsOfAnyTypeIn_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueType_IsOfAnyTypeIn_Test extends AbstractTest { @Test @NeedReload public void test_is_of_any_of_types() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_of_any_of_types() { @Test @NeedReload public void should_fail_because_value_is_not_of_any_of_types() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_not_of_any_of_types() { assertThat(changes).change().column("var1").valueAtEndPoint().isOfAnyTypeIn(ValueType.BOOLEAN); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsOfType_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsOfType_Test.java index d59e7677..96e468e3 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsOfType_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsOfType_Test.java @@ -30,6 +30,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueType#isOfType(org.assertj.db.type.ValueType)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueType_IsOfType_Test extends AbstractTest { @@ -39,7 +40,7 @@ public class AssertOnValueType_IsOfType_Test extends AbstractTest { @Test @NeedReload public void test_is_of_type() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -59,7 +60,7 @@ public void test_is_of_type() { @Test @NeedReload public void should_fail_because_value_is_not_of_type() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +69,7 @@ public void should_fail_because_value_is_not_of_type() { assertThat(changes).change().column("var1").valueAtEndPoint().isOfType(ValueType.BOOLEAN); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsText_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsText_Test.java index bd67720a..1eb9a74e 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsText_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsText_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueType#isText()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueType_IsText_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueType_IsText_Test extends AbstractTest { @Test @NeedReload public void test_is_text() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_text() { @Test @NeedReload public void should_fail_because_value_is_not_a_text() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_a_text() { assertThat(changes).change().column("var1").valueAtEndPoint().isText(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsTime_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsTime_Test.java index f2f09360..3b4a9d6f 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsTime_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsTime_Test.java @@ -29,6 +29,7 @@ * {@link org.assertj.db.api.assertions.AssertOnValueType#isTime()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class AssertOnValueType_IsTime_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class AssertOnValueType_IsTime_Test extends AbstractTest { @Test @NeedReload public void test_is_time() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +59,7 @@ public void test_is_time() { @Test @NeedReload public void should_fail_because_value_is_not_a_time() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void should_fail_because_value_is_not_a_time() { assertThat(changes).change().column("var1").valueAtEndPoint().isTime(); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsUUID_Test.java b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsUUID_Test.java index 7ccc1627..657b567d 100644 --- a/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsUUID_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/AssertOnValueType_IsUUID_Test.java @@ -38,7 +38,7 @@ public class AssertOnValueType_IsUUID_Test extends AbstractTest { @Test @NeedReload public void test_is_UUID() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var15 = 'F96EC595-CE91-47CC-9152-CCC8AC48AAD6' where var1 = 1"); changes.setEndPointNow(); @@ -58,7 +58,7 @@ public void test_is_UUID() { @Test @NeedReload public void should_fail_because_value_is_not_a_UUID() { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); @@ -68,7 +68,7 @@ public void should_fail_because_value_is_not_a_UUID() { fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format( - "[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + "[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test'] %n" + "Expecting:%n" + " <1>%n" + "to be of type%n" diff --git a/src/test/java/org/assertj/db/api/assertions/BDDAssertions_Test.java b/src/test/java/org/assertj/db/api/assertions/BDDAssertions_Test.java index 1f5cb668..1cab257a 100644 --- a/src/test/java/org/assertj/db/api/assertions/BDDAssertions_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/BDDAssertions_Test.java @@ -28,6 +28,7 @@ * Test on {@code BDDAssertions} methods. * * @author Régis Pouiller + * @author Julien Roy */ public class BDDAssertions_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class BDDAssertions_Test extends AbstractTest { */ @Test public void test_then_for_table() throws Exception { - Table table = new Table(source, "test"); + Table table = new Table(jdbcConnectionProvider, "test"); Assertions.assertThat(then(table)).isInstanceOf(TableAssert.class); } @@ -45,7 +46,7 @@ public void test_then_for_table() throws Exception { */ @Test public void test_then_for_request() throws Exception { - Request request = new Request(source, "select * from test"); + Request request = new Request(jdbcConnectionProvider, "select * from test"); Assertions.assertThat(then(request)).isInstanceOf(RequestAssert.class); } @@ -54,7 +55,7 @@ public void test_then_for_request() throws Exception { */ @Test public void test_then_for_changes() throws Exception { - Changes changes = new Changes(source); + Changes changes = new Changes(jdbcConnectionProvider); Assertions.assertThat(then(changes)).isInstanceOf(ChangesAssert.class); } } diff --git a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeEquality_HasValues_One_TimeValue_Test.java b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeEquality_HasValues_One_TimeValue_Test.java index 23f5f2f7..0cefbf3a 100644 --- a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeEquality_HasValues_One_TimeValue_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeEquality_HasValues_One_TimeValue_Test.java @@ -12,6 +12,11 @@ */ package org.assertj.db.api.assertions.impl; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + +import java.sql.Time; + import org.assertj.core.api.Assertions; import org.assertj.core.api.WritableAssertionInfo; import org.assertj.db.api.TableAssert; @@ -20,11 +25,6 @@ import org.assertj.db.type.TimeValue; import org.junit.Test; -import java.sql.Time; - -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - /** * Tests on {@link org.assertj.db.api.assertions.impl.AssertionsOnColumnOfChangeEquality} class : * {@link org.assertj.db.api.assertions.impl.AssertionsOnColumnOfChangeEquality#hasValues(org.assertj.db.api.AbstractAssert, org.assertj.core.api.WritableAssertionInfo, org.assertj.db.type.Value, org.assertj.db.type.Value, TimeValue)} method. diff --git a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsBoolean_Test.java b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsBoolean_Test.java index ff1291f1..202f5a6b 100644 --- a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsBoolean_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsBoolean_Test.java @@ -12,6 +12,9 @@ */ package org.assertj.db.api.assertions.impl; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + import org.assertj.core.api.Assertions; import org.assertj.core.api.WritableAssertionInfo; import org.assertj.db.api.TableAssert; @@ -19,9 +22,6 @@ import org.assertj.db.type.Table; import org.junit.Test; -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - /** * Tests on {@link AssertionsOnColumnOfChangeType} class : * {@link AssertionsOnColumnOfChangeType#isBoolean(org.assertj.db.api.AbstractAssert, org.assertj.core.api.WritableAssertionInfo, org.assertj.db.type.Value, org.assertj.db.type.Value, boolean)} method. diff --git a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsNumber_Test.java b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsNumber_Test.java index 6a315543..2b0ead39 100644 --- a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsNumber_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsNumber_Test.java @@ -12,6 +12,9 @@ */ package org.assertj.db.api.assertions.impl; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + import org.assertj.core.api.Assertions; import org.assertj.core.api.WritableAssertionInfo; import org.assertj.db.api.TableAssert; @@ -19,9 +22,6 @@ import org.assertj.db.type.Table; import org.junit.Test; -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - /** * Tests on {@link org.assertj.db.api.assertions.impl.AssertionsOnColumnOfChangeType} class : * {@link org.assertj.db.api.assertions.impl.AssertionsOnColumnOfChangeType#isNumber(org.assertj.db.api.AbstractAssert, org.assertj.core.api.WritableAssertionInfo, org.assertj.db.type.Value, org.assertj.db.type.Value, boolean)} method. diff --git a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsOfType_Test.java b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsOfType_Test.java index 08f60803..3d33b807 100644 --- a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsOfType_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeType_IsOfType_Test.java @@ -12,6 +12,11 @@ */ package org.assertj.db.api.assertions.impl; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + +import java.util.Locale; + import org.assertj.core.api.Assertions; import org.assertj.core.api.WritableAssertionInfo; import org.assertj.db.api.TableAssert; @@ -20,11 +25,6 @@ import org.assertj.db.type.ValueType; import org.junit.Test; -import java.util.Locale; - -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - /** * Tests on {@link AssertionsOnColumnOfChangeType} class : * {@link AssertionsOnColumnOfChangeType#isOfType(org.assertj.db.api.AbstractAssert, org.assertj.core.api.WritableAssertionInfo, org.assertj.db.type.Value, org.assertj.db.type.Value, org.assertj.db.type.ValueType, boolean)} method. diff --git a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnRowOfChangeExistence_Exists_Test.java b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnRowOfChangeExistence_Exists_Test.java index 10404e16..07fdc600 100644 --- a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnRowOfChangeExistence_Exists_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnRowOfChangeExistence_Exists_Test.java @@ -12,6 +12,12 @@ */ package org.assertj.db.api.assertions.impl; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + +import java.sql.Date; +import java.util.Arrays; + import org.assertj.core.api.Assertions; import org.assertj.core.api.WritableAssertionInfo; import org.assertj.db.api.TableAssert; @@ -20,12 +26,6 @@ import org.assertj.db.type.Table; import org.junit.Test; -import java.sql.Date; -import java.util.Arrays; - -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - /** * Tests on {@link AssertionsOnRowOfChangeExistence} class : * {@link AssertionsOnRowOfChangeExistence#exists(org.assertj.db.api.AbstractAssert, org.assertj.core.api.WritableAssertionInfo, org.assertj.db.type.Row)} method. diff --git a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence_DoesNotExist_Test.java b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence_DoesNotExist_Test.java index f75c6b3c..3c18f841 100644 --- a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence_DoesNotExist_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence_DoesNotExist_Test.java @@ -12,23 +12,23 @@ */ package org.assertj.db.api.assertions.impl; +import static org.assertj.db.api.Assertions.assertThat; +import static org.junit.Assert.fail; + +import javax.sql.DataSource; + import org.assertj.core.api.Assertions; import org.assertj.core.api.WritableAssertionInfo; import org.assertj.db.api.AbstractDbAssert; import org.assertj.db.api.TableAssert; import org.assertj.db.common.AbstractTest; -import org.assertj.db.type.Source; +import org.assertj.db.type.JdbcUrlConnectionProvider; import org.assertj.db.type.Table; import org.junit.Test; -import javax.sql.DataSource; - -import static org.assertj.db.api.Assertions.assertThat; -import static org.junit.Assert.fail; - /** * Tests on {@link AssertionsOnTableExistence} class : - * {@link AssertionsOnTableExistence#doesNotExists(AbstractDbAssert, WritableAssertionInfo, String, Source, DataSource)} method. + * {@link AssertionsOnTableExistence#doesNotExists(AbstractDbAssert, WritableAssertionInfo, String, JdbcUrlConnectionProvider, DataSource)} method. * * @author Julien Roy */ @@ -42,9 +42,9 @@ public void test_does_not_exists() { WritableAssertionInfo info = new WritableAssertionInfo(); Table table = new Table(); TableAssert tableAssert = assertThat(table); - TableAssert tableAssert2 = AssertionsOnTableExistence.doesNotExists(tableAssert, info, "not-exist-test", source, null); + TableAssert tableAssert2 = AssertionsOnTableExistence.doesNotExists(tableAssert, info, "not-exist-test", jdbcConnectionProvider); Assertions.assertThat(tableAssert2).isSameAs(tableAssert); - TableAssert tableAssert3 = AssertionsOnTableExistence.doesNotExists(tableAssert, info, "not-exist-test", null, dataSource); + TableAssert tableAssert3 = AssertionsOnTableExistence.doesNotExists(tableAssert, info, "not-exist-test", dsConnectionProvider); Assertions.assertThat(tableAssert3).isSameAs(tableAssert); } @@ -58,7 +58,7 @@ public void should_fail_because_table_exists() { Table table = new Table(); TableAssert tableAssert = assertThat(table); try { - AssertionsOnTableExistence.doesNotExists(tableAssert, info, "TEST", source, null); + AssertionsOnTableExistence.doesNotExists(tableAssert, info, "TEST", jdbcConnectionProvider); fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[description] %n" @@ -66,7 +66,7 @@ public void should_fail_because_table_exists() { } try { - AssertionsOnTableExistence.doesNotExists(tableAssert, info, "TEST", null, dataSource); + AssertionsOnTableExistence.doesNotExists(tableAssert, info, "TEST", dsConnectionProvider); fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[description] %n" diff --git a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence_Exists_Test.java b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence_Exists_Test.java index 8f77159f..1bb0e369 100644 --- a/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence_Exists_Test.java +++ b/src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence_Exists_Test.java @@ -22,13 +22,13 @@ import org.assertj.db.api.AbstractDbAssert; import org.assertj.db.api.TableAssert; import org.assertj.db.common.AbstractTest; -import org.assertj.db.type.Source; +import org.assertj.db.type.JdbcUrlConnectionProvider; import org.assertj.db.type.Table; import org.junit.Test; /** * Tests on {@link AssertionsOnTableExistence} class : - * {@link AssertionsOnTableExistence#exists(AbstractDbAssert, WritableAssertionInfo, String, Source, DataSource)} method. + * {@link AssertionsOnTableExistence#exists(AbstractDbAssert, WritableAssertionInfo, String, JdbcUrlConnectionProvider, DataSource)} method. * * @author Julien Roy */ @@ -42,9 +42,9 @@ public void test_exists() { WritableAssertionInfo info = new WritableAssertionInfo(); Table table = new Table(); TableAssert tableAssert = assertThat(table); - TableAssert tableAssert2 = AssertionsOnTableExistence.exists(tableAssert, info, "TEST", source, null); + TableAssert tableAssert2 = AssertionsOnTableExistence.exists(tableAssert, info, "TEST", jdbcConnectionProvider); Assertions.assertThat(tableAssert2).isSameAs(tableAssert); - TableAssert tableAssert3 = AssertionsOnTableExistence.exists(tableAssert, info, "TEST", null, dataSource); + TableAssert tableAssert3 = AssertionsOnTableExistence.exists(tableAssert, info, "TEST", dsConnectionProvider); Assertions.assertThat(tableAssert3).isSameAs(tableAssert); } @@ -58,7 +58,7 @@ public void should_fail_because_table_does_not_exist() { Table table = new Table(); TableAssert tableAssert = assertThat(table); try { - AssertionsOnTableExistence.exists(tableAssert, info, "not-exist-test", source, null); + AssertionsOnTableExistence.exists(tableAssert, info, "not-exist-test", jdbcConnectionProvider); fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[description] %n" @@ -66,7 +66,7 @@ public void should_fail_because_table_does_not_exist() { } try { - AssertionsOnTableExistence.exists(tableAssert, info, "not-exist-test", null, dataSource); + AssertionsOnTableExistence.exists(tableAssert, info, "not-exist-test", dsConnectionProvider); fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[description] %n" diff --git a/src/test/java/org/assertj/db/common/AbstractTest.java b/src/test/java/org/assertj/db/common/AbstractTest.java index a28ceb67..3290ca42 100644 --- a/src/test/java/org/assertj/db/common/AbstractTest.java +++ b/src/test/java/org/assertj/db/common/AbstractTest.java @@ -37,10 +37,11 @@ import org.assertj.db.type.ChangeType; import org.assertj.db.type.Changes; import org.assertj.db.type.Column; +import org.assertj.db.type.ConnectionProvider; +import org.assertj.db.type.ConnectionProviderFactory; import org.assertj.db.type.DataType; import org.assertj.db.type.Request; import org.assertj.db.type.Row; -import org.assertj.db.type.Source; import org.assertj.db.type.Table; import org.assertj.db.type.Value; import org.assertj.db.type.lettercase.LetterCase; @@ -60,9 +61,10 @@ import com.ninja_squad.dbsetup.operation.Operation; /** - * Parent for all the tests. It contains the variables like a {@code DataSource} and a {@code Source}. + * Parent for all the tests. It contains the variables like a {@code DataSource} and a {@code ConnectionProvider}. * * @author Régis Pouiller + * @author Julien Roy */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {TestsConfiguration.class}) @@ -129,11 +131,44 @@ public abstract class AbstractTest { private static final DbSetup DB_SETUP = new DbSetup(new DriverManagerDestination("jdbc:h2:mem:test", "SA", ""), OPERATIONS); private static final DbSetupTracker DB_SETUP_TRACKER = new DbSetupTracker(); - protected final Source source = new Source("jdbc:h2:mem:test", "sa", ""); + protected final ConnectionProvider jdbcConnectionProvider = ConnectionProviderFactory.of("jdbc:h2:mem:test", "sa", "").create(); @Rule public TestName testNameRule = new TestName(); @Autowired protected DataSource dataSource; + protected ConnectionProvider dsConnectionProvider; + + /** + * Returns an instance of a {@code Value}. + * + * @param columnName The name of the column. + * @param object The object in the value. + * @return An instance. + * @throws Exception Exception + */ + protected static Value getValue(String columnName, Object object) throws Exception { + Constructor constructor = Value.class.getDeclaredConstructor(String.class, Object.class, LetterCase.class); + constructor.setAccessible(true); + Value value = constructor.newInstance(columnName, object, LetterCase.COLUMN_DEFAULT); + return value; + } + + /** + * Returns an instance of a {@code Changes}. + * + * @param changesList The list of changes. + * @return An instance. + * @throws Exception Exception + */ + protected static Changes getChanges(List changesList) throws Exception { + Constructor constructor = Changes.class.getDeclaredConstructor(ConnectionProvider.class); + constructor.setAccessible(true); + Changes changes = constructor.newInstance((ConnectionProvider) null); + Field field = Changes.class.getDeclaredField("changesList"); + field.setAccessible(true); + field.set(changes, changesList); + return changes; + } /** * Returns an instance of a {@code Column}. @@ -225,38 +260,6 @@ protected static Request getRequest(List columnsNameList, List p return request; } - /** - * Returns an instance of a {@code Value}. - * - * @param columnName The name of the column. - * @param object The object in the value. - * @return An instance. - * @throws Exception Exception - */ - protected static Value getValue(String columnName, Object object) throws Exception { - Constructor constructor = Value.class.getDeclaredConstructor(String.class, Object.class, LetterCase.class); - constructor.setAccessible(true); - Value value = constructor.newInstance(columnName, object, LetterCase.COLUMN_DEFAULT); - return value; - } - - /** - * Returns an instance of a {@code Changes}. - * - * @param changesList The list of changes. - * @return An instance. - * @throws Exception Exception - */ - protected static Changes getChanges(List changesList) throws Exception { - Constructor constructor = Changes.class.getDeclaredConstructor(); - constructor.setAccessible(true); - Changes changes = constructor.newInstance(); - Field field = Changes.class.getDeclaredField("changesList"); - field.setAccessible(true); - field.set(changes, changesList); - return changes; - } - /** * Returns an instance of a {@code Change}. * @@ -317,6 +320,11 @@ protected static Change getTableDeletionChange(String dataName, Row rowAtStartPo return getChange(DataType.TABLE, dataName, ChangeType.DELETION, rowAtStartPoint, null); } + @Before + public void initDsConnection() { + this.dsConnectionProvider = ConnectionProviderFactory.of(dataSource).create(); + } + @Before public void initiate() { DB_SETUP_TRACKER.launchIfNecessary(DB_SETUP); @@ -344,7 +352,7 @@ public void determineIfReloadIsNeeded() throws NoSuchMethodException, SecurityEx * @param parameters The parameters of the request. */ protected void update(String request, Object... parameters) { - try (Connection connection = dataSource.getConnection()) { + try (Connection connection = dsConnectionProvider.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(request)) { for (int i = 0; i < parameters.length; i++) { statement.setObject(i + 1, parameters[i]); diff --git a/src/test/java/org/assertj/db/common/NeedReload.java b/src/test/java/org/assertj/db/common/NeedReload.java index a895fb63..f3199008 100644 --- a/src/test/java/org/assertj/db/common/NeedReload.java +++ b/src/test/java/org/assertj/db/common/NeedReload.java @@ -19,7 +19,7 @@ import java.lang.annotation.Target; /** - * Indicates that after the tests it need to reload the data. + * Indicates that after the tests it needs to reload the data. * * @author Régis Pouiller */ diff --git a/src/test/java/org/assertj/db/database/h2/AbstractH2Test.java b/src/test/java/org/assertj/db/database/h2/AbstractH2Test.java index df53df8f..13dbe121 100644 --- a/src/test/java/org/assertj/db/database/h2/AbstractH2Test.java +++ b/src/test/java/org/assertj/db/database/h2/AbstractH2Test.java @@ -24,8 +24,8 @@ import javax.sql.DataSource; import org.assertj.db.database.AbstractDatabaseTest; -import org.assertj.db.type.DataSourceWithLetterCase; -import org.assertj.db.type.SourceWithLetterCase; +import org.assertj.db.type.ConnectionProvider; +import org.assertj.db.type.ConnectionProviderFactory; import org.assertj.db.type.lettercase.LetterCase; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; @@ -39,6 +39,7 @@ * Parent for all the tests which are specific for H2 database. * * @author Régis Pouiller + * @author Julien Roy */ @ContextConfiguration(classes = {H2Configuration.class}) public abstract class AbstractH2Test extends AbstractDatabaseTest { @@ -77,22 +78,22 @@ public abstract class AbstractH2Test extends AbstractDatabaseTest { private static final Operation OPERATIONS = sequenceOf(DELETE_ALL, INSERT_TEST, SQL); private static final DbSetup DB_SETUP = new DbSetup(new DriverManagerDestination("jdbc:h2:mem:testH2", "SA", ""), OPERATIONS); private static final DbSetupTracker DB_SETUP_TRACKER = new DbSetupTracker(); - protected final SourceWithLetterCase sourceDDD = new SourceWithLetterCase("jdbc:h2:mem:testH2", "sa", "", + protected final ConnectionProvider jdbcConnectionDDD = ConnectionProviderFactory.of("jdbc:h2:mem:testH2", "sa", "").letterCase( LetterCase.TABLE_DEFAULT, LetterCase.COLUMN_DEFAULT, - LetterCase.PRIMARY_KEY_DEFAULT); - protected final SourceWithLetterCase sourceUIUIUI = new SourceWithLetterCase("jdbc:h2:mem:testH2", "sa", "", + LetterCase.PRIMARY_KEY_DEFAULT).create(); + protected final ConnectionProvider jdbcConnectionUIUIUI = ConnectionProviderFactory.of("jdbc:h2:mem:testH2", "sa", "").letterCase( letterCaseUI, letterCaseUI, - letterCaseUI); - protected final SourceWithLetterCase sourceNSNSNS = new SourceWithLetterCase("jdbc:h2:mem:testH2", "sa", "", + letterCaseUI).create(); + protected final ConnectionProvider jdbcConnectionNSNSNS = ConnectionProviderFactory.of("jdbc:h2:mem:testH2", "sa", "").letterCase( letterCaseNS, letterCaseNS, - letterCaseNS); + letterCaseNS).create(); protected DataSource dataSource; - protected DataSourceWithLetterCase dataSourceDDD; - protected DataSourceWithLetterCase dataSourceUIUIUI; - protected DataSourceWithLetterCase dataSourceNSNSNS; + protected ConnectionProvider dsConnectionDDD; + protected ConnectionProvider dsConnectionUIUIUI; + protected ConnectionProvider dsConnectionNSNSNS; protected DbSetup getDbSetup() { return DB_SETUP; @@ -105,11 +106,9 @@ protected DbSetupTracker getDbSetupTracker() { @Autowired protected void setDataSource(DataSource dataSource) { this.dataSource = dataSource; - this.dataSourceDDD = new DataSourceWithLetterCase(dataSource, LetterCase.TABLE_DEFAULT, - LetterCase.COLUMN_DEFAULT, - LetterCase.PRIMARY_KEY_DEFAULT); - this.dataSourceUIUIUI = new DataSourceWithLetterCase(dataSource, letterCaseUI, letterCaseUI, letterCaseUI); - this.dataSourceNSNSNS = new DataSourceWithLetterCase(dataSource, letterCaseNS, letterCaseNS, letterCaseNS); + this.dsConnectionDDD = ConnectionProviderFactory.of(dataSource).letterCase(LetterCase.TABLE_DEFAULT, LetterCase.COLUMN_DEFAULT, LetterCase.PRIMARY_KEY_DEFAULT).create(); + this.dsConnectionUIUIUI = ConnectionProviderFactory.of(dataSource).letterCase(letterCaseUI, letterCaseUI, letterCaseUI).create(); + this.dsConnectionNSNSNS = ConnectionProviderFactory.of(dataSource).letterCase(letterCaseNS, letterCaseNS, letterCaseNS).create(); } protected void update() { diff --git a/src/test/java/org/assertj/db/database/h2/AbstractReservedH2Test.java b/src/test/java/org/assertj/db/database/h2/AbstractReservedH2Test.java index f3a5a31b..dee9034e 100644 --- a/src/test/java/org/assertj/db/database/h2/AbstractReservedH2Test.java +++ b/src/test/java/org/assertj/db/database/h2/AbstractReservedH2Test.java @@ -19,8 +19,8 @@ import javax.sql.DataSource; import org.assertj.db.database.AbstractDatabaseTest; -import org.assertj.db.type.DataSourceWithLetterCase; -import org.assertj.db.type.SourceWithLetterCase; +import org.assertj.db.type.ConnectionProvider; +import org.assertj.db.type.ConnectionProviderFactory; import org.assertj.db.type.lettercase.LetterCase; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; @@ -34,6 +34,7 @@ * Parent for all the tests which are specific for H2 database with reserved names in SQL structure. * * @author Régis Pouiller + * @author Julien Roy */ @ContextConfiguration(classes = {ReservedH2Configuration.class}) public abstract class AbstractReservedH2Test extends AbstractDatabaseTest { @@ -50,22 +51,22 @@ public abstract class AbstractReservedH2Test extends AbstractDatabaseTest { private static final DbSetup DB_SETUP = new DbSetup(new DriverManagerDestination("jdbc:h2:mem:testReservedH2", "SA", ""), OPERATIONS); private static final DbSetupTracker DB_SETUP_TRACKER = new DbSetupTracker(); - protected final SourceWithLetterCase sourceDDD = new SourceWithLetterCase("jdbc:h2:mem:testReservedH2", "sa", "", + protected final ConnectionProvider jdbcConnectionDDD = ConnectionProviderFactory.of("jdbc:h2:mem:testReservedH2", "sa", "").letterCase( LetterCase.TABLE_DEFAULT, LetterCase.COLUMN_DEFAULT, - LetterCase.PRIMARY_KEY_DEFAULT); - protected final SourceWithLetterCase sourceUIUIUI = new SourceWithLetterCase("jdbc:h2:mem:testReservedH2", "sa", "", + LetterCase.PRIMARY_KEY_DEFAULT).create(); + protected final ConnectionProvider jdbcConnectionUIUIUI = ConnectionProviderFactory.of("jdbc:h2:mem:testReservedH2", "sa", "").letterCase( letterCaseUI, letterCaseUI, - letterCaseUI); - protected final SourceWithLetterCase sourceNSNSNS = new SourceWithLetterCase("jdbc:h2:mem:testReservedH2", "sa", "", + letterCaseUI).create(); + protected final ConnectionProvider jdbcConnectionNSNSNS = ConnectionProviderFactory.of("jdbc:h2:mem:testReservedH2", "sa", "").letterCase( letterCaseNS, letterCaseNS, - letterCaseNS); + letterCaseNS).create(); protected DataSource dataSource; - protected DataSourceWithLetterCase dataSourceDDD; - protected DataSourceWithLetterCase dataSourceUIUIUI; - protected DataSourceWithLetterCase dataSourceNSNSNS; + protected ConnectionProvider dsConnectionDDD; + protected ConnectionProvider dsConnectionUIUIUI; + protected ConnectionProvider dsConnectionNSNSNS; protected DbSetup getDbSetup() { return DB_SETUP; @@ -78,11 +79,9 @@ protected DbSetupTracker getDbSetupTracker() { @Autowired protected void setDataSource(DataSource dataSource) { this.dataSource = dataSource; - this.dataSourceDDD = new DataSourceWithLetterCase(dataSource, LetterCase.TABLE_DEFAULT, - LetterCase.COLUMN_DEFAULT, - LetterCase.PRIMARY_KEY_DEFAULT); - this.dataSourceUIUIUI = new DataSourceWithLetterCase(dataSource, letterCaseUI, letterCaseUI, letterCaseUI); - this.dataSourceNSNSNS = new DataSourceWithLetterCase(dataSource, letterCaseNS, letterCaseNS, letterCaseNS); + this.dsConnectionDDD = ConnectionProviderFactory.of(dataSource).letterCase(LetterCase.TABLE_DEFAULT, LetterCase.COLUMN_DEFAULT, LetterCase.PRIMARY_KEY_DEFAULT).create(); + this.dsConnectionUIUIUI = ConnectionProviderFactory.of(dataSource).letterCase(letterCaseUI, letterCaseUI, letterCaseUI).create(); + this.dsConnectionNSNSNS = ConnectionProviderFactory.of(dataSource).letterCase(letterCaseNS, letterCaseNS, letterCaseNS).create(); } protected void update() { diff --git a/src/test/java/org/assertj/db/database/h2/H2DataBase_Source_DDD_Test.java b/src/test/java/org/assertj/db/database/h2/H2DataBase_JdbcUrl_DDD_Test.java similarity index 98% rename from src/test/java/org/assertj/db/database/h2/H2DataBase_Source_DDD_Test.java rename to src/test/java/org/assertj/db/database/h2/H2DataBase_JdbcUrl_DDD_Test.java index e4febd3e..5946663a 100644 --- a/src/test/java/org/assertj/db/database/h2/H2DataBase_Source_DDD_Test.java +++ b/src/test/java/org/assertj/db/database/h2/H2DataBase_JdbcUrl_DDD_Test.java @@ -30,12 +30,11 @@ import org.assertj.db.type.Change; import org.assertj.db.type.Changes; import org.assertj.db.type.Column; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.DateTimeValue; import org.assertj.db.type.DateValue; import org.assertj.db.type.Request; import org.assertj.db.type.Row; -import org.assertj.db.type.Source; -import org.assertj.db.type.SourceWithLetterCase; import org.assertj.db.type.Table; import org.assertj.db.type.TimeValue; import org.assertj.db.type.Value; @@ -48,20 +47,21 @@ * Test on the H2 database. * * @author Régis Pouiller + * @author Julien Roy */ -public class H2DataBase_Source_DDD_Test extends AbstractH2Test { +public class H2DataBase_JdbcUrl_DDD_Test extends AbstractH2Test { - private Source source; + private ConnectionProvider connectionProvider; @Before public void init() { - source = sourceDDD; + connectionProvider = jdbcConnectionDDD; } @Test @NeedReload public void test_Outputs_output() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -129,7 +129,7 @@ public void test_Outputs_output() { + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on TEST table of 'sa/jdbc:h2:mem:testH2' source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on TEST table of 'sa/jdbc:h2:mem:testH2']%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -140,7 +140,7 @@ public void test_Outputs_output() { + "| Index : 0 | MODIFICATION | TEST | 1 |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | At end point | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2' source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2']%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -151,7 +151,7 @@ public void test_Outputs_output() { + "| MODIFICATION | TEST | 1 |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | At end point | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2' source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -160,14 +160,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| 1 | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2' source]%n" + Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2' source]%n" + Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2']%n" + "|----------------|----------|%n" + "| | VAR1 |%n" + "| | (NUMBER) |%n" @@ -176,7 +176,7 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2' source]%n" + Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" @@ -188,7 +188,7 @@ public void test_Outputs_output() { @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -200,7 +200,7 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -337,7 +337,7 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -474,7 +474,7 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_ColumnEquality_hasValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -610,7 +610,7 @@ public void test_ColumnEquality_hasValues() { @Test @NeedReload public void test_ColumnEquality_containsValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -682,7 +682,7 @@ public void test_ColumnEquality_containsValues() { @Test @NeedReload public void test_ColumnType_isOfType() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -818,7 +818,7 @@ public void test_ColumnType_isOfType() { @Test @NeedReload public void test_ColumnOfChangeEquality_hasValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -970,7 +970,7 @@ public void test_ColumnOfChangeEquality_hasValues() { @Test @NeedReload public void test_RowEquality_hasValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1107,7 +1107,7 @@ public void test_RowEquality_hasValues() { @Test @NeedReload public void test_ValueClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1244,7 +1244,7 @@ public void test_ValueClass_isOfClass() { @Test @NeedReload public void test_ValueEquality_isEqualTo() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1381,7 +1381,7 @@ public void test_ValueEquality_isEqualTo() { @Test @NeedReload public void test_ValueNonEquality_isNotEqualTo() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1518,7 +1518,7 @@ public void test_ValueNonEquality_isNotEqualTo() { @Test @NeedReload public void test_ValueType_isOfType() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1655,11 +1655,9 @@ public void test_ValueType_isOfType() { @Test @NeedReload public void test_getTableLetterCase() { - SourceWithLetterCase sourceWithLetterCase = (SourceWithLetterCase) source; + Table table = new Table(connectionProvider, "test"); - Table table = new Table(source, "test"); - - Request request = new Request(source, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Changes changes = new Changes(table).setStartPointNow(); update(); @@ -1667,7 +1665,7 @@ public void test_getTableLetterCase() { Change change = changes.getChangesList().get(0); - Assertions.assertThat(sourceWithLetterCase.getTableLetterCase().getConversionName()).isSameAs(LetterCase.TABLE_DEFAULT.getConversionName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getConversionName()).isSameAs(LetterCase.TABLE_DEFAULT.getConversionName()); Assertions.assertThat(table.getTableLetterCase().getConversionName()).isSameAs(LetterCase.TABLE_DEFAULT.getConversionName()); @@ -1677,7 +1675,7 @@ public void test_getTableLetterCase() { Assertions.assertThat(change.getTableLetterCase().getConversionName()).isSameAs(LetterCase.TABLE_DEFAULT.getConversionName()); - Assertions.assertThat(sourceWithLetterCase.getTableLetterCase().getComparisonName()).isSameAs(LetterCase.TABLE_DEFAULT.getComparisonName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getComparisonName()).isSameAs(LetterCase.TABLE_DEFAULT.getComparisonName()); Assertions.assertThat(table.getTableLetterCase().getComparisonName()).isSameAs(LetterCase.TABLE_DEFAULT.getComparisonName()); @@ -1690,15 +1688,13 @@ public void test_getTableLetterCase() { @Test @NeedReload public void test_getColumnLetterCase() { - SourceWithLetterCase sourceWithLetterCase = (SourceWithLetterCase) source; - - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); Column tableColumn = table.getColumn(0); Value tableRowValue = tableRow.getColumnValue(0); Value tableColumnValue = tableColumn.getRowValue(0); - Request request = new Request(source, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Column requestColumn = request.getColumn(0); Value requestRowValue = requestRow.getColumnValue(0); @@ -1714,7 +1710,7 @@ public void test_getColumnLetterCase() { Value valueAtEndPoint = rowAtEndPoint.getColumnValue(0); - Assertions.assertThat(sourceWithLetterCase.getColumnLetterCase().getConversionName()).isSameAs(LetterCase.COLUMN_DEFAULT.getConversionName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getConversionName()).isSameAs(LetterCase.COLUMN_DEFAULT.getConversionName()); Assertions.assertThat(table.getColumnLetterCase().getConversionName()).isSameAs(LetterCase.COLUMN_DEFAULT.getConversionName()); Assertions.assertThat(tableRow.getColumnLetterCase().getConversionName()).isSameAs(LetterCase.COLUMN_DEFAULT.getConversionName()); @@ -1736,7 +1732,7 @@ public void test_getColumnLetterCase() { Assertions.assertThat(valueAtEndPoint.getColumnLetterCase().getConversionName()).isSameAs(LetterCase.COLUMN_DEFAULT.getConversionName()); - Assertions.assertThat(sourceWithLetterCase.getColumnLetterCase().getComparisonName()).isSameAs(LetterCase.COLUMN_DEFAULT.getComparisonName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getComparisonName()).isSameAs(LetterCase.COLUMN_DEFAULT.getComparisonName()); Assertions.assertThat(table.getColumnLetterCase().getComparisonName()).isSameAs(LetterCase.COLUMN_DEFAULT.getComparisonName()); Assertions.assertThat(tableRow.getColumnLetterCase().getComparisonName()).isSameAs(LetterCase.COLUMN_DEFAULT.getComparisonName()); @@ -1761,12 +1757,10 @@ public void test_getColumnLetterCase() { @Test @NeedReload public void test_getPrimaryKeyLetterCase() { - SourceWithLetterCase sourceWithLetterCase = (SourceWithLetterCase) source; - - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); - Request request = new Request(source, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Changes changes = new Changes(table).setStartPointNow(); @@ -1777,7 +1771,7 @@ public void test_getPrimaryKeyLetterCase() { Row rowAtEndPoint = change.getRowAtEndPoint(); - Assertions.assertThat(sourceWithLetterCase.getPrimaryKeyLetterCase().getConversionName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getConversionName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getConversionName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getConversionName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getConversionName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getConversionName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getConversionName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getConversionName()); @@ -1791,7 +1785,7 @@ public void test_getPrimaryKeyLetterCase() { Assertions.assertThat(rowAtEndPoint.getPrimaryKeyLetterCase().getConversionName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getConversionName()); - Assertions.assertThat(sourceWithLetterCase.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getComparisonName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getComparisonName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getComparisonName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getComparisonName()); diff --git a/src/test/java/org/assertj/db/database/h2/H2DataBase_Test.java b/src/test/java/org/assertj/db/database/h2/H2DataBase_Test.java index b0514fe7..ae8fc8ce 100644 --- a/src/test/java/org/assertj/db/database/h2/H2DataBase_Test.java +++ b/src/test/java/org/assertj/db/database/h2/H2DataBase_Test.java @@ -44,7 +44,7 @@ public void test_catalog_for_data_source() throws SQLException { } @Test - public void test_catalog_for_source() throws SQLException { + public void test_catalogfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { String catalog = connection.getCatalog(); assertThat(catalog).isEqualTo("TESTH2"); @@ -60,7 +60,7 @@ public void test_schema_for_data_source() throws SQLException { } @Test - public void test_schema_for_source() throws SQLException { + public void test_schemafor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { String schema = connection.getSchema(); assertThat(schema).isEqualTo("PUBLIC"); @@ -79,7 +79,7 @@ public void test_tables_for_data_source() throws SQLException { } @Test - public void test_tables_for_source() throws SQLException { + public void test_tablesfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); ResultSet resultSet = databaseMetaData.getTables("TESTH2", null, null, new String[]{"TABLE"}); @@ -107,7 +107,7 @@ public void test_table_primary_keys_for_data_source() throws SQLException { } @Test - public void test_table_primary_keys_for_source() throws SQLException { + public void test_table_primary_keysfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); { @@ -261,7 +261,7 @@ public void test_table_columns_for_data_source() throws SQLException { } @Test - public void test_table_columns_for_source() throws SQLException { + public void test_table_columnsfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); { @@ -471,7 +471,7 @@ public void test_request_columns_for_data_source() throws SQLException { } @Test - public void test_request_columns_for_source() throws SQLException { + public void test_request_columnsfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { try (Statement statement = connection.createStatement()) { try (ResultSet resultSet1 = statement.executeQuery("select * from test")) { diff --git a/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_DDD_Test.java b/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_DDD_Test.java index f8babf80..11be7e6e 100644 --- a/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_DDD_Test.java +++ b/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_DDD_Test.java @@ -23,7 +23,6 @@ import java.sql.Timestamp; import java.util.Locale; import java.util.UUID; -import javax.sql.DataSource; import org.assertj.core.api.Assertions; import org.assertj.db.common.NeedReload; @@ -31,7 +30,7 @@ import org.assertj.db.type.Change; import org.assertj.db.type.Changes; import org.assertj.db.type.Column; -import org.assertj.db.type.DataSourceWithLetterCase; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.DateTimeValue; import org.assertj.db.type.DateValue; import org.assertj.db.type.Request; @@ -48,20 +47,21 @@ * Test on the H2 database. * * @author Régis Pouiller + * @author Julien Roy */ public class H2Database_DataSource_DDD_Test extends AbstractH2Test { - private DataSource dataSource; + private ConnectionProvider connectionProvider; @Before public void init() { - dataSource = dataSourceDDD; + connectionProvider = dsConnectionDDD; } @Test @NeedReload public void test_Outputs_output() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -129,7 +129,7 @@ public void test_Outputs_output() { + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on TEST table of 'data source']%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -140,7 +140,7 @@ public void test_Outputs_output() { + "| Index : 0 | MODIFICATION | TEST | 1 |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | At end point | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -151,7 +151,7 @@ public void test_Outputs_output() { + "| MODIFICATION | TEST | 1 |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | At end point | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -160,14 +160,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| 1 | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|----------------|----------|%n" + "| | VAR1 |%n" + "| | (NUMBER) |%n" @@ -176,7 +176,7 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" @@ -188,7 +188,7 @@ public void test_Outputs_output() { @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -200,7 +200,7 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -337,7 +337,7 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -474,7 +474,7 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_ColumnEquality_hasValues() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -610,7 +610,7 @@ public void test_ColumnEquality_hasValues() { @Test @NeedReload public void test_ColumnEquality_containsValues() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -682,7 +682,7 @@ public void test_ColumnEquality_containsValues() { @Test @NeedReload public void test_ColumnType_isOfType() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -818,7 +818,7 @@ public void test_ColumnType_isOfType() { @Test @NeedReload public void test_ColumnOfChangeEquality_hasValues() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -970,7 +970,7 @@ public void test_ColumnOfChangeEquality_hasValues() { @Test @NeedReload public void test_RowEquality_hasValues() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1107,7 +1107,7 @@ public void test_RowEquality_hasValues() { @Test @NeedReload public void test_ValueClass_isOfClass() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1244,7 +1244,7 @@ public void test_ValueClass_isOfClass() { @Test @NeedReload public void test_ValueEquality_isEqualTo() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1381,7 +1381,7 @@ public void test_ValueEquality_isEqualTo() { @Test @NeedReload public void test_ValueNonEquality_isNotEqualTo() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1518,7 +1518,7 @@ public void test_ValueNonEquality_isNotEqualTo() { @Test @NeedReload public void test_ValueType_isOfType() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1655,11 +1655,9 @@ public void test_ValueType_isOfType() { @Test @NeedReload public void test_getTableLetterCase() { - DataSourceWithLetterCase datasourceWithLetterCase = (DataSourceWithLetterCase) dataSource; + Table table = new Table(connectionProvider, "test"); - Table table = new Table(dataSource, "test"); - - Request request = new Request(dataSource, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Changes changes = new Changes(table).setStartPointNow(); update(); @@ -1667,7 +1665,7 @@ public void test_getTableLetterCase() { Change change = changes.getChangesList().get(0); - Assertions.assertThat(datasourceWithLetterCase.getTableLetterCase().getConversionName()).isSameAs(LetterCase.TABLE_DEFAULT.getConversionName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getConversionName()).isSameAs(LetterCase.TABLE_DEFAULT.getConversionName()); Assertions.assertThat(table.getTableLetterCase().getConversionName()).isSameAs(LetterCase.TABLE_DEFAULT.getConversionName()); @@ -1677,7 +1675,7 @@ public void test_getTableLetterCase() { Assertions.assertThat(change.getTableLetterCase().getConversionName()).isSameAs(LetterCase.TABLE_DEFAULT.getConversionName()); - Assertions.assertThat(datasourceWithLetterCase.getTableLetterCase().getComparisonName()).isSameAs(LetterCase.TABLE_DEFAULT.getComparisonName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getComparisonName()).isSameAs(LetterCase.TABLE_DEFAULT.getComparisonName()); Assertions.assertThat(table.getTableLetterCase().getComparisonName()).isSameAs(LetterCase.TABLE_DEFAULT.getComparisonName()); @@ -1690,15 +1688,13 @@ public void test_getTableLetterCase() { @Test @NeedReload public void test_getColumnLetterCase() { - DataSourceWithLetterCase datasourceWithLetterCase = (DataSourceWithLetterCase) dataSource; - - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); Column tableColumn = table.getColumn(0); Value tableRowValue = tableRow.getColumnValue(0); Value tableColumnValue = tableColumn.getRowValue(0); - Request request = new Request(dataSource, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Column requestColumn = request.getColumn(0); Value requestRowValue = requestRow.getColumnValue(0); @@ -1714,7 +1710,7 @@ public void test_getColumnLetterCase() { Value valueAtEndPoint = rowAtEndPoint.getColumnValue(0); - Assertions.assertThat(datasourceWithLetterCase.getColumnLetterCase().getConversionName()).isSameAs(LetterCase.COLUMN_DEFAULT.getConversionName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getConversionName()).isSameAs(LetterCase.COLUMN_DEFAULT.getConversionName()); Assertions.assertThat(table.getColumnLetterCase().getConversionName()).isSameAs(LetterCase.COLUMN_DEFAULT.getConversionName()); Assertions.assertThat(tableRow.getColumnLetterCase().getConversionName()).isSameAs(LetterCase.COLUMN_DEFAULT.getConversionName()); @@ -1736,7 +1732,7 @@ public void test_getColumnLetterCase() { Assertions.assertThat(valueAtEndPoint.getColumnLetterCase().getConversionName()).isSameAs(LetterCase.COLUMN_DEFAULT.getConversionName()); - Assertions.assertThat(datasourceWithLetterCase.getColumnLetterCase().getComparisonName()).isSameAs(LetterCase.COLUMN_DEFAULT.getComparisonName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getComparisonName()).isSameAs(LetterCase.COLUMN_DEFAULT.getComparisonName()); Assertions.assertThat(table.getColumnLetterCase().getComparisonName()).isSameAs(LetterCase.COLUMN_DEFAULT.getComparisonName()); Assertions.assertThat(tableRow.getColumnLetterCase().getComparisonName()).isSameAs(LetterCase.COLUMN_DEFAULT.getComparisonName()); @@ -1761,12 +1757,10 @@ public void test_getColumnLetterCase() { @Test @NeedReload public void test_getPrimaryKeyLetterCase() { - DataSourceWithLetterCase datasourceWithLetterCase = (DataSourceWithLetterCase) dataSource; - - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); - Request request = new Request(dataSource, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Changes changes = new Changes(table).setStartPointNow(); @@ -1777,7 +1771,7 @@ public void test_getPrimaryKeyLetterCase() { Row rowAtEndPoint = change.getRowAtEndPoint(); - Assertions.assertThat(datasourceWithLetterCase.getPrimaryKeyLetterCase().getConversionName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getConversionName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getConversionName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getConversionName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getConversionName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getConversionName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getConversionName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getConversionName()); @@ -1791,7 +1785,7 @@ public void test_getPrimaryKeyLetterCase() { Assertions.assertThat(rowAtEndPoint.getPrimaryKeyLetterCase().getConversionName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getConversionName()); - Assertions.assertThat(datasourceWithLetterCase.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getComparisonName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getComparisonName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getComparisonName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(LetterCase.PRIMARY_KEY_DEFAULT.getComparisonName()); diff --git a/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_NSNSNS_Test.java b/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_NSNSNS_Test.java index 3076c32d..bb20827f 100644 --- a/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_NSNSNS_Test.java +++ b/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_NSNSNS_Test.java @@ -17,7 +17,6 @@ import static org.junit.Assert.fail; import java.io.ByteArrayOutputStream; -import javax.sql.DataSource; import org.assertj.core.api.Assertions; import org.assertj.db.common.NeedReload; @@ -27,7 +26,7 @@ import org.assertj.db.type.ChangeType; import org.assertj.db.type.Changes; import org.assertj.db.type.Column; -import org.assertj.db.type.DataSourceWithLetterCase; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Request; import org.assertj.db.type.Row; import org.assertj.db.type.Table; @@ -41,23 +40,24 @@ * Test on the H2 database. * * @author Régis Pouiller + * @author Julien Roy */ public class H2Database_DataSource_NSNSNS_Test extends AbstractH2Test { - private DataSource dataSource; + private ConnectionProvider connectionProvider; @Before public void init() { - dataSource = dataSourceNSNSNS; + connectionProvider = dsConnectionNSNSNS; } @Test @NeedReload public void test_Outputs_output() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -136,7 +136,7 @@ public void test_Outputs_output() { + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).as("display6").isEqualTo(String.format("[Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).as("display6").isEqualTo(String.format("[Changes on test table of 'data source']%n" + "|-----------|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -157,7 +157,7 @@ public void test_Outputs_output() { + "| Index : 1 | DELETION | test | |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | At end point | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "|-----------|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).as("display7").isEqualTo(String.format("[Change at index 0 of Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).as("display7").isEqualTo(String.format("[Change at index 0 of Changes on test table of 'data source']%n" + "|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -168,7 +168,7 @@ public void test_Outputs_output() { + "| CREATION | test | |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | At end point | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).as("display8").isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).as("display8").isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on test table of 'data source']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -177,14 +177,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream8.toString()).as("display9").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 of Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream8.toString()).as("display9").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 of Changes on test table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream9.toString()).as("display10").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 of Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream9.toString()).as("display10").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 of Changes on test table of 'data source']%n" + "|----------------|----------|%n" + "| | VAR1 |%n" + "| | (NUMBER) |%n" @@ -193,14 +193,14 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream10.toString()).as("display11").isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 of Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream10.toString()).as("display11").isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 of Changes on test table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream11.toString()).as("display12").isEqualTo(String.format("[Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream11.toString()).as("display12").isEqualTo(String.format("[Changes on TEST table of 'data source']%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -211,7 +211,7 @@ public void test_Outputs_output() { + "| Index : 0 | MODIFICATION | TEST | 1 |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | At end point | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream12.toString()).as("display13").isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream12.toString()).as("display13").isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -222,7 +222,7 @@ public void test_Outputs_output() { + "| MODIFICATION | TEST | 1 |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | At end point | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream13.toString()).as("display14").isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream13.toString()).as("display14").isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -231,14 +231,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| 1 | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream14.toString()).as("display15").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream14.toString()).as("display15").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream15.toString()).as("display16").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream15.toString()).as("display16").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|----------------|----------|%n" + "| | VAR1 |%n" + "| | (NUMBER) |%n" @@ -247,7 +247,7 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream16.toString()).as("display17").isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream16.toString()).as("display17").isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" @@ -259,9 +259,9 @@ public void test_Outputs_output() { @Test @NeedReload public void should_fail_because_primary_key_is_different() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -270,7 +270,7 @@ public void should_fail_because_primary_key_is_different() { assertThat(changes).change().hasPksNames("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message1").isEqualTo(String.format("[Change at index 0 of Changes on test table of a data source] %n" + Assertions.assertThat(e.getMessage()).as("message1").isEqualTo(String.format("[Change at index 0 of Changes on test table of 'data source'] %n" + "Expecting :%n" + " [\"var1\"]%n" + "to be the name of the columns of the primary keys but was:%n" @@ -281,7 +281,7 @@ public void should_fail_because_primary_key_is_different() { assertThat(changes2).change().hasPksNames("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message2").isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source] %n" + Assertions.assertThat(e.getMessage()).as("message2").isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source'] %n" + "Expecting :%n" + " [\"var1\"]%n" + "to be the name of the columns of the primary keys but was:%n" @@ -292,9 +292,9 @@ public void should_fail_because_primary_key_is_different() { @Test @NeedReload public void should_fail_because_column_name_is_different() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -324,7 +324,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes).change().column().hasColumnName("Var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message3").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 of Changes on test table of a data source] %n" + Assertions.assertThat(e.getMessage()).as("message3").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 of Changes on test table of 'data source'] %n" + "Expecting :%n" + " \"Var1\"%n" + "to be the name of the column but was:%n" @@ -334,7 +334,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes).change().rowAtEndPoint().value().hasColumnName("Var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message4").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 of Changes on test table of a data source] %n" + Assertions.assertThat(e.getMessage()).as("message4").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 of Changes on test table of 'data source'] %n" + "Expecting :%n" + " \"Var1\"%n" + "to be the name of the column but was:%n" @@ -345,7 +345,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes2).change().column().hasColumnName("Var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message5").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source] %n" + Assertions.assertThat(e.getMessage()).as("message5").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source'] %n" + "Expecting :%n" + " \"Var1\"%n" + "to be the name of the column but was:%n" @@ -355,7 +355,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes2).change().rowAtEndPoint().value().hasColumnName("Var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message6").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source] %n" + Assertions.assertThat(e.getMessage()).as("message6").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source'] %n" + "Expecting :%n" + " \"Var1\"%n" + "to be the name of the column but was:%n" @@ -366,9 +366,9 @@ public void should_fail_because_column_name_is_different() { @Test @NeedReload public void should_fail_because_column_name_is_wrong_to_navigate() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -428,9 +428,9 @@ public void should_fail_because_column_name_is_wrong_to_navigate() { @Test @NeedReload public void should_fail_because_table_name_is_different() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -439,7 +439,7 @@ public void should_fail_because_table_name_is_different() { assertThat(changes).change().isOnTable("teSt"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message1").isEqualTo(String.format("[Change at index 0 of Changes on test table of a data source] %n" + Assertions.assertThat(e.getMessage()).as("message1").isEqualTo(String.format("[Change at index 0 of Changes on test table of 'data source'] %n" + "Expecting to be on the table:%n" + " <\"teSt\">%n" + "but was on the table:%n" @@ -449,7 +449,7 @@ public void should_fail_because_table_name_is_different() { assertThat(changes2).change().isOnTable("teSt"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message2").isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source] %n" + Assertions.assertThat(e.getMessage()).as("message2").isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source'] %n" + "Expecting to be on the table:%n" + " <\"teSt\">%n" + "but was on the table:%n" @@ -460,9 +460,9 @@ public void should_fail_because_table_name_is_different() { @Test @NeedReload public void should_fail_because_table_name_is_wrong_to_navigate() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -509,9 +509,9 @@ public void should_fail_because_table_name_is_wrong_to_navigate() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -525,9 +525,9 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -541,11 +541,9 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_getTableLetterCase() { - DataSourceWithLetterCase datasourceWithLetterCase = (DataSourceWithLetterCase) dataSource; + Table table = new Table(connectionProvider, "test"); - Table table = new Table(dataSource, "test"); - - Request request = new Request(dataSource, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Changes changes = new Changes(table).setStartPointNow(); update(); @@ -553,7 +551,7 @@ public void test_getTableLetterCase() { Change change = changes.getChangesList().get(0); - Assertions.assertThat(datasourceWithLetterCase.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); Assertions.assertThat(table.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); @@ -563,7 +561,7 @@ public void test_getTableLetterCase() { Assertions.assertThat(change.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); - Assertions.assertThat(datasourceWithLetterCase.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); Assertions.assertThat(table.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); @@ -576,15 +574,13 @@ public void test_getTableLetterCase() { @Test @NeedReload public void test_getColumnLetterCase() { - DataSourceWithLetterCase datasourceWithLetterCase = (DataSourceWithLetterCase) dataSource; - - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); Column tableColumn = table.getColumn(0); Value tableRowValue = tableRow.getColumnValue(0); Value tableColumnValue = tableColumn.getRowValue(0); - Request request = new Request(dataSource, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Column requestColumn = request.getColumn(0); Value requestRowValue = requestRow.getColumnValue(0); @@ -600,7 +596,7 @@ public void test_getColumnLetterCase() { Value valueAtEndPoint = rowAtEndPoint.getColumnValue(0); - Assertions.assertThat(datasourceWithLetterCase.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); Assertions.assertThat(table.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); Assertions.assertThat(tableRow.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); @@ -622,7 +618,7 @@ public void test_getColumnLetterCase() { Assertions.assertThat(valueAtEndPoint.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); - Assertions.assertThat(datasourceWithLetterCase.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); Assertions.assertThat(table.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); Assertions.assertThat(tableRow.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); @@ -647,12 +643,10 @@ public void test_getColumnLetterCase() { @Test @NeedReload public void test_getPrimaryKeyLetterCase() { - DataSourceWithLetterCase datasourceWithLetterCase = (DataSourceWithLetterCase) dataSource; - - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); - Request request = new Request(dataSource, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Changes changes = new Changes(table).setStartPointNow(); @@ -663,7 +657,7 @@ public void test_getPrimaryKeyLetterCase() { Row rowAtEndPoint = change.getRowAtEndPoint(); - Assertions.assertThat(datasourceWithLetterCase.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); @@ -677,7 +671,7 @@ public void test_getPrimaryKeyLetterCase() { Assertions.assertThat(rowAtEndPoint.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); - Assertions.assertThat(datasourceWithLetterCase.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); diff --git a/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_UIUIUI_Test.java b/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_UIUIUI_Test.java index cbfb1c6d..a8e06c17 100644 --- a/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_UIUIUI_Test.java +++ b/src/test/java/org/assertj/db/database/h2/H2Database_DataSource_UIUIUI_Test.java @@ -21,14 +21,13 @@ import java.sql.Timestamp; import java.util.Locale; import java.util.UUID; -import javax.sql.DataSource; import org.assertj.core.api.Assertions; import org.assertj.db.common.NeedReload; import org.assertj.db.type.Change; import org.assertj.db.type.Changes; import org.assertj.db.type.Column; -import org.assertj.db.type.DataSourceWithLetterCase; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.DateTimeValue; import org.assertj.db.type.DateValue; import org.assertj.db.type.Request; @@ -46,20 +45,21 @@ * Test on the H2 database. * * @author Régis Pouiller + * @author Julien Roy */ public class H2Database_DataSource_UIUIUI_Test extends AbstractH2Test { - private DataSource dataSource; + private ConnectionProvider connectionProvider; @Before public void init() { - dataSource = dataSourceUIUIUI; + connectionProvider = dsConnectionUIUIUI; } @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -71,7 +71,7 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -208,7 +208,7 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -345,7 +345,7 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_ColumnEquality_hasValues() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -481,7 +481,7 @@ public void test_ColumnEquality_hasValues() { @Test @NeedReload public void test_ColumnEquality_containsValues() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -553,7 +553,7 @@ public void test_ColumnEquality_containsValues() { @Test @NeedReload public void test_ColumnType_isOfType() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -689,7 +689,7 @@ public void test_ColumnType_isOfType() { @Test @NeedReload public void test_ColumnOfChangeEquality_hasValues() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -841,7 +841,7 @@ public void test_ColumnOfChangeEquality_hasValues() { @Test @NeedReload public void test_RowEquality_hasValues() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -978,7 +978,7 @@ public void test_RowEquality_hasValues() { @Test @NeedReload public void test_ValueClass_isOfClass() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1115,7 +1115,7 @@ public void test_ValueClass_isOfClass() { @Test @NeedReload public void test_ValueEquality_isEqualTo() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1252,7 +1252,7 @@ public void test_ValueEquality_isEqualTo() { @Test @NeedReload public void test_ValueNonEquality_isNotEqualTo() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1389,7 +1389,7 @@ public void test_ValueNonEquality_isNotEqualTo() { @Test @NeedReload public void test_ValueType_isOfType() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1526,11 +1526,9 @@ public void test_ValueType_isOfType() { @Test @NeedReload public void test_getTableLetterCase() { - DataSourceWithLetterCase datasourceWithLetterCase = (DataSourceWithLetterCase) dataSource; + Table table = new Table(connectionProvider, "test"); - Table table = new Table(dataSource, "test"); - - Request request = new Request(dataSource, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Changes changes = new Changes(table).setStartPointNow(); update(); @@ -1538,7 +1536,7 @@ public void test_getTableLetterCase() { Change change = changes.getChangesList().get(0); - Assertions.assertThat(datasourceWithLetterCase.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); Assertions.assertThat(table.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); @@ -1548,7 +1546,7 @@ public void test_getTableLetterCase() { Assertions.assertThat(change.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); - Assertions.assertThat(datasourceWithLetterCase.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); Assertions.assertThat(table.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); @@ -1561,15 +1559,13 @@ public void test_getTableLetterCase() { @Test @NeedReload public void test_getColumnLetterCase() { - DataSourceWithLetterCase datasourceWithLetterCase = (DataSourceWithLetterCase) dataSource; - - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); Column tableColumn = table.getColumn(0); Value tableRowValue = tableRow.getColumnValue(0); Value tableColumnValue = tableColumn.getRowValue(0); - Request request = new Request(dataSource, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Column requestColumn = request.getColumn(0); Value requestRowValue = requestRow.getColumnValue(0); @@ -1585,7 +1581,7 @@ public void test_getColumnLetterCase() { Value valueAtEndPoint = rowAtEndPoint.getColumnValue(0); - Assertions.assertThat(datasourceWithLetterCase.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); Assertions.assertThat(table.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); Assertions.assertThat(tableRow.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); @@ -1607,7 +1603,7 @@ public void test_getColumnLetterCase() { Assertions.assertThat(valueAtEndPoint.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); - Assertions.assertThat(datasourceWithLetterCase.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); Assertions.assertThat(table.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); Assertions.assertThat(tableRow.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); @@ -1632,12 +1628,10 @@ public void test_getColumnLetterCase() { @Test @NeedReload public void test_getPrimaryKeyLetterCase() { - DataSourceWithLetterCase datasourceWithLetterCase = (DataSourceWithLetterCase) dataSource; - - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); - Request request = new Request(dataSource, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Changes changes = new Changes(table).setStartPointNow(); @@ -1648,7 +1642,7 @@ public void test_getPrimaryKeyLetterCase() { Row rowAtEndPoint = change.getRowAtEndPoint(); - Assertions.assertThat(datasourceWithLetterCase.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); @@ -1662,7 +1656,7 @@ public void test_getPrimaryKeyLetterCase() { Assertions.assertThat(rowAtEndPoint.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); - Assertions.assertThat(datasourceWithLetterCase.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); diff --git a/src/test/java/org/assertj/db/database/h2/H2Database_Source_NSNSNS_Test.java b/src/test/java/org/assertj/db/database/h2/H2Database_JdbcUrl_NSNSNS_Test.java similarity index 97% rename from src/test/java/org/assertj/db/database/h2/H2Database_Source_NSNSNS_Test.java rename to src/test/java/org/assertj/db/database/h2/H2Database_JdbcUrl_NSNSNS_Test.java index ade7a6d8..6e32fe7c 100644 --- a/src/test/java/org/assertj/db/database/h2/H2Database_Source_NSNSNS_Test.java +++ b/src/test/java/org/assertj/db/database/h2/H2Database_JdbcUrl_NSNSNS_Test.java @@ -26,10 +26,9 @@ import org.assertj.db.type.ChangeType; import org.assertj.db.type.Changes; import org.assertj.db.type.Column; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Request; import org.assertj.db.type.Row; -import org.assertj.db.type.Source; -import org.assertj.db.type.SourceWithLetterCase; import org.assertj.db.type.Table; import org.assertj.db.type.Value; import org.assertj.db.type.lettercase.CaseComparisons; @@ -41,21 +40,22 @@ * Test on the H2 database. * * @author Régis Pouiller + * @author Julien Roy */ -public class H2Database_Source_NSNSNS_Test extends AbstractH2Test { +public class H2Database_JdbcUrl_NSNSNS_Test extends AbstractH2Test { - private Source source; + private ConnectionProvider connectionProvider; @Before public void init() { - source = sourceNSNSNS; + connectionProvider = jdbcConnectionNSNSNS; } @NeedReload public void test_Outputs_output() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -134,7 +134,7 @@ public void test_Outputs_output() { + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on TEST table of 'data source']%n" + "|-----------|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -155,7 +155,7 @@ public void test_Outputs_output() { + "| Index : 1 | DELETION | test | |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | At end point | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "|-----------|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 of Changes on TEST table of 'data source']%n" + "|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -166,7 +166,7 @@ public void test_Outputs_output() { + "| CREATION | test | |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | At end point | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on TEST table of 'data source']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -175,14 +175,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 of Changes on TEST table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 of Changes on TEST table of 'data source']%n" + "|----------------|----------|%n" + "| | VAR1 |%n" + "| | (NUMBER) |%n" @@ -191,14 +191,14 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 of Changes on TEST table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream11.toString()).isEqualTo(String.format("[Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream11.toString()).isEqualTo(String.format("[Changes on TEST table of 'data source']%n" + "|-----------|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -219,7 +219,7 @@ public void test_Outputs_output() { + "| Index : 1 | DELETION | test | |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | At end point | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "|-----------|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream12.toString()).isEqualTo(String.format("[Change at index 0 of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream12.toString()).isEqualTo(String.format("[Change at index 0 of Changes on TEST table of 'data source']%n" + "|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -230,7 +230,7 @@ public void test_Outputs_output() { + "| CREATION | test | |----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | At end point | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|----------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream13.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream13.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 of Changes on TEST table of 'data source']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 | VAR20 | VAR21 | VAR22 | VAR23 | VAR24 | VAR25 | VAR26 | VAR27 | VAR28 | VAR29 | VAR30 | VAR31 | VAR32 | VAR33 | VAR34 | VAR35 | VAR36 | VAR37 | VAR38 | VAR39 | VAR40 | VAR41 | VAR42 | VAR43 | VAR44 | VAR45 | VAR46 | VAR47 | VAR48 | VAR49 | VAR50 | VAR51 | VAR52 | VAR53 | VAR54 | VAR55 | VAR56 | VAR57 | VAR58 | VAR59 | VAR60 | VAR61 |%n" @@ -239,14 +239,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n" + "| | 1 | 20 | 3 | 4 | 5 | 6 | true | false | true | 7 | 8 | 9 | 10 | 11 | 12 | 13.13 | 14.14 | 15.15 | 16.16 | 17.17 | 18.18 | 19.19 | 20.2 | 21.21 | 09:01:00.000000000 | 2007-12-23 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | 2007-12-23T09:01:00.000000000 | ... | ... | ... | ... | ... | fr | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ... | ... | ... | ... | ... | ... | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 30b443ae-c0c9-4790-9bec-ce1380808435 | null | null |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------|------------|-------------------------------|-------------------------------|-------------------------------|------------|------------|------------|------------|------------|-------------------------------------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|--------------------------------------|------------------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream14.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream14.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 of Changes on TEST table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream15.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream15.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 of Changes on TEST table of 'data source']%n" + "|----------------|----------|%n" + "| | VAR1 |%n" + "| | (NUMBER) |%n" @@ -255,7 +255,7 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream16.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream16.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 of Changes on TEST table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" @@ -267,9 +267,9 @@ public void test_Outputs_output() { @Test @NeedReload public void should_fail_because_primary_key_is_different() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -278,7 +278,7 @@ public void should_fail_because_primary_key_is_different() { assertThat(changes).change().hasPksNames("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on test table of 'sa/jdbc:h2:mem:testH2' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on test table of 'sa/jdbc:h2:mem:testH2'] %n" + "Expecting :%n" + " [\"var1\"]%n" + "to be the name of the columns of the primary keys but was:%n" @@ -289,7 +289,7 @@ public void should_fail_because_primary_key_is_different() { assertThat(changes2).change().hasPksNames("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2'] %n" + "Expecting :%n" + " [\"var1\"]%n" + "to be the name of the columns of the primary keys but was:%n" @@ -300,9 +300,9 @@ public void should_fail_because_primary_key_is_different() { @Test @NeedReload public void should_fail_because_column_name_is_different() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -333,7 +333,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes).change().column().hasColumnName("Var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message3").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 of Changes on test table of 'sa/jdbc:h2:mem:testH2' source] %n" + Assertions.assertThat(e.getMessage()).as("message3").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 of Changes on test table of 'sa/jdbc:h2:mem:testH2'] %n" + "Expecting :%n" + " \"Var1\"%n" + "to be the name of the column but was:%n" @@ -343,7 +343,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes).change().rowAtEndPoint().value().hasColumnName("Var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message4").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 of Changes on test table of 'sa/jdbc:h2:mem:testH2' source] %n" + Assertions.assertThat(e.getMessage()).as("message4").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 of Changes on test table of 'sa/jdbc:h2:mem:testH2'] %n" + "Expecting :%n" + " \"Var1\"%n" + "to be the name of the column but was:%n" @@ -354,7 +354,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes2).change().column().hasColumnName("Var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message5").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2' source] %n" + Assertions.assertThat(e.getMessage()).as("message5").isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2'] %n" + "Expecting :%n" + " \"Var1\"%n" + "to be the name of the column but was:%n" @@ -364,7 +364,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes2).change().rowAtEndPoint().value().hasColumnName("Var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).as("message6").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2' source] %n" + Assertions.assertThat(e.getMessage()).as("message6").isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2'] %n" + "Expecting :%n" + " \"Var1\"%n" + "to be the name of the column but was:%n" @@ -375,9 +375,9 @@ public void should_fail_because_column_name_is_different() { @Test @NeedReload public void should_fail_because_column_name_is_wrong_to_navigate() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -437,9 +437,9 @@ public void should_fail_because_column_name_is_wrong_to_navigate() { @Test @NeedReload public void should_fail_because_table_name_is_different() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -448,7 +448,7 @@ public void should_fail_because_table_name_is_different() { assertThat(changes).change().isOnTable("teSt"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on test table of 'sa/jdbc:h2:mem:testH2' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 of Changes on test table of 'sa/jdbc:h2:mem:testH2'] %n" + "Expecting to be on the table:%n" + " <\"teSt\">%n" + "but was on the table:%n" @@ -458,7 +458,7 @@ public void should_fail_because_table_name_is_different() { assertThat(changes2).change().isOnTable("teSt"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:testH2'] %n" + "Expecting to be on the table:%n" + " <\"teSt\">%n" + "but was on the table:%n" @@ -469,9 +469,9 @@ public void should_fail_because_table_name_is_different() { @Test @NeedReload public void should_fail_because_table_name_is_wrong_to_navigate() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -518,9 +518,9 @@ public void should_fail_because_table_name_is_wrong_to_navigate() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -534,9 +534,9 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -550,11 +550,9 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_getTableLetterCase() { - SourceWithLetterCase sourceWithLetterCase = (SourceWithLetterCase) source; + Table table = new Table(connectionProvider, "test"); - Table table = new Table(source, "test"); - - Request request = new Request(source, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Changes changes = new Changes(table).setStartPointNow(); update(); @@ -562,7 +560,7 @@ public void test_getTableLetterCase() { Change change = changes.getChangesList().get(0); - Assertions.assertThat(sourceWithLetterCase.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); Assertions.assertThat(table.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); @@ -572,7 +570,7 @@ public void test_getTableLetterCase() { Assertions.assertThat(change.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); - Assertions.assertThat(sourceWithLetterCase.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); Assertions.assertThat(table.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); @@ -585,15 +583,13 @@ public void test_getTableLetterCase() { @Test @NeedReload public void test_getColumnLetterCase() { - SourceWithLetterCase sourceWithLetterCase = (SourceWithLetterCase) source; - - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); Column tableColumn = table.getColumn(0); Value tableRowValue = tableRow.getColumnValue(0); Value tableColumnValue = tableColumn.getRowValue(0); - Request request = new Request(source, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Column requestColumn = request.getColumn(0); Value requestRowValue = requestRow.getColumnValue(0); @@ -609,7 +605,7 @@ public void test_getColumnLetterCase() { Value valueAtEndPoint = rowAtEndPoint.getColumnValue(0); - Assertions.assertThat(sourceWithLetterCase.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); Assertions.assertThat(table.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); Assertions.assertThat(tableRow.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); @@ -631,7 +627,7 @@ public void test_getColumnLetterCase() { Assertions.assertThat(valueAtEndPoint.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); - Assertions.assertThat(sourceWithLetterCase.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); Assertions.assertThat(table.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); Assertions.assertThat(tableRow.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); @@ -656,12 +652,10 @@ public void test_getColumnLetterCase() { @Test @NeedReload public void test_getPrimaryKeyLetterCase() { - SourceWithLetterCase sourceWithLetterCase = (SourceWithLetterCase) source; - - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); - Request request = new Request(source, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Changes changes = new Changes(table).setStartPointNow(); @@ -672,7 +666,7 @@ public void test_getPrimaryKeyLetterCase() { Row rowAtEndPoint = change.getRowAtEndPoint(); - Assertions.assertThat(sourceWithLetterCase.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); @@ -686,7 +680,7 @@ public void test_getPrimaryKeyLetterCase() { Assertions.assertThat(rowAtEndPoint.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.NO.getConversionName()); - Assertions.assertThat(sourceWithLetterCase.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.STRICT.getComparisonName()); diff --git a/src/test/java/org/assertj/db/database/h2/H2Database_Source_UIUIUI_Test.java b/src/test/java/org/assertj/db/database/h2/H2Database_JdbcUrl_UIUIUI_Test.java similarity index 97% rename from src/test/java/org/assertj/db/database/h2/H2Database_Source_UIUIUI_Test.java rename to src/test/java/org/assertj/db/database/h2/H2Database_JdbcUrl_UIUIUI_Test.java index 3efd9fb5..48f7fc5f 100644 --- a/src/test/java/org/assertj/db/database/h2/H2Database_Source_UIUIUI_Test.java +++ b/src/test/java/org/assertj/db/database/h2/H2Database_JdbcUrl_UIUIUI_Test.java @@ -27,12 +27,11 @@ import org.assertj.db.type.Change; import org.assertj.db.type.Changes; import org.assertj.db.type.Column; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.DateTimeValue; import org.assertj.db.type.DateValue; import org.assertj.db.type.Request; import org.assertj.db.type.Row; -import org.assertj.db.type.Source; -import org.assertj.db.type.SourceWithLetterCase; import org.assertj.db.type.Table; import org.assertj.db.type.TimeValue; import org.assertj.db.type.Value; @@ -46,20 +45,21 @@ * Test on the H2 database. * * @author Régis Pouiller + * @author Julien Roy */ -public class H2Database_Source_UIUIUI_Test extends AbstractH2Test { +public class H2Database_JdbcUrl_UIUIUI_Test extends AbstractH2Test { - private Source source; + private ConnectionProvider connectionProvider; @Before public void init() { - source = sourceUIUIUI; + connectionProvider = jdbcConnectionUIUIUI; } @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -71,7 +71,7 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -208,7 +208,7 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -345,7 +345,7 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_ColumnEquality_hasValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -481,7 +481,7 @@ public void test_ColumnEquality_hasValues() { @Test @NeedReload public void test_ColumnEquality_containsValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -553,7 +553,7 @@ public void test_ColumnEquality_containsValues() { @Test @NeedReload public void test_ColumnType_isOfType() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -689,7 +689,7 @@ public void test_ColumnType_isOfType() { @Test @NeedReload public void test_ColumnOfChangeEquality_hasValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -841,7 +841,7 @@ public void test_ColumnOfChangeEquality_hasValues() { @Test @NeedReload public void test_RowEquality_hasValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -978,7 +978,7 @@ public void test_RowEquality_hasValues() { @Test @NeedReload public void test_ValueClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1115,7 +1115,7 @@ public void test_ValueClass_isOfClass() { @Test @NeedReload public void test_ValueEquality_isEqualTo() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1252,7 +1252,7 @@ public void test_ValueEquality_isEqualTo() { @Test @NeedReload public void test_ValueNonEquality_isNotEqualTo() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1389,7 +1389,7 @@ public void test_ValueNonEquality_isNotEqualTo() { @Test @NeedReload public void test_ValueType_isOfType() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -1526,11 +1526,9 @@ public void test_ValueType_isOfType() { @Test @NeedReload public void test_getTableLetterCase() { - SourceWithLetterCase sourceWithLetterCase = (SourceWithLetterCase) source; + Table table = new Table(connectionProvider, "test"); - Table table = new Table(source, "test"); - - Request request = new Request(source, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Changes changes = new Changes(table).setStartPointNow(); update(); @@ -1538,7 +1536,7 @@ public void test_getTableLetterCase() { Change change = changes.getChangesList().get(0); - Assertions.assertThat(sourceWithLetterCase.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); Assertions.assertThat(table.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); @@ -1548,7 +1546,7 @@ public void test_getTableLetterCase() { Assertions.assertThat(change.getTableLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); - Assertions.assertThat(sourceWithLetterCase.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); + Assertions.assertThat(connectionProvider.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); Assertions.assertThat(table.getTableLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); @@ -1561,15 +1559,13 @@ public void test_getTableLetterCase() { @Test @NeedReload public void test_getColumnLetterCase() { - SourceWithLetterCase sourceWithLetterCase = (SourceWithLetterCase) source; - - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); Column tableColumn = table.getColumn(0); Value tableRowValue = tableRow.getColumnValue(0); Value tableColumnValue = tableColumn.getRowValue(0); - Request request = new Request(source, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Column requestColumn = request.getColumn(0); Value requestRowValue = requestRow.getColumnValue(0); @@ -1585,7 +1581,7 @@ public void test_getColumnLetterCase() { Value valueAtEndPoint = rowAtEndPoint.getColumnValue(0); - Assertions.assertThat(sourceWithLetterCase.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); Assertions.assertThat(table.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); Assertions.assertThat(tableRow.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); @@ -1607,7 +1603,7 @@ public void test_getColumnLetterCase() { Assertions.assertThat(valueAtEndPoint.getColumnLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); - Assertions.assertThat(sourceWithLetterCase.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); + Assertions.assertThat(connectionProvider.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); Assertions.assertThat(table.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); Assertions.assertThat(tableRow.getColumnLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); @@ -1632,12 +1628,10 @@ public void test_getColumnLetterCase() { @Test @NeedReload public void test_getPrimaryKeyLetterCase() { - SourceWithLetterCase sourceWithLetterCase = (SourceWithLetterCase) source; - - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Row tableRow = table.getRow(0); - Request request = new Request(source, "select * from test"); + Request request = new Request(connectionProvider, "select * from test"); Row requestRow = request.getRow(0); Changes changes = new Changes(table).setStartPointNow(); @@ -1648,7 +1642,7 @@ public void test_getPrimaryKeyLetterCase() { Row rowAtEndPoint = change.getRowAtEndPoint(); - Assertions.assertThat(sourceWithLetterCase.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); @@ -1662,7 +1656,7 @@ public void test_getPrimaryKeyLetterCase() { Assertions.assertThat(rowAtEndPoint.getPrimaryKeyLetterCase().getConversionName()).isSameAs(CaseConversions.UPPER.getConversionName()); - Assertions.assertThat(sourceWithLetterCase.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); + Assertions.assertThat(connectionProvider.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); Assertions.assertThat(table.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); Assertions.assertThat(tableRow.getPrimaryKeyLetterCase().getComparisonName()).isSameAs(CaseComparisons.IGNORE.getComparisonName()); diff --git a/src/test/java/org/assertj/db/database/h2/ReservedH2DataBase_Test.java b/src/test/java/org/assertj/db/database/h2/ReservedH2DataBase_Test.java index 4006dbec..d35c3c23 100644 --- a/src/test/java/org/assertj/db/database/h2/ReservedH2DataBase_Test.java +++ b/src/test/java/org/assertj/db/database/h2/ReservedH2DataBase_Test.java @@ -44,7 +44,7 @@ public void test_catalog_for_data_source() throws SQLException { } @Test - public void test_catalog_for_source() throws SQLException { + public void test_catalogfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { String catalog = connection.getCatalog(); assertThat(catalog).isEqualTo("TESTRESERVEDH2"); @@ -60,7 +60,7 @@ public void test_schema_for_data_source() throws SQLException { } @Test - public void test_schema_for_source() throws SQLException { + public void test_schemafor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { String schema = connection.getSchema(); assertThat(schema).isEqualTo("PUBLIC"); @@ -81,7 +81,7 @@ public void test_tables_for_data_source() throws SQLException { } @Test - public void test_tables_for_source() throws SQLException { + public void test_tablesfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); ResultSet resultSet = databaseMetaData.getTables("TESTRESERVEDH2", null, null, new String[]{"TABLE"}); @@ -117,7 +117,7 @@ public void test_table_primary_keys_for_data_source() throws SQLException { } @Test - public void test_table_primary_keys_for_source() throws SQLException { + public void test_table_primary_keysfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); { @@ -177,7 +177,7 @@ public void test_table_columns_for_data_source() throws SQLException { } @Test - public void test_table_columns_for_source() throws SQLException { + public void test_table_columnsfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); { @@ -239,7 +239,7 @@ public void test_request_columns_for_data_source() throws SQLException { } @Test - public void test_request_columns_for_source() throws SQLException { + public void test_request_columnsfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { try (Statement statement = connection.createStatement()) { try (ResultSet resultSet1 = statement.executeQuery("select * from `group`")) { diff --git a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_DDD_Test.java b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_DDD_Test.java index 16f93ae6..bc49ab63 100644 --- a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_DDD_Test.java +++ b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_DDD_Test.java @@ -14,10 +14,9 @@ import static org.assertj.db.api.Assertions.assertThat; -import javax.sql.DataSource; - import org.assertj.db.common.NeedReload; import org.assertj.db.type.Changes; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Table; import org.assertj.db.type.Table.Order; import org.junit.Before; @@ -27,21 +26,22 @@ * Test on the H2 database with reserved names in SQL structure. * * @author Régis Pouiller + * @author Julien Roy */ public class ReservedH2Database_DataSource_DDD_Test extends AbstractReservedH2Test { - private DataSource dataSource; + private ConnectionProvider connectionProvider; @Before public void init() { - dataSource = dataSourceDDD; + connectionProvider = dsConnectionDDD; } @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table1 = new Table(dataSource, "group", '`', '`'); - Table table2 = new Table(dataSource, "two words", '`', '`'); + Table table1 = new Table(connectionProvider, "group", '`', '`'); + Table table2 = new Table(connectionProvider, "two words", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -58,8 +58,8 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table1 = new Table(dataSource, "group", '`', '`'); - Table table2 = new Table(dataSource, "two words", '`', '`'); + Table table1 = new Table(connectionProvider, "group", '`', '`'); + Table table2 = new Table(connectionProvider, "two words", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -100,11 +100,11 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_check() { - Table table1 = new Table(dataSource, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToCheck(new String[]{ "read", "by", "select", "from" }); - Table table2 = new Table(dataSource, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToCheck(new String[]{ "primary key", "column name", "test%test" }); @@ -144,11 +144,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_check() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_exclude() { - Table table1 = new Table(dataSource, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToExclude(new String[]{ "read", "by", "from" }); - Table table2 = new Table(dataSource, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToExclude(new String[]{ "column name" }); @@ -184,11 +184,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_exclude() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_order() { - Table table1 = new Table(dataSource, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("where") }); - Table table2 = new Table(dataSource, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("primary key") }); diff --git a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_NSNSNS_Test.java b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_NSNSNS_Test.java index 3723d07d..e062982a 100644 --- a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_NSNSNS_Test.java +++ b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_NSNSNS_Test.java @@ -14,10 +14,9 @@ import static org.assertj.db.api.Assertions.assertThat; -import javax.sql.DataSource; - import org.assertj.db.common.NeedReload; import org.assertj.db.type.Changes; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Table; import org.assertj.db.type.Table.Order; import org.junit.Before; @@ -27,21 +26,22 @@ * Test on the H2 database with reserved names in SQL structure. * * @author Régis Pouiller + * @author Julien Roy */ public class ReservedH2Database_DataSource_NSNSNS_Test extends AbstractReservedH2Test { - private DataSource dataSource; + private ConnectionProvider connectionProvider; @Before public void init() { - dataSource = dataSourceNSNSNS; + connectionProvider = dsConnectionNSNSNS; } @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table1 = new Table(dataSource, "GROUP", '`', '`'); - Table table2 = new Table(dataSource, "TWO WORDS", '`', '`'); + Table table1 = new Table(connectionProvider, "GROUP", '`', '`'); + Table table2 = new Table(connectionProvider, "TWO WORDS", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -57,8 +57,8 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table1 = new Table(dataSource, "GROUP", '`', '`'); - Table table2 = new Table(dataSource, "TWO WORDS", '`', '`'); + Table table1 = new Table(connectionProvider, "GROUP", '`', '`'); + Table table2 = new Table(connectionProvider, "TWO WORDS", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -99,11 +99,11 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_check() { - Table table1 = new Table(dataSource, "GROUP", '`', '`') + Table table1 = new Table(connectionProvider, "GROUP", '`', '`') .setColumnsToCheck(new String[]{ "READ", "BY", "SELECT", "FROM" }); - Table table2 = new Table(dataSource, "TWO WORDS", '`', '`') + Table table2 = new Table(connectionProvider, "TWO WORDS", '`', '`') .setColumnsToCheck(new String[]{ "PRIMARY KEY", "COLUMN NAME", "TEST%TEST" }); @@ -143,11 +143,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_check() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_exclude() { - Table table1 = new Table(dataSource, "GROUP", '`', '`') + Table table1 = new Table(connectionProvider, "GROUP", '`', '`') .setColumnsToExclude(new String[]{ "READ", "BY", "FROM" }); - Table table2 = new Table(dataSource, "TWO WORDS", '`', '`') + Table table2 = new Table(connectionProvider, "TWO WORDS", '`', '`') .setColumnsToExclude(new String[]{ "COLUMN NAME" }); @@ -183,11 +183,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_exclude() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_order() { - Table table1 = new Table(dataSource, "GROUP", '`', '`') + Table table1 = new Table(connectionProvider, "GROUP", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("WHERE") }); - Table table2 = new Table(dataSource, "TWO WORDS", '`', '`') + Table table2 = new Table(connectionProvider, "TWO WORDS", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("PRIMARY KEY") }); diff --git a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_UIUIUI_Test.java b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_UIUIUI_Test.java index 84395bdb..befbc0ea 100644 --- a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_UIUIUI_Test.java +++ b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_DataSource_UIUIUI_Test.java @@ -14,10 +14,9 @@ import static org.assertj.db.api.Assertions.assertThat; -import javax.sql.DataSource; - import org.assertj.db.common.NeedReload; import org.assertj.db.type.Changes; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Table; import org.assertj.db.type.Table.Order; import org.junit.Before; @@ -27,21 +26,22 @@ * Test on the H2 database with reserved names in SQL structure. * * @author Régis Pouiller + * @author Julien Roy */ public class ReservedH2Database_DataSource_UIUIUI_Test extends AbstractReservedH2Test { - private DataSource dataSource; + private ConnectionProvider connectionProvider; @Before public void init() { - dataSource = dataSourceUIUIUI; + connectionProvider = dsConnectionUIUIUI; } @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table1 = new Table(dataSource, "group", '`', '`'); - Table table2 = new Table(dataSource, "two words", '`', '`'); + Table table1 = new Table(connectionProvider, "group", '`', '`'); + Table table2 = new Table(connectionProvider, "two words", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -58,8 +58,8 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table1 = new Table(dataSource, "group", '`', '`'); - Table table2 = new Table(dataSource, "two words", '`', '`'); + Table table1 = new Table(connectionProvider, "group", '`', '`'); + Table table2 = new Table(connectionProvider, "two words", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -100,11 +100,11 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_check() { - Table table1 = new Table(dataSource, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToCheck(new String[]{ "read", "by", "select", "from" }); - Table table2 = new Table(dataSource, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToCheck(new String[]{ "primary key", "column name", "test%test" }); @@ -144,11 +144,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_check() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_exclude() { - Table table1 = new Table(dataSource, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToExclude(new String[]{ "read", "by", "from" }); - Table table2 = new Table(dataSource, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToExclude(new String[]{ "column name" }); @@ -184,11 +184,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_exclude() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_order() { - Table table1 = new Table(dataSource, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("where") }); - Table table2 = new Table(dataSource, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("primary key") }); diff --git a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_Source_DDD_Test.java b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_JdbcUrl_DDD_Test.java similarity index 86% rename from src/test/java/org/assertj/db/database/h2/ReservedH2Database_Source_DDD_Test.java rename to src/test/java/org/assertj/db/database/h2/ReservedH2Database_JdbcUrl_DDD_Test.java index 5b1088dd..0d668687 100644 --- a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_Source_DDD_Test.java +++ b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_JdbcUrl_DDD_Test.java @@ -16,7 +16,7 @@ import org.assertj.db.common.NeedReload; import org.assertj.db.type.Changes; -import org.assertj.db.type.Source; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Table; import org.assertj.db.type.Table.Order; import org.junit.Before; @@ -26,21 +26,22 @@ * Test on the H2 database with reserved names in SQL structure. * * @author Régis Pouiller + * @author Julien Roy */ -public class ReservedH2Database_Source_DDD_Test extends AbstractReservedH2Test { +public class ReservedH2Database_JdbcUrl_DDD_Test extends AbstractReservedH2Test { - private Source source; + private ConnectionProvider connectionProvider; @Before public void init() { - source = sourceDDD; + connectionProvider = jdbcConnectionDDD; } @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table1 = new Table(source, "group", '`', '`'); - Table table2 = new Table(source, "two words", '`', '`'); + Table table1 = new Table(connectionProvider, "group", '`', '`'); + Table table2 = new Table(connectionProvider, "two words", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -56,8 +57,8 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table1 = new Table(source, "group", '`', '`'); - Table table2 = new Table(source, "two words", '`', '`'); + Table table1 = new Table(connectionProvider, "group", '`', '`'); + Table table2 = new Table(connectionProvider, "two words", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -98,11 +99,11 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_check() { - Table table1 = new Table(source, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToCheck(new String[]{ "read", "by", "select", "from" }); - Table table2 = new Table(source, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToCheck(new String[]{ "primary key", "column name", "test%test" }); @@ -142,11 +143,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_check() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_exclude() { - Table table1 = new Table(source, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToExclude(new String[]{ "read", "by", "from" }); - Table table2 = new Table(source, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToExclude(new String[]{ "column name" }); @@ -182,11 +183,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_exclude() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_order() { - Table table1 = new Table(source, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("where") }); - Table table2 = new Table(source, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("primary key") }); diff --git a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_Source_NSNSNS_Test.java b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_JdbcUrl_NSNSNS_Test.java similarity index 86% rename from src/test/java/org/assertj/db/database/h2/ReservedH2Database_Source_NSNSNS_Test.java rename to src/test/java/org/assertj/db/database/h2/ReservedH2Database_JdbcUrl_NSNSNS_Test.java index 1a204299..05d3ddac 100644 --- a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_Source_NSNSNS_Test.java +++ b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_JdbcUrl_NSNSNS_Test.java @@ -16,7 +16,7 @@ import org.assertj.db.common.NeedReload; import org.assertj.db.type.Changes; -import org.assertj.db.type.Source; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Table; import org.assertj.db.type.Table.Order; import org.junit.Before; @@ -26,21 +26,22 @@ * Test on the H2 database with reserved names in SQL structure. * * @author Régis Pouiller + * @author Julien Roy */ -public class ReservedH2Database_Source_NSNSNS_Test extends AbstractReservedH2Test { +public class ReservedH2Database_JdbcUrl_NSNSNS_Test extends AbstractReservedH2Test { - private Source source; + private ConnectionProvider connectionProvider; @Before public void init() { - source = sourceNSNSNS; + connectionProvider = jdbcConnectionNSNSNS; } @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table1 = new Table(source, "GROUP", '`', '`'); - Table table2 = new Table(source, "TWO WORDS", '`', '`'); + Table table1 = new Table(connectionProvider, "GROUP", '`', '`'); + Table table2 = new Table(connectionProvider, "TWO WORDS", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -56,8 +57,8 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table1 = new Table(source, "GROUP", '`', '`'); - Table table2 = new Table(source, "TWO WORDS", '`', '`'); + Table table1 = new Table(connectionProvider, "GROUP", '`', '`'); + Table table2 = new Table(connectionProvider, "TWO WORDS", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -98,11 +99,11 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_check() { - Table table1 = new Table(source, "GROUP", '`', '`') + Table table1 = new Table(connectionProvider, "GROUP", '`', '`') .setColumnsToCheck(new String[]{ "READ", "BY", "SELECT", "FROM" }); - Table table2 = new Table(source, "TWO WORDS", '`', '`') + Table table2 = new Table(connectionProvider, "TWO WORDS", '`', '`') .setColumnsToCheck(new String[]{ "PRIMARY KEY", "COLUMN NAME", "TEST%TEST" }); @@ -142,11 +143,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_check() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_exclude() { - Table table1 = new Table(source, "GROUP", '`', '`') + Table table1 = new Table(connectionProvider, "GROUP", '`', '`') .setColumnsToExclude(new String[]{ "READ", "BY", "FROM" }); - Table table2 = new Table(source, "TWO WORDS", '`', '`') + Table table2 = new Table(connectionProvider, "TWO WORDS", '`', '`') .setColumnsToExclude(new String[]{ "COLUMN NAME" }); @@ -182,11 +183,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_exclude() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_order() { - Table table1 = new Table(source, "GROUP", '`', '`') + Table table1 = new Table(connectionProvider, "GROUP", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("WHERE") }); - Table table2 = new Table(source, "TWO WORDS", '`', '`') + Table table2 = new Table(connectionProvider, "TWO WORDS", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("PRIMARY KEY") }); diff --git a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_Source_UIUIUI_Test.java b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_JdbcUrl_UIUIUI_Test.java similarity index 86% rename from src/test/java/org/assertj/db/database/h2/ReservedH2Database_Source_UIUIUI_Test.java rename to src/test/java/org/assertj/db/database/h2/ReservedH2Database_JdbcUrl_UIUIUI_Test.java index fae85ba9..cbec650a 100644 --- a/src/test/java/org/assertj/db/database/h2/ReservedH2Database_Source_UIUIUI_Test.java +++ b/src/test/java/org/assertj/db/database/h2/ReservedH2Database_JdbcUrl_UIUIUI_Test.java @@ -16,7 +16,7 @@ import org.assertj.db.common.NeedReload; import org.assertj.db.type.Changes; -import org.assertj.db.type.Source; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Table; import org.assertj.db.type.Table.Order; import org.junit.Before; @@ -26,21 +26,22 @@ * Test on the H2 database with reserved names in SQL structure. * * @author Régis Pouiller + * @author Julien Roy */ -public class ReservedH2Database_Source_UIUIUI_Test extends AbstractReservedH2Test { +public class ReservedH2Database_JdbcUrl_UIUIUI_Test extends AbstractReservedH2Test { - private Source source; + private ConnectionProvider connectionProvider; @Before public void init() { - source = sourceUIUIUI; + connectionProvider = jdbcConnectionUIUIUI; } @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table1 = new Table(source, "group", '`', '`'); - Table table2 = new Table(source, "two words", '`', '`'); + Table table1 = new Table(connectionProvider, "group", '`', '`'); + Table table2 = new Table(connectionProvider, "two words", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -57,8 +58,8 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table1 = new Table(source, "group", '`', '`'); - Table table2 = new Table(source, "two words", '`', '`'); + Table table1 = new Table(connectionProvider, "group", '`', '`'); + Table table2 = new Table(connectionProvider, "two words", '`', '`'); Changes changes1 = new Changes(table1).setStartPointNow(); Changes changes2 = new Changes(table2).setStartPointNow(); update(); @@ -99,11 +100,11 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_check() { - Table table1 = new Table(source, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToCheck(new String[]{ "read", "by", "select", "from" }); - Table table2 = new Table(source, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToCheck(new String[]{ "primary key", "column name", "test%test" }); @@ -143,11 +144,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_check() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_columns_to_exclude() { - Table table1 = new Table(source, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToExclude(new String[]{ "read", "by", "from" }); - Table table2 = new Table(source, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToExclude(new String[]{ "column name" }); @@ -183,11 +184,11 @@ public void test_ColumnName_hasColumnName_with_columns_to_exclude() { @Test @NeedReload public void test_ColumnName_hasColumnName_with_order() { - Table table1 = new Table(source, "group", '`', '`') + Table table1 = new Table(connectionProvider, "group", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("where") }); - Table table2 = new Table(source, "two words", '`', '`') + Table table2 = new Table(connectionProvider, "two words", '`', '`') .setColumnsToOrder(new Order[]{ Order.asc("primary key") }); diff --git a/src/test/java/org/assertj/db/database/hsqldb/AbstractHsqldbTest.java b/src/test/java/org/assertj/db/database/hsqldb/AbstractHsqldbTest.java index 6d5594e5..1af758f1 100644 --- a/src/test/java/org/assertj/db/database/hsqldb/AbstractHsqldbTest.java +++ b/src/test/java/org/assertj/db/database/hsqldb/AbstractHsqldbTest.java @@ -26,8 +26,8 @@ import javax.sql.DataSource; import org.assertj.db.database.AbstractDatabaseTest; -import org.assertj.db.type.DataSourceWithLetterCase; -import org.assertj.db.type.SourceWithLetterCase; +import org.assertj.db.type.ConnectionProvider; +import org.assertj.db.type.ConnectionProviderFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; @@ -40,6 +40,7 @@ * Parent for all the tests which are specific for HSQLDB database. * * @author Régis Pouiller + * @author Julien Roy */ @ContextConfiguration(classes = {HsqldbConfiguration.class}) public abstract class AbstractHsqldbTest extends AbstractDatabaseTest { @@ -77,12 +78,12 @@ public abstract class AbstractHsqldbTest extends AbstractDatabaseTest { private static final DbSetup DB_SETUP = new DbSetup(new DriverManagerDestination("jdbc:hsqldb:mem:testHsqldb", "SA", ""), OPERATIONS); - protected final SourceWithLetterCase sourceUIUIUI = new SourceWithLetterCase("jdbc:hsqldb:mem:testHsqldb", "SA", "", + protected final ConnectionProvider jdbcConnectionUIUIUI = ConnectionProviderFactory.of("jdbc:hsqldb:mem:testHsqldb", "SA", "").letterCase( letterCaseUI, letterCaseUI, - letterCaseUI); - protected DataSourceWithLetterCase dataSourceUIUIUI; - protected DataSourceWithLetterCase dataSourceNSNSNS; + letterCaseUI).create(); + protected ConnectionProvider dsConnectionUIUIUI; + protected ConnectionProvider dsConnectionNSNSNS; protected DbSetup getDbSetup() { return DB_SETUP; @@ -94,8 +95,8 @@ protected DbSetupTracker getDbSetupTracker() { @Autowired protected void setDataSource(DataSource dataSource) { - this.dataSourceUIUIUI = new DataSourceWithLetterCase(dataSource, letterCaseUI, letterCaseUI, letterCaseUI); - this.dataSourceNSNSNS = new DataSourceWithLetterCase(dataSource, letterCaseNS, letterCaseNS, letterCaseNS); + this.dsConnectionUIUIUI = ConnectionProviderFactory.of(dataSource).letterCase(letterCaseUI, letterCaseUI, letterCaseUI).create(); + this.dsConnectionNSNSNS = ConnectionProviderFactory.of(dataSource).letterCase(letterCaseNS, letterCaseNS, letterCaseNS).create(); } protected void update() { diff --git a/src/test/java/org/assertj/db/database/hsqldb/HsqldbDataBase_Test.java b/src/test/java/org/assertj/db/database/hsqldb/HsqldbDataBase_Test.java index 62bb0e02..8eb7bb83 100644 --- a/src/test/java/org/assertj/db/database/hsqldb/HsqldbDataBase_Test.java +++ b/src/test/java/org/assertj/db/database/hsqldb/HsqldbDataBase_Test.java @@ -44,7 +44,7 @@ public void test_catalog_for_data_source() throws SQLException { } @Test - public void test_catalog_for_source() throws SQLException { + public void test_catalogfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { String catalog = connection.getCatalog(); assertThat(catalog).isEqualTo("PUBLIC"); @@ -60,7 +60,7 @@ public void test_schema_for_data_source() throws SQLException { } @Test - public void test_schema_for_source() throws SQLException { + public void test_schemafor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { String schema = connection.getSchema(); assertThat(schema).isEqualTo("PUBLIC"); @@ -79,7 +79,7 @@ public void test_tables_for_data_source() throws SQLException { } @Test - public void test_tables_for_source() throws SQLException { + public void test_tablesfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); ResultSet resultSet = databaseMetaData.getTables("PUBLIC", "PUBLIC", null, new String[]{"TABLE"}); @@ -107,7 +107,7 @@ public void test_table_primary_keys_for_data_source() throws SQLException { } @Test - public void test_table_primary_keys_for_source() throws SQLException { + public void test_table_primary_keysfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); { @@ -191,7 +191,7 @@ public void test_table_columns_for_data_source() throws SQLException { } @Test - public void test_table_columns_for_source() throws SQLException { + public void test_table_columnsfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); { @@ -296,7 +296,7 @@ public void test_request_columns_for_data_source() throws SQLException { } @Test - public void test_request_columns_for_source() throws SQLException { + public void test_request_columnsfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { try (Statement statement = connection.createStatement()) { try (ResultSet resultSet1 = statement.executeQuery("select * from test")) { diff --git a/src/test/java/org/assertj/db/database/hsqldb/HsqldbDatabase_Source_UIUIUI_Test.java b/src/test/java/org/assertj/db/database/hsqldb/HsqldbDatabase_JdbcUrl_UIUIUI_Test.java similarity index 97% rename from src/test/java/org/assertj/db/database/hsqldb/HsqldbDatabase_Source_UIUIUI_Test.java rename to src/test/java/org/assertj/db/database/hsqldb/HsqldbDatabase_JdbcUrl_UIUIUI_Test.java index d41772f1..d889a8f6 100644 --- a/src/test/java/org/assertj/db/database/hsqldb/HsqldbDatabase_Source_UIUIUI_Test.java +++ b/src/test/java/org/assertj/db/database/hsqldb/HsqldbDatabase_JdbcUrl_UIUIUI_Test.java @@ -23,9 +23,9 @@ import org.assertj.db.common.NeedReload; import org.assertj.db.type.Changes; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.DateTimeValue; import org.assertj.db.type.DateValue; -import org.assertj.db.type.Source; import org.assertj.db.type.Table; import org.assertj.db.type.TimeValue; import org.assertj.db.type.ValueType; @@ -36,20 +36,21 @@ * Test on the HSQLDB database. * * @author Régis Pouiller + * @author Julien Roy */ -public class HsqldbDatabase_Source_UIUIUI_Test extends AbstractHsqldbTest { +public class HsqldbDatabase_JdbcUrl_UIUIUI_Test extends AbstractHsqldbTest { - private Source source = sourceUIUIUI; + private ConnectionProvider connectionProvider = jdbcConnectionUIUIUI; @Before public void init() { - source = sourceUIUIUI; + connectionProvider = jdbcConnectionUIUIUI; } @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -61,7 +62,7 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -128,7 +129,7 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -195,7 +196,7 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_ColumnEquality_hasValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -262,7 +263,7 @@ public void test_ColumnEquality_hasValues() { @Test @NeedReload public void test_ColumnEquality_containsValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -300,7 +301,7 @@ public void test_ColumnEquality_containsValues() { @Test @NeedReload public void test_ColumnType_isOfType() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -367,7 +368,7 @@ public void test_ColumnType_isOfType() { @Test @NeedReload public void test_ColumnOfChangeEquality_hasValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -441,7 +442,7 @@ public void test_ColumnOfChangeEquality_hasValues() { @Test @NeedReload public void test_RowEquality_hasValues() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -508,7 +509,7 @@ public void test_RowEquality_hasValues() { @Test @NeedReload public void test_ValueClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -575,7 +576,7 @@ public void test_ValueClass_isOfClass() { @Test @NeedReload public void test_ValueEquality_isEqualTo() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -642,7 +643,7 @@ public void test_ValueEquality_isEqualTo() { @Test @NeedReload public void test_ValueNonEquality_isNotEqualTo() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -709,7 +710,7 @@ public void test_ValueNonEquality_isNotEqualTo() { @Test @NeedReload public void test_ValueType_isOfType() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/database/sqlite/AbstractSqliteTest.java b/src/test/java/org/assertj/db/database/sqlite/AbstractSqliteTest.java index d46c3484..e8d9573f 100644 --- a/src/test/java/org/assertj/db/database/sqlite/AbstractSqliteTest.java +++ b/src/test/java/org/assertj/db/database/sqlite/AbstractSqliteTest.java @@ -24,8 +24,8 @@ import javax.sql.DataSource; import org.assertj.db.database.AbstractDatabaseTest; -import org.assertj.db.type.DataSourceWithLetterCase; -import org.assertj.db.type.SourceWithLetterCase; +import org.assertj.db.type.ConnectionProvider; +import org.assertj.db.type.ConnectionProviderFactory; import org.assertj.db.type.lettercase.LetterCase; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; @@ -39,6 +39,7 @@ * Parent for all the tests which are specific for Derby database. * * @author Régis Pouiller + * @author Julien Roy */ @ContextConfiguration(classes = {SqliteConfiguration.class}) public abstract class AbstractSqliteTest extends AbstractDatabaseTest { @@ -75,22 +76,22 @@ public abstract class AbstractSqliteTest extends AbstractDatabaseTest { private static final DbSetup DB_SETUP = new DbSetup(new DriverManagerDestination("jdbc:sqlite:target/testDerby.db", "", ""), OPERATIONS); - protected final SourceWithLetterCase sourceDDD = new SourceWithLetterCase("jdbc:sqlite:target/testDerby.db", "", "", + protected final ConnectionProvider jdbcConnectionDDD = ConnectionProviderFactory.of("jdbc:sqlite:target/testDerby.db", "", "").letterCase( LetterCase.TABLE_DEFAULT, LetterCase.COLUMN_DEFAULT, - LetterCase.PRIMARY_KEY_DEFAULT); - protected final SourceWithLetterCase sourceUIUIUI = new SourceWithLetterCase("jdbc:sqlite:target/testDerby.db", "", "", + LetterCase.PRIMARY_KEY_DEFAULT).create(); + protected final ConnectionProvider jdbcConnectionUIUIUI = ConnectionProviderFactory.of("jdbc:sqlite:target/testDerby.db", "", "").letterCase( letterCaseUI, letterCaseUI, - letterCaseUI); - protected final SourceWithLetterCase sourceNSNSNS = new SourceWithLetterCase("jdbc:sqlite:target/testDerby.db", "", "", + letterCaseUI).create(); + protected final ConnectionProvider jdbcConnectionNSNSNS = ConnectionProviderFactory.of("jdbc:sqlite:target/testDerby.db", "", "").letterCase( letterCaseNS, letterCaseNS, - letterCaseNS); + letterCaseNS).create(); protected DataSource dataSource; - protected DataSourceWithLetterCase dataSourceDDD; - protected DataSourceWithLetterCase dataSourceUIUIUI; - protected DataSourceWithLetterCase dataSourceNSNSNS; + protected ConnectionProvider dsConnectionDDD; + protected ConnectionProvider dsConnectionUIUIUI; + protected ConnectionProvider dsConnectionNSNSNS; protected DbSetup getDbSetup() { return DB_SETUP; @@ -103,11 +104,9 @@ protected DbSetupTracker getDbSetupTracker() { @Autowired protected void setDataSource(DataSource dataSource) { this.dataSource = dataSource; - this.dataSourceDDD = new DataSourceWithLetterCase(dataSource, LetterCase.TABLE_DEFAULT, - LetterCase.COLUMN_DEFAULT, - LetterCase.PRIMARY_KEY_DEFAULT); - this.dataSourceUIUIUI = new DataSourceWithLetterCase(dataSource, letterCaseUI, letterCaseUI, letterCaseUI); - this.dataSourceNSNSNS = new DataSourceWithLetterCase(dataSource, letterCaseNS, letterCaseNS, letterCaseNS); + this.dsConnectionDDD = ConnectionProviderFactory.of(dataSource).letterCase(LetterCase.TABLE_DEFAULT, LetterCase.COLUMN_DEFAULT, LetterCase.PRIMARY_KEY_DEFAULT).create(); + this.dsConnectionUIUIUI = ConnectionProviderFactory.of(dataSource).letterCase(letterCaseUI, letterCaseUI, letterCaseUI).create(); + this.dsConnectionNSNSNS = ConnectionProviderFactory.of(dataSource).letterCase(letterCaseNS, letterCaseNS, letterCaseNS).create(); } protected void update() { diff --git a/src/test/java/org/assertj/db/database/sqlite/SqliteDataBase_Test.java b/src/test/java/org/assertj/db/database/sqlite/SqliteDataBase_Test.java index 2d568606..a89ef462 100644 --- a/src/test/java/org/assertj/db/database/sqlite/SqliteDataBase_Test.java +++ b/src/test/java/org/assertj/db/database/sqlite/SqliteDataBase_Test.java @@ -44,7 +44,7 @@ public void test_catalog_for_data_source() throws SQLException { } @Test - public void test_catalog_for_source() throws SQLException { + public void test_catalog_for_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { String catalog = connection.getCatalog(); assertThat(catalog).isNull(); @@ -60,7 +60,7 @@ public void test_schema_for_data_source() throws SQLException { } @Test - public void test_schema_for_source() throws SQLException { + public void test_schema_for_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { String schema = connection.getSchema(); assertThat(schema).isNull(); @@ -79,7 +79,7 @@ public void test_tables_for_data_source() throws SQLException { } @Test - public void test_tables_for_source() throws SQLException { + public void test_tables_for_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); ResultSet resultSet = databaseMetaData.getTables(null, null, null, new String[]{"TABLE"}); @@ -109,7 +109,7 @@ public void test_table_primary_keys_for_data_source() throws SQLException { } @Test - public void test_table_primary_keys_for_source() throws SQLException { + public void test_table_primary_keys_for_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); { @@ -223,7 +223,7 @@ public void test_table_columns_for_data_source() throws SQLException { } @Test - public void test_table_columns_for_source() throws SQLException { + public void test_table_columnsfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); { @@ -350,7 +350,7 @@ public void test_request_columns_for_data_source() throws SQLException { } @Test - public void test_request_columns_for_source() throws SQLException { + public void test_request_columnsfor_jdbc_connection() throws SQLException { try (Connection connection = DriverManager.getConnection(URL, USER, PASSWORD)) { try (Statement statement = connection.createStatement()) { try (ResultSet resultSet1 = statement.executeQuery("select * from test")) { diff --git a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_DDD_Test.java b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_DDD_Test.java index fdca12f4..be3b89d1 100644 --- a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_DDD_Test.java +++ b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_DDD_Test.java @@ -17,12 +17,12 @@ import java.io.ByteArrayOutputStream; import java.sql.Date; -import javax.sql.DataSource; import org.assertj.core.api.Assertions; import org.assertj.db.common.NeedReload; import org.assertj.db.output.Outputs; import org.assertj.db.type.Changes; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.DateValue; import org.assertj.db.type.Table; import org.assertj.db.type.ValueType; @@ -33,20 +33,21 @@ * Test on the Sqlite database. * * @author Régis Pouiller + * @author Julien Roy */ public class SqliteDatabase_DataSource_DDD_Test extends AbstractSqliteTest { - private DataSource dataSource; + private ConnectionProvider connectionProvider; @Before public void init() { - dataSource = dataSourceDDD; + connectionProvider = dsConnectionDDD; } @Test @NeedReload public void test_Outputs_output() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -114,7 +115,7 @@ public void test_Outputs_output() { + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on teSt table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on teSt table of 'data source']%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -125,7 +126,7 @@ public void test_Outputs_output() { + "| Index : 0 | MODIFICATION | teSt | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of 'data source']%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -136,7 +137,7 @@ public void test_Outputs_output() { + "| MODIFICATION | teSt | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of 'data source']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | * | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -145,14 +146,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| 1 | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of 'data source']%n" + "|----------------|----------|%n" + "| | VAR1 |%n" + "| | (NUMBER) |%n" @@ -161,7 +162,7 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" @@ -173,7 +174,7 @@ public void test_Outputs_output() { @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -185,7 +186,7 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -240,7 +241,7 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -295,7 +296,7 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_ColumnEquality_hasValues() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -347,7 +348,7 @@ public void test_ColumnEquality_hasValues() { @Test @NeedReload public void test_ColumnEquality_containsValues() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -377,7 +378,7 @@ public void test_ColumnEquality_containsValues() { @Test @NeedReload public void test_ColumnType_isOfType() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -431,7 +432,7 @@ public void test_ColumnType_isOfType() { @Test @NeedReload public void test_ColumnOfChangeEquality_hasValues() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -484,7 +485,7 @@ public void test_ColumnOfChangeEquality_hasValues() { @Test @NeedReload public void test_RowEquality_hasValues() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -507,7 +508,7 @@ public void test_RowEquality_hasValues() { @Test @NeedReload public void test_ValueClass_isOfClass() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -562,7 +563,7 @@ public void test_ValueClass_isOfClass() { @Test @NeedReload public void test_ValueEquality_isEqualTo() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -615,7 +616,7 @@ public void test_ValueEquality_isEqualTo() { @Test @NeedReload public void test_ValueNonEquality_isNotEqualTo() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -668,7 +669,7 @@ public void test_ValueNonEquality_isNotEqualTo() { @Test @NeedReload public void test_ValueType_isOfType() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_NSNSNS_Test.java b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_NSNSNS_Test.java index 94c606dd..4b6a1560 100644 --- a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_NSNSNS_Test.java +++ b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_NSNSNS_Test.java @@ -17,13 +17,13 @@ import static org.junit.Assert.fail; import java.io.ByteArrayOutputStream; -import javax.sql.DataSource; import org.assertj.core.api.Assertions; import org.assertj.db.common.NeedReload; import org.assertj.db.exception.AssertJDBException; import org.assertj.db.output.Outputs; import org.assertj.db.type.Changes; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Table; import org.junit.Before; import org.junit.Test; @@ -32,20 +32,21 @@ * Test on the Sqlite database. * * @author Régis Pouiller + * @author Julien Roy */ public class SqliteDatabase_DataSource_NSNSNS_Test extends AbstractSqliteTest { - private DataSource dataSource; + private ConnectionProvider connectionProvider; @Before public void init() { - dataSource = dataSourceNSNSNS; + connectionProvider = dsConnectionNSNSNS; } @Test @NeedReload public void test_Outputs_output() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -112,7 +113,7 @@ public void test_Outputs_output() { + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on test table of 'data source']%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | Var1 | vAr2 | vaR3 | var4 | var5 | var6 | var7 | var8 | var9 | var10 | var11 | var12 | var13 | var14 | var15 | var16 | var17 | var18 | var19 |%n" @@ -123,7 +124,7 @@ public void test_Outputs_output() { + "| Index : 0 | MODIFICATION | test | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of 'data source']%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | Var1 | vAr2 | vaR3 | var4 | var5 | var6 | var7 | var8 | var9 | var10 | var11 | var12 | var13 | var14 | var15 | var16 | var17 | var18 | var19 |%n" @@ -134,7 +135,7 @@ public void test_Outputs_output() { + "| MODIFICATION | test | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of 'data source']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | * | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | Var1 | vAr2 | vaR3 | var4 | var5 | var6 | var7 | var8 | var9 | var10 | var11 | var12 | var13 | var14 | var15 | var16 | var17 | var18 | var19 |%n" @@ -143,14 +144,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| 1 | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of 'data source']%n" + "|----------|%n" + "| Var1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of 'data source']%n" + "|----------------|----------|%n" + "| | Var1 |%n" + "| | (NUMBER) |%n" @@ -159,7 +160,7 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of 'data source']%n" + "|----------|%n" + "| Var1 |%n" + "| (NUMBER) |%n" @@ -171,9 +172,9 @@ public void test_Outputs_output() { @Test @NeedReload public void should_fail_because_primary_key_is_different() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -182,7 +183,7 @@ public void should_fail_because_primary_key_is_different() { assertThat(changes).change().hasPksNames("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of a data source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of 'data source'] %n" + "Expecting :%n" + " [\"var1\"]%n" + "to be the name of the columns of the primary keys but was:%n" @@ -193,7 +194,7 @@ public void should_fail_because_primary_key_is_different() { assertThat(changes2).change().hasPksNames("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of a data source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of 'data source'] %n" + "Expecting :%n" + " [\"var1\"]%n" + "to be the name of the columns of the primary keys but was:%n" @@ -204,9 +205,9 @@ public void should_fail_because_primary_key_is_different() { @Test @NeedReload public void should_fail_because_column_name_is_different() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -236,7 +237,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes).change().column().hasColumnName("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of a data source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of 'data source'] %n" + "Expecting :%n" + " \"var1\"%n" + "to be the name of the column but was:%n" @@ -246,7 +247,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes).change().rowAtEndPoint().value().hasColumnName("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of a data source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of 'data source'] %n" + "Expecting :%n" + " \"var1\"%n" + "to be the name of the column but was:%n" @@ -257,7 +258,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes2).change().column().hasColumnName("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of a data source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of 'data source'] %n" + "Expecting :%n" + " \"var1\"%n" + "to be the name of the column but was:%n" @@ -267,7 +268,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes2).change().rowAtEndPoint().value().hasColumnName("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of a data source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of 'data source'] %n" + "Expecting :%n" + " \"var1\"%n" + "to be the name of the column but was:%n" @@ -278,9 +279,9 @@ public void should_fail_because_column_name_is_different() { @Test @NeedReload public void should_fail_because_column_name_is_wrong_to_navigate() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -340,9 +341,9 @@ public void should_fail_because_column_name_is_wrong_to_navigate() { @Test @NeedReload public void should_fail_because_table_name_is_different() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -351,7 +352,7 @@ public void should_fail_because_table_name_is_different() { assertThat(changes).change().isOnTable("teSt"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of a data source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of 'data source'] %n" + "Expecting to be on the table:%n" + " <\"teSt\">%n" + "but was on the table:%n" @@ -361,7 +362,7 @@ public void should_fail_because_table_name_is_different() { assertThat(changes2).change().isOnTable("test"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of a data source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of 'data source'] %n" + "Expecting to be on the table:%n" + " <\"test\">%n" + "but was on the table:%n" @@ -372,9 +373,9 @@ public void should_fail_because_table_name_is_different() { @Test @NeedReload public void should_fail_because_table_name_is_wrong_to_navigate() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -421,9 +422,9 @@ public void should_fail_because_table_name_is_wrong_to_navigate() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -437,9 +438,9 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(dataSource).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_UIUIUI_Test.java b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_UIUIUI_Test.java index 19c58d63..9101ad0e 100644 --- a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_UIUIUI_Test.java +++ b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_DataSource_UIUIUI_Test.java @@ -17,12 +17,12 @@ import java.io.ByteArrayOutputStream; import java.sql.Date; -import javax.sql.DataSource; import org.assertj.core.api.Assertions; import org.assertj.db.common.NeedReload; import org.assertj.db.output.Outputs; import org.assertj.db.type.Changes; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.DateValue; import org.assertj.db.type.Table; import org.assertj.db.type.ValueType; @@ -33,20 +33,21 @@ * Test on the Sqlite database. * * @author Régis Pouiller + * @author Julien Roy */ public class SqliteDatabase_DataSource_UIUIUI_Test extends AbstractSqliteTest { - private DataSource dataSource; + private ConnectionProvider connectionProvider; @Before public void init() { - dataSource = dataSourceUIUIUI; + connectionProvider = dsConnectionUIUIUI; } @Test @NeedReload public void test_Outputs_output() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -114,7 +115,7 @@ public void test_Outputs_output() { + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on TEST table of 'data source']%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -125,7 +126,7 @@ public void test_Outputs_output() { + "| Index : 0 | MODIFICATION | TEST | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -136,7 +137,7 @@ public void test_Outputs_output() { + "| MODIFICATION | TEST | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | * | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -145,14 +146,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| 1 | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|----------------|----------|%n" + "| | VAR1 |%n" + "| | (NUMBER) |%n" @@ -161,7 +162,7 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of a data source]%n" + Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'data source']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" @@ -173,7 +174,7 @@ public void test_Outputs_output() { @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -185,7 +186,7 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -240,7 +241,7 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -295,7 +296,7 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_ColumnEquality_hasValues() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -347,7 +348,7 @@ public void test_ColumnEquality_hasValues() { @Test @NeedReload public void test_ColumnEquality_containsValues() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -377,7 +378,7 @@ public void test_ColumnEquality_containsValues() { @Test @NeedReload public void test_ColumnType_isOfType() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -431,7 +432,7 @@ public void test_ColumnType_isOfType() { @Test @NeedReload public void test_ColumnOfChangeEquality_hasValues() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -484,7 +485,7 @@ public void test_ColumnOfChangeEquality_hasValues() { @Test @NeedReload public void test_RowEquality_hasValues() { - Table table = new Table(dataSource, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -507,7 +508,7 @@ public void test_RowEquality_hasValues() { @Test @NeedReload public void test_ValueClass_isOfClass() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -562,7 +563,7 @@ public void test_ValueClass_isOfClass() { @Test @NeedReload public void test_ValueEquality_isEqualTo() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -615,7 +616,7 @@ public void test_ValueEquality_isEqualTo() { @Test @NeedReload public void test_ValueNonEquality_isNotEqualTo() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -668,7 +669,7 @@ public void test_ValueNonEquality_isNotEqualTo() { @Test @NeedReload public void test_ValueType_isOfType() { - Table table = new Table(dataSource, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_Source_DDD_Test.java b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_JdbcUrl_DDD_Test.java similarity index 96% rename from src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_Source_DDD_Test.java rename to src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_JdbcUrl_DDD_Test.java index 4b4c21fd..f4cb7761 100644 --- a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_Source_DDD_Test.java +++ b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_JdbcUrl_DDD_Test.java @@ -22,8 +22,8 @@ import org.assertj.db.common.NeedReload; import org.assertj.db.output.Outputs; import org.assertj.db.type.Changes; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.DateValue; -import org.assertj.db.type.Source; import org.assertj.db.type.Table; import org.assertj.db.type.ValueType; import org.junit.Before; @@ -33,20 +33,21 @@ * Test on the Sqlite database. * * @author Régis Pouiller + * @author Julien Roy */ -public class SqliteDatabase_Source_DDD_Test extends AbstractSqliteTest { +public class SqliteDatabase_JdbcUrl_DDD_Test extends AbstractSqliteTest { - private Source source; + private ConnectionProvider connectionProvider; @Before public void init() { - source = sourceDDD; + connectionProvider = jdbcConnectionDDD; } @Test @NeedReload public void test_Outputs_output() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -114,7 +115,7 @@ public void test_Outputs_output() { + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on teSt table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on teSt table of '/jdbc:sqlite:target/testDerby.db']%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -125,7 +126,7 @@ public void test_Outputs_output() { + "| Index : 0 | MODIFICATION | teSt | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db']%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -136,7 +137,7 @@ public void test_Outputs_output() { + "| MODIFICATION | teSt | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | * | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -145,14 +146,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| 1 | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db']%n" + "|----------------|----------|%n" + "| | VAR1 |%n" + "| | (NUMBER) |%n" @@ -161,7 +162,7 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" @@ -173,7 +174,7 @@ public void test_Outputs_output() { @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -185,7 +186,7 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -240,7 +241,7 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -295,7 +296,7 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_ColumnEquality_hasValues() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -347,7 +348,7 @@ public void test_ColumnEquality_hasValues() { @Test @NeedReload public void test_ColumnEquality_containsValues() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -377,7 +378,7 @@ public void test_ColumnEquality_containsValues() { @Test @NeedReload public void test_ColumnType_isOfType() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -431,7 +432,7 @@ public void test_ColumnType_isOfType() { @Test @NeedReload public void test_ColumnOfChangeEquality_hasValues() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -484,7 +485,7 @@ public void test_ColumnOfChangeEquality_hasValues() { @Test @NeedReload public void test_RowEquality_hasValues() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -507,7 +508,7 @@ public void test_RowEquality_hasValues() { @Test @NeedReload public void test_ValueClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -562,7 +563,7 @@ public void test_ValueClass_isOfClass() { @Test @NeedReload public void test_ValueEquality_isEqualTo() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -615,7 +616,7 @@ public void test_ValueEquality_isEqualTo() { @Test @NeedReload public void test_ValueNonEquality_isNotEqualTo() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -668,7 +669,7 @@ public void test_ValueNonEquality_isNotEqualTo() { @Test @NeedReload public void test_ValueType_isOfType() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_Source_NSNSNS_Test.java b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_JdbcUrl_NSNSNS_Test.java similarity index 94% rename from src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_Source_NSNSNS_Test.java rename to src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_JdbcUrl_NSNSNS_Test.java index 23f21978..750f86ce 100644 --- a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_Source_NSNSNS_Test.java +++ b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_JdbcUrl_NSNSNS_Test.java @@ -23,7 +23,7 @@ import org.assertj.db.exception.AssertJDBException; import org.assertj.db.output.Outputs; import org.assertj.db.type.Changes; -import org.assertj.db.type.Source; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.Table; import org.junit.Before; import org.junit.Test; @@ -32,20 +32,21 @@ * Test on the Sqlite database. * * @author Régis Pouiller + * @author Julien Roy */ -public class SqliteDatabase_Source_NSNSNS_Test extends AbstractSqliteTest { +public class SqliteDatabase_JdbcUrl_NSNSNS_Test extends AbstractSqliteTest { - private Source source; + private ConnectionProvider connectionProvider; @Before public void init() { - source = sourceNSNSNS; + connectionProvider = jdbcConnectionNSNSNS; } @Test @NeedReload public void test_Outputs_output() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -112,7 +113,7 @@ public void test_Outputs_output() { + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on test table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on test table of '/jdbc:sqlite:target/testDerby.db']%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | Var1 | vAr2 | vaR3 | var4 | var5 | var6 | var7 | var8 | var9 | var10 | var11 | var12 | var13 | var14 | var15 | var16 | var17 | var18 | var19 |%n" @@ -123,7 +124,7 @@ public void test_Outputs_output() { + "| Index : 0 | MODIFICATION | test | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db']%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | Var1 | vAr2 | vaR3 | var4 | var5 | var6 | var7 | var8 | var9 | var10 | var11 | var12 | var13 | var14 | var15 | var16 | var17 | var18 | var19 |%n" @@ -134,7 +135,7 @@ public void test_Outputs_output() { + "| MODIFICATION | test | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | * | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | Var1 | vAr2 | vaR3 | var4 | var5 | var6 | var7 | var8 | var9 | var10 | var11 | var12 | var13 | var14 | var15 | var16 | var17 | var18 | var19 |%n" @@ -143,14 +144,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| 1 | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db']%n" + "|----------|%n" + "| Var1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db']%n" + "|----------------|----------|%n" + "| | Var1 |%n" + "| | (NUMBER) |%n" @@ -159,7 +160,7 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db']%n" + "|----------|%n" + "| Var1 |%n" + "| (NUMBER) |%n" @@ -171,9 +172,9 @@ public void test_Outputs_output() { @Test @NeedReload public void should_fail_because_primary_key_is_different() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -182,7 +183,7 @@ public void should_fail_because_primary_key_is_different() { assertThat(changes).change().hasPksNames("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db'] %n" + "Expecting :%n" + " [\"var1\"]%n" + "to be the name of the columns of the primary keys but was:%n" @@ -193,7 +194,7 @@ public void should_fail_because_primary_key_is_different() { assertThat(changes2).change().hasPksNames("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db'] %n" + "Expecting :%n" + " [\"var1\"]%n" + "to be the name of the columns of the primary keys but was:%n" @@ -204,9 +205,9 @@ public void should_fail_because_primary_key_is_different() { @Test @NeedReload public void should_fail_because_column_name_is_different() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -236,7 +237,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes).change().column().hasColumnName("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db'] %n" + "Expecting :%n" + " \"var1\"%n" + "to be the name of the column but was:%n" @@ -246,7 +247,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes).change().rowAtEndPoint().value().hasColumnName("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db'] %n" + "Expecting :%n" + " \"var1\"%n" + "to be the name of the column but was:%n" @@ -257,7 +258,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes2).change().column().hasColumnName("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Column at index 0 (column name : Var1) of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db'] %n" + "Expecting :%n" + " \"var1\"%n" + "to be the name of the column but was:%n" @@ -267,7 +268,7 @@ public void should_fail_because_column_name_is_different() { assertThat(changes2).change().rowAtEndPoint().value().hasColumnName("var1"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 (column name : Var1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db'] %n" + "Expecting :%n" + " \"var1\"%n" + "to be the name of the column but was:%n" @@ -278,9 +279,9 @@ public void should_fail_because_column_name_is_different() { @Test @NeedReload public void should_fail_because_column_name_is_wrong_to_navigate() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -340,9 +341,9 @@ public void should_fail_because_column_name_is_wrong_to_navigate() { @Test @NeedReload public void should_fail_because_table_name_is_different() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -351,7 +352,7 @@ public void should_fail_because_table_name_is_different() { assertThat(changes).change().isOnTable("teSt"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on test table of '/jdbc:sqlite:target/testDerby.db'] %n" + "Expecting to be on the table:%n" + " <\"teSt\">%n" + "but was on the table:%n" @@ -361,7 +362,7 @@ public void should_fail_because_table_name_is_different() { assertThat(changes2).change().isOnTable("test"); fail("An exception must be raised"); } catch (AssertionError e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db' source] %n" + Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on teSt table of '/jdbc:sqlite:target/testDerby.db'] %n" + "Expecting to be on the table:%n" + " <\"test\">%n" + "but was on the table:%n" @@ -372,9 +373,9 @@ public void should_fail_because_table_name_is_different() { @Test @NeedReload public void should_fail_because_table_name_is_wrong_to_navigate() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -421,9 +422,9 @@ public void should_fail_because_table_name_is_wrong_to_navigate() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); @@ -437,9 +438,9 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); - Changes changes2 = new Changes(source).setStartPointNow(); + Changes changes2 = new Changes(connectionProvider).setStartPointNow(); update(); changes.setEndPointNow(); changes2.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_Source_UIUIUI_Test.java b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_JdbcUrl_UIUIUI_Test.java similarity index 96% rename from src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_Source_UIUIUI_Test.java rename to src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_JdbcUrl_UIUIUI_Test.java index a39fc0f7..65c59752 100644 --- a/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_Source_UIUIUI_Test.java +++ b/src/test/java/org/assertj/db/database/sqlite/SqliteDatabase_JdbcUrl_UIUIUI_Test.java @@ -22,8 +22,8 @@ import org.assertj.db.common.NeedReload; import org.assertj.db.output.Outputs; import org.assertj.db.type.Changes; +import org.assertj.db.type.ConnectionProvider; import org.assertj.db.type.DateValue; -import org.assertj.db.type.Source; import org.assertj.db.type.Table; import org.assertj.db.type.ValueType; import org.junit.Before; @@ -33,20 +33,21 @@ * Test on the Sqlite database. * * @author Régis Pouiller + * @author Julien Roy */ -public class SqliteDatabase_Source_UIUIUI_Test extends AbstractSqliteTest { +public class SqliteDatabase_JdbcUrl_UIUIUI_Test extends AbstractSqliteTest { - private Source source; + private ConnectionProvider connectionProvider; @Before public void init() { - source = sourceUIUIUI; + connectionProvider = jdbcConnectionUIUIUI; } @Test @NeedReload public void test_Outputs_output() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -114,7 +115,7 @@ public void test_Outputs_output() { + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on TEST table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Changes on TEST table of '/jdbc:sqlite:target/testDerby.db']%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -125,7 +126,7 @@ public void test_Outputs_output() { + "| Index : 0 | MODIFICATION | TEST | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|-----------|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 0 (with primary key : [1]) of Changes on TEST table of '/jdbc:sqlite:target/testDerby.db']%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | | * | | | | | | | | | | | | | | | | | | |%n" + "| TYPE | TABLE | PRIMARY | | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -136,7 +137,7 @@ public void test_Outputs_output() { + "| MODIFICATION | TEST | 1 |----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | | | At end point | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of '/jdbc:sqlite:target/testDerby.db']%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| | * | | | | | | | | | | | | | | | | | | |%n" + "| PRIMARY | VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | VAR7 | VAR8 | VAR9 | VAR10 | VAR11 | VAR12 | VAR13 | VAR14 | VAR15 | VAR16 | VAR17 | VAR18 | VAR19 |%n" @@ -145,14 +146,14 @@ public void test_Outputs_output() { + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n" + "| 1 | 1 | 13 | 2 | 14 | 15 | 2007-12-23 | 3.3 | 4.4 | 5.5 | 6.6 | 20 | 8 | 16 | 9 | 10.1 | 11 | 09:01:00 | 2007-12-23 09:01:00.0 | 12 |%n" + "|---------|-----------|-----------|-----------|-----------|-----------|------------|-----------|-----------|-----------|-----------|------------|------------|------------|------------|------------|------------|------------|-----------------------|------------|%n")); - Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream8.toString()).isEqualTo(String.format("[Value at index 0 (column name : VAR1) of Row at end point of Change at index 0 (with primary key : [1]) of Changes on TEST table of '/jdbc:sqlite:target/testDerby.db']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream9.toString()).isEqualTo(String.format("[Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of '/jdbc:sqlite:target/testDerby.db']%n" + "|----------------|----------|%n" + "| | VAR1 |%n" + "| | (NUMBER) |%n" @@ -161,7 +162,7 @@ public void test_Outputs_output() { + "|----------------|----------|%n" + "| At end point | 1 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of '/jdbc:sqlite:target/testDerby.db' source]%n" + Assertions.assertThat(byteArrayOutputStream10.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : VAR1) of Change at index 0 (with primary key : [1]) of Changes on TEST table of '/jdbc:sqlite:target/testDerby.db']%n" + "|----------|%n" + "| VAR1 |%n" + "| (NUMBER) |%n" @@ -173,7 +174,7 @@ public void test_Outputs_output() { @Test @NeedReload public void test_PrimaryKey_hasPksNames() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -185,7 +186,7 @@ public void test_PrimaryKey_hasPksNames() { @Test @NeedReload public void test_ColumnName_hasColumnName() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -240,7 +241,7 @@ public void test_ColumnName_hasColumnName() { @Test @NeedReload public void test_ColumnClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -295,7 +296,7 @@ public void test_ColumnClass_isOfClass() { @Test @NeedReload public void test_ColumnEquality_hasValues() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -347,7 +348,7 @@ public void test_ColumnEquality_hasValues() { @Test @NeedReload public void test_ColumnEquality_containsValues() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -377,7 +378,7 @@ public void test_ColumnEquality_containsValues() { @Test @NeedReload public void test_ColumnType_isOfType() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -431,7 +432,7 @@ public void test_ColumnType_isOfType() { @Test @NeedReload public void test_ColumnOfChangeEquality_hasValues() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -484,7 +485,7 @@ public void test_ColumnOfChangeEquality_hasValues() { @Test @NeedReload public void test_RowEquality_hasValues() { - Table table = new Table(source, "test", null, new String[]{"var20"}); + Table table = new Table(connectionProvider, "test", null, new String[]{"var20"}); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -507,7 +508,7 @@ public void test_RowEquality_hasValues() { @Test @NeedReload public void test_ValueClass_isOfClass() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -562,7 +563,7 @@ public void test_ValueClass_isOfClass() { @Test @NeedReload public void test_ValueEquality_isEqualTo() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -615,7 +616,7 @@ public void test_ValueEquality_isEqualTo() { @Test @NeedReload public void test_ValueNonEquality_isNotEqualTo() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); @@ -668,7 +669,7 @@ public void test_ValueNonEquality_isNotEqualTo() { @Test @NeedReload public void test_ValueType_isOfType() { - Table table = new Table(source, "test"); + Table table = new Table(connectionProvider, "test"); Changes changes = new Changes(table).setStartPointNow(); update(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/InstantiationError_Test.java b/src/test/java/org/assertj/db/navigation/InstantiationError_Test.java index 1f8549c4..877adb79 100644 --- a/src/test/java/org/assertj/db/navigation/InstantiationError_Test.java +++ b/src/test/java/org/assertj/db/navigation/InstantiationError_Test.java @@ -35,6 +35,7 @@ * Tests on instantiation errors. * * @author Régis Pouiller + * @author Julien Roy */ public class InstantiationError_Test extends AbstractTest { @@ -43,7 +44,7 @@ public class InstantiationError_Test extends AbstractTest { */ @Test public void should_fail_because_mistake_in_instantiation_of_column() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); Field field = AbstractDbAssert.class.getDeclaredField("columnPosition"); @@ -70,7 +71,7 @@ public void should_fail_because_mistake_in_instantiation_of_column() throws Exce */ @Test public void should_fail_because_mistake_in_instantiation_of_row() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); Field field = AbstractDbAssert.class.getDeclaredField("rowPosition"); @@ -97,7 +98,7 @@ public void should_fail_because_mistake_in_instantiation_of_row() throws Excepti */ @Test public void should_fail_because_mistake_in_instantiation_of_value() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableColumnAssert tableColumnAssert = assertThat(table).column(); Field field = AbstractColumnAssert.class.getDeclaredField("valuePosition"); @@ -125,7 +126,7 @@ public void should_fail_because_mistake_in_instantiation_of_value() throws Excep @Test @NeedReload public void should_fail_because_mistake_in_instantiation_of_changes() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); ChangesAssert changesAssert = assertThat(changes); @@ -155,7 +156,7 @@ public void should_fail_because_mistake_in_instantiation_of_changes() throws Exc @Test @NeedReload public void should_fail_because_mistake_in_instantiation_of_change() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); ChangesAssert changesAssert = assertThat(changes); @@ -185,7 +186,7 @@ public void should_fail_because_mistake_in_instantiation_of_change() throws Exce @Test @NeedReload public void should_fail_because_mistake_in_instantiation_of_columnchange() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); ChangeAssert changeAssert = assertThat(changes).change(); @@ -215,7 +216,7 @@ public void should_fail_because_mistake_in_instantiation_of_columnchange() throw @Test @NeedReload public void should_fail_because_mistake_in_instantiation_of_rowAtStartPoint() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); ChangeAssert changeAssert = assertThat(changes).change(); diff --git a/src/test/java/org/assertj/db/navigation/ReturnToOrigin_Test.java b/src/test/java/org/assertj/db/navigation/ReturnToOrigin_Test.java index 863d1bb6..78baaf11 100644 --- a/src/test/java/org/assertj/db/navigation/ReturnToOrigin_Test.java +++ b/src/test/java/org/assertj/db/navigation/ReturnToOrigin_Test.java @@ -60,6 +60,7 @@ * Tests on the different methods linked on the {@code returnToOrigin()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ReturnToOrigin_Test extends AbstractTest { @@ -68,7 +69,7 @@ public class ReturnToOrigin_Test extends AbstractTest { */ @Test public void test_return_to_table_from_column_with_assertions() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableColumnAssert tableColumnAssert = tableAssert.column(); TableAssert tableAssertBis = tableColumnAssert.returnToTable(); @@ -81,7 +82,7 @@ public void test_return_to_table_from_column_with_assertions() throws Exception */ @Test public void test_return_to_table_from_row_with_assertions() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableRowAssert tableRowAssert = tableAssert.row(); TableAssert tableAssertBis = tableRowAssert.returnToTable(); @@ -94,7 +95,7 @@ public void test_return_to_table_from_row_with_assertions() throws Exception { */ @Test public void test_return_to_request_from_column_with_assertions() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); RequestColumnAssert requestColumnAssert = requestAssert.column(); RequestAssert requestAssertBis = requestColumnAssert.returnToRequest(); @@ -107,7 +108,7 @@ public void test_return_to_request_from_column_with_assertions() throws Exceptio */ @Test public void test_return_to_request_from_row_with_assertions() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); RequestRowAssert requestRowAssert = requestAssert.row(); RequestAssert requestAssertBis = requestRowAssert.returnToRequest(); @@ -120,7 +121,7 @@ public void test_return_to_request_from_row_with_assertions() throws Exception { */ @Test public void test_return_to_column_from_value_for_table_with_assertions() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableColumnAssert tableColumnAssert = tableAssert.column(); TableColumnValueAssert tableColumnValueAssert = tableColumnAssert.value(); @@ -134,7 +135,7 @@ public void test_return_to_column_from_value_for_table_with_assertions() throws */ @Test public void test_return_to_row_from_value_for_table_with_assertions() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableRowAssert tableRowAssert = tableAssert.row(); TableRowValueAssert tableRowValueAssert = tableRowAssert.value(); @@ -148,7 +149,7 @@ public void test_return_to_row_from_value_for_table_with_assertions() throws Exc */ @Test public void test_return_to_column_from_value_for_request_with_assertions() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); RequestColumnAssert requestColumnAssert = requestAssert.column(); RequestColumnValueAssert requestColumnValueAssert = requestColumnAssert.value(); @@ -162,7 +163,7 @@ public void test_return_to_column_from_value_for_request_with_assertions() throw */ @Test public void test_return_to_row_from_value_for_request_with_assertions() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); RequestRowAssert requestRowAssert = requestAssert.row(); RequestRowValueAssert requestRowValueAssert = requestRowAssert.value(); @@ -177,7 +178,7 @@ public void test_return_to_row_from_value_for_request_with_assertions() throws E @Test @NeedReload public void test_return_to_changes_from_change_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -194,7 +195,7 @@ public void test_return_to_changes_from_change_with_assertions() throws Exceptio @Test @NeedReload public void test_return_to_change_from_column_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -211,7 +212,7 @@ public void test_return_to_change_from_column_with_assertions() throws Exception @Test @NeedReload public void test_return_to_change_from_row_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -228,7 +229,7 @@ public void test_return_to_change_from_row_with_assertions() throws Exception { @Test @NeedReload public void test_return_to_column_from_value_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -245,7 +246,7 @@ public void test_return_to_column_from_value_with_assertions() throws Exception @Test @NeedReload public void test_return_to_row_from_value_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -261,7 +262,7 @@ public void test_return_to_row_from_value_with_assertions() throws Exception { */ @Test public void test_return_to_table_from_column_with_displays() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); TableColumnOutputter tableColumnOutputter = tableOutputter.column(); TableOutputter tableOutputterBis = tableColumnOutputter.returnToTable(); @@ -274,7 +275,7 @@ public void test_return_to_table_from_column_with_displays() throws Exception { */ @Test public void test_return_to_table_from_row_with_displays() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); TableRowOutputter tableRowOutputter = tableOutputter.row(); TableOutputter tableOutputterBis = tableRowOutputter.returnToTable(); @@ -287,7 +288,7 @@ public void test_return_to_table_from_row_with_displays() throws Exception { */ @Test public void test_return_to_request_from_column_with_displays() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); RequestColumnOutputter requestColumnOutputter = requestOutputter.column(); RequestOutputter requestOutputterBis = requestColumnOutputter.returnToRequest(); @@ -300,7 +301,7 @@ public void test_return_to_request_from_column_with_displays() throws Exception */ @Test public void test_return_to_request_from_row_with_displays() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); RequestRowOutputter requestRowOutputter = requestOutputter.row(); RequestOutputter requestOutputterBis = requestRowOutputter.returnToRequest(); @@ -313,7 +314,7 @@ public void test_return_to_request_from_row_with_displays() throws Exception { */ @Test public void test_return_to_column_from_value_for_table_with_displays() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); TableColumnOutputter tableColumnOutputter = tableOutputter.column(); TableColumnValueOutputter tableColumnValueOutputter = tableColumnOutputter.value(); @@ -327,7 +328,7 @@ public void test_return_to_column_from_value_for_table_with_displays() throws Ex */ @Test public void test_return_to_row_from_value_for_table_with_displays() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); TableRowOutputter tableRowOutputter = tableOutputter.row(); TableRowValueOutputter tableRowValueOutputter = tableRowOutputter.value(); @@ -341,7 +342,7 @@ public void test_return_to_row_from_value_for_table_with_displays() throws Excep */ @Test public void test_return_to_column_from_value_for_request_with_displays() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); RequestColumnOutputter requestColumnOutputter = requestOutputter.column(); RequestColumnValueOutputter requestColumnValueOutputter = requestColumnOutputter.value(); @@ -355,7 +356,7 @@ public void test_return_to_column_from_value_for_request_with_displays() throws */ @Test public void test_return_to_row_from_value_for_request_with_displays() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); RequestRowOutputter requestRowOutputter = requestOutputter.row(); RequestRowValueOutputter requestRowValueOutputter = requestRowOutputter.value(); @@ -370,7 +371,7 @@ public void test_return_to_row_from_value_for_request_with_displays() throws Exc @Test @NeedReload public void test_return_to_changes_from_change_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -387,7 +388,7 @@ public void test_return_to_changes_from_change_with_displays() throws Exception @Test @NeedReload public void test_return_to_change_from_column_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -404,7 +405,7 @@ public void test_return_to_change_from_column_with_displays() throws Exception { @Test @NeedReload public void test_return_to_change_from_row_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -421,7 +422,7 @@ public void test_return_to_change_from_row_with_displays() throws Exception { @Test @NeedReload public void test_return_to_column_from_value_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -438,7 +439,7 @@ public void test_return_to_column_from_value_with_displays() throws Exception { @Test @NeedReload public void test_return_to_row_from_value_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreationOnTable_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreationOnTable_Integer_Test.java index ed389516..f65b98e4 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreationOnTable_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreationOnTable_Integer_Test.java @@ -38,6 +38,7 @@ * {@link org.assertj.db.navigation.ToChange#changeOfCreationOnTable(String, int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfCreationOnTable_Integer_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfCreationOnTable_Integer_Test extends AbstractTest @Test @NeedReload public void test_change_of_creation_on_table_with_index_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -144,7 +145,7 @@ public void test_change_of_creation_on_table_with_index_with_assertions() throws @Test @NeedReload public void test_change_of_creation_on_table_with_index_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreationOnTable_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreationOnTable_Test.java index 16fbe055..39d4aeea 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreationOnTable_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreationOnTable_Test.java @@ -38,6 +38,7 @@ * {@link ToChange#changeOfCreationOnTable(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfCreationOnTable_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfCreationOnTable_Test extends AbstractTest { @Test @NeedReload public void test_change_of_creation_on_table_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -128,7 +129,7 @@ public void test_change_of_creation_on_table_with_assertions() throws Exception @Test @NeedReload public void test_change_of_creation_on_table_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreation_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreation_Integer_Test.java index b0bf5fd0..016695ec 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreation_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreation_Integer_Test.java @@ -38,6 +38,7 @@ * {@link ToChange#changeOfCreation(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfCreation_Integer_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfCreation_Integer_Test extends AbstractTest { @Test @NeedReload public void test_change_of_creation_with_index_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -144,7 +145,7 @@ public void test_change_of_creation_with_index_with_assertions() throws Exceptio @Test @NeedReload public void test_change_of_creation_with_index_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreation_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreation_Test.java index 536ecbe5..aac997ec 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreation_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfCreation_Test.java @@ -38,6 +38,7 @@ * {@link org.assertj.db.navigation.ToChange#changeOfCreation()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfCreation_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfCreation_Test extends AbstractTest { @Test @NeedReload public void test_change_of_creation_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -128,7 +129,7 @@ public void test_change_of_creation_with_assertions() throws Exception { @Test @NeedReload public void test_change_of_creation_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletionOnTable_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletionOnTable_Integer_Test.java index ba86c2ec..a0348194 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletionOnTable_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletionOnTable_Integer_Test.java @@ -38,6 +38,7 @@ * {@link ToChange#changeOfDeletionOnTable(String, int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfDeletionOnTable_Integer_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfDeletionOnTable_Integer_Test extends AbstractTest @Test @NeedReload public void test_change_of_deletion_on_table_with_index_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -133,7 +134,7 @@ public void test_change_of_deletion_on_table_with_index_with_assertions() throws @Test @NeedReload public void test_change_of_deletion_on_table_with_index_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletionOnTable_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletionOnTable_Test.java index ef8f07d2..edd2f57d 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletionOnTable_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletionOnTable_Test.java @@ -38,6 +38,7 @@ * {@link org.assertj.db.navigation.ToChange#changeOfDeletionOnTable(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfDeletionOnTable_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfDeletionOnTable_Test extends AbstractTest { @Test @NeedReload public void test_change_of_deletion_on_table_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -117,7 +118,7 @@ public void test_change_of_deletion_on_table_with_assertions() throws Exception @Test @NeedReload public void test_change_of_deletion_on_table_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletion_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletion_Integer_Test.java index 4472e644..8aaed8ab 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletion_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletion_Integer_Test.java @@ -38,6 +38,7 @@ * {@link org.assertj.db.navigation.ToChange#changeOfDeletion(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfDeletion_Integer_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfDeletion_Integer_Test extends AbstractTest { @Test @NeedReload public void test_change_of_deletion_with_index_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -133,7 +134,7 @@ public void test_change_of_deletion_with_index_with_assertions() throws Exceptio @Test @NeedReload public void test_change_of_deletion_with_index_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletion_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletion_Test.java index 24e785a1..8b6bb2b8 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletion_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletion_Test.java @@ -38,6 +38,7 @@ * {@link ToChange#changeOfDeletion()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfDeletion_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfDeletion_Test extends AbstractTest { @Test @NeedReload public void test_change_of_deletion_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -117,7 +118,7 @@ public void test_change_of_deletion_with_assertions() throws Exception { @Test @NeedReload public void test_change_of_deletion_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModificationOnTable_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModificationOnTable_Integer_Test.java index 528721c7..b7fa860a 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModificationOnTable_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModificationOnTable_Integer_Test.java @@ -38,6 +38,7 @@ * {@link org.assertj.db.navigation.ToChange#changeOfModificationOnTable(String, int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfModificationOnTable_Integer_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfModificationOnTable_Integer_Test extends AbstractT @Test @NeedReload public void test_change_of_modification_on_table_with_index_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -144,7 +145,7 @@ public void test_change_of_modification_on_table_with_index_with_assertions() th @Test @NeedReload public void test_change_of_modification_on_table_with_index_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModificationOnTable_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModificationOnTable_Test.java index df93151a..f10bad25 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModificationOnTable_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModificationOnTable_Test.java @@ -38,6 +38,7 @@ * {@link ToChange#changeOfModificationOnTable(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfModificationOnTable_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfModificationOnTable_Test extends AbstractTest { @Test @NeedReload public void test_change_of_modification_on_table_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -128,7 +129,7 @@ public void test_change_of_modification_on_table_with_assertions() throws Except @Test @NeedReload public void test_change_of_modification_on_table_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModification_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModification_Integer_Test.java index 0b0e8dcf..ad90c950 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModification_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModification_Integer_Test.java @@ -38,6 +38,7 @@ * {@link ToChange#changeOfModification(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfModification_Integer_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfModification_Integer_Test extends AbstractTest { @Test @NeedReload public void test_change_of_modification_with_index_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -144,7 +145,7 @@ public void test_change_of_modification_with_index_with_assertions() throws Exce @Test @NeedReload public void test_change_of_modification_with_index_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModification_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModification_Test.java index a82b1dd7..aea6dc90 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModification_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOfModification_Test.java @@ -12,15 +12,6 @@ */ package org.assertj.db.navigation; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.db.api.Assertions.assertThat; -import static org.assertj.db.output.Outputs.output; -import static org.junit.Assert.fail; - -import java.lang.reflect.Field; -import java.util.List; -import java.util.Map; - import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeAssert; import org.assertj.db.api.ChangesAssert; @@ -33,11 +24,21 @@ import org.assertj.db.type.Changes; import org.junit.Test; +import java.lang.reflect.Field; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.db.api.Assertions.assertThat; +import static org.assertj.db.output.Outputs.output; +import static org.junit.Assert.fail; + /** * Tests on {@link org.assertj.db.navigation.ToChange} class : * {@link org.assertj.db.navigation.ToChange#changeOfModification()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOfModification_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOfModification_Test extends AbstractTest { @Test @NeedReload public void test_change_of_modification_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -128,7 +129,7 @@ public void test_change_of_modification_with_assertions() throws Exception { @Test @NeedReload public void test_change_of_modification_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTableWithPks_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTableWithPks_Test.java index 5e10fe96..7ae09b50 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTableWithPks_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTableWithPks_Test.java @@ -12,14 +12,6 @@ */ package org.assertj.db.navigation; -import static org.assertj.db.api.Assertions.assertThat; -import static org.assertj.db.output.Outputs.output; -import static org.junit.Assert.fail; - -import java.lang.reflect.Field; -import java.util.List; -import java.util.Map; - import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeAssert; import org.assertj.db.api.ChangesAssert; @@ -32,11 +24,20 @@ import org.assertj.db.type.Changes; import org.junit.Test; +import java.lang.reflect.Field; +import java.util.List; +import java.util.Map; + +import static org.assertj.db.api.Assertions.assertThat; +import static org.assertj.db.output.Outputs.output; +import static org.junit.Assert.fail; + /** * Tests on {@link ToChange} class : * {@link ToChange#changeOnTableWithPks(String, Object...)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOnTableWithPks_Test extends AbstractTest { @@ -46,7 +47,7 @@ public class ToChange_ChangeOnTableWithPks_Test extends AbstractTest { @Test @NeedReload public void test_change_on_table_with_pks_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -127,7 +128,7 @@ public void test_change_on_table_with_pks_with_assertions() throws Exception { @Test @NeedReload public void test_change_on_table_with_pks_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTable_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTable_Integer_Test.java index 054f6594..3b61d506 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTable_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTable_Integer_Test.java @@ -38,6 +38,7 @@ * {@link ToChange#changeOnTable(String, int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOnTable_Integer_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOnTable_Integer_Test extends AbstractTest { @Test @NeedReload public void test_change_on_table_with_index_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -138,7 +139,7 @@ public void test_change_on_table_with_index_with_assertions() throws Exception { @Test @NeedReload public void test_change_on_table_with_index_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTable_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTable_Test.java index 7b1a4a04..aba577a3 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTable_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_ChangeOnTable_Test.java @@ -38,6 +38,7 @@ * {@link org.assertj.db.navigation.ToChange#changeOnTable(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_ChangeOnTable_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_ChangeOnTable_Test extends AbstractTest { @Test @NeedReload public void test_change_on_table_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -122,7 +123,7 @@ public void test_change_on_table_with_assertions() throws Exception { @Test @NeedReload public void test_change_on_table_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_Change_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_Change_Integer_Test.java index 0a303075..1a79396c 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_Change_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_Change_Integer_Test.java @@ -38,6 +38,7 @@ * {@link org.assertj.db.navigation.ToChange#change(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_Change_Integer_Test extends AbstractTest { @@ -48,7 +49,7 @@ public class ToChange_Change_Integer_Test extends AbstractTest { @Test @NeedReload public void test_change_with_index_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -185,7 +186,7 @@ public void test_change_with_index_with_assertions() throws Exception { @Test @NeedReload public void test_change_with_index_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_Change_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_Change_Test.java index 825a7b2c..12dc0e87 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_Change_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_Change_Test.java @@ -38,6 +38,7 @@ * {@link ToChange#change()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_Change_Test extends AbstractTest { @@ -47,7 +48,7 @@ public class ToChange_Change_Test extends AbstractTest { @Test @NeedReload public void test_change_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -167,7 +168,7 @@ public void test_change_with_assertions() throws Exception { @Test @NeedReload public void test_change_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChange_Test.java b/src/test/java/org/assertj/db/navigation/ToChange_Test.java index a2e79c6d..b8bbca41 100644 --- a/src/test/java/org/assertj/db/navigation/ToChange_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChange_Test.java @@ -31,6 +31,7 @@ * Tests on {@link ToChange} interface. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChange_Test extends AbstractTest { @@ -40,7 +41,7 @@ public class ToChange_Test extends AbstractTest { @Test @NeedReload public void test_to_change_navigation_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -124,7 +125,7 @@ public void test_to_change_navigation_with_assertions() throws Exception { @Test @NeedReload public void test_to_change_navigation_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToChanges_Test.java b/src/test/java/org/assertj/db/navigation/ToChanges_Test.java index 83e37055..39902e21 100644 --- a/src/test/java/org/assertj/db/navigation/ToChanges_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToChanges_Test.java @@ -33,6 +33,7 @@ * Tests on {@link org.assertj.db.navigation.ToChanges} interface. * * @author Régis Pouiller + * @author Julien Roy */ public class ToChanges_Test extends AbstractTest { @@ -42,7 +43,7 @@ public class ToChanges_Test extends AbstractTest { @Test @NeedReload public void test_to_changes_navigation_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -121,7 +122,7 @@ public void test_to_changes_navigation_with_assertions() throws Exception { @Test @NeedReload public void test_to_changes_navigation_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_Integer_Test.java index 7ec87724..b5ad33ce 100644 --- a/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_Integer_Test.java @@ -40,6 +40,7 @@ * {@link org.assertj.db.navigation.ToColumnFromChange#columnAmongTheModifiedOnes()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToColumnFromChange_ColumnAmongTheModifiedOnes_Integer_Test extends AbstractTest { @@ -49,7 +50,7 @@ public class ToColumnFromChange_ColumnAmongTheModifiedOnes_Integer_Test extends @Test @NeedReload public void test_column_among_the_modified_ones_with_index_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -185,7 +186,7 @@ public void test_column_among_the_modified_ones_with_index_with_assertions() thr @Test @NeedReload public void test_column_among_the_modified_ones_with_index_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_String_Test.java b/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_String_Test.java index 5e49c2c2..edddb128 100644 --- a/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_String_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_String_Test.java @@ -39,6 +39,7 @@ * {@link org.assertj.db.navigation.ToColumnFromChange#columnAmongTheModifiedOnes()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToColumnFromChange_ColumnAmongTheModifiedOnes_String_Test extends AbstractTest { @@ -48,7 +49,7 @@ public class ToColumnFromChange_ColumnAmongTheModifiedOnes_String_Test extends A @Test @NeedReload public void test_column_among_the_modified_ones_with_column_name_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -171,7 +172,7 @@ public void test_column_among_the_modified_ones_with_column_name_with_assertions @Test @NeedReload public void test_column_among_the_modified_ones_with_column_name_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_Test.java b/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_Test.java index dbeda675..dfe13def 100644 --- a/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToColumnFromChange_ColumnAmongTheModifiedOnes_Test.java @@ -40,6 +40,7 @@ * {@link org.assertj.db.navigation.ToColumnFromChange#columnAmongTheModifiedOnes()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToColumnFromChange_ColumnAmongTheModifiedOnes_Test extends AbstractTest { @@ -49,7 +50,7 @@ public class ToColumnFromChange_ColumnAmongTheModifiedOnes_Test extends Abstract @Test @NeedReload public void test_column_among_the_modified_ones_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -165,7 +166,7 @@ public void test_column_among_the_modified_ones_with_assertions() throws Excepti @Test @NeedReload public void test_column_among_the_modified_ones_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToColumn_Column_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToColumn_Column_Integer_Test.java index 4f1d4150..e0abf69c 100644 --- a/src/test/java/org/assertj/db/navigation/ToColumn_Column_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToColumn_Column_Integer_Test.java @@ -56,6 +56,7 @@ * {@link org.assertj.db.navigation.ToColumn#column(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToColumn_Column_Integer_Test extends AbstractTest { @@ -65,7 +66,7 @@ public class ToColumn_Column_Integer_Test extends AbstractTest { @Test @NeedReload public void test_column_with_index_from_change_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -193,7 +194,7 @@ public void test_column_with_index_from_table_with_assertions() throws Exception Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); Position position = (Position) fieldPosition.get(tableAssert); @@ -297,7 +298,7 @@ public void test_column_with_index_from_request_with_assertions() throws Excepti Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); Position position = (Position) fieldPosition.get(requestAssert); Assertions.assertThat(fieldIndex.get(position)).isEqualTo(0); @@ -400,7 +401,7 @@ public void test_column_with_index_from_request_with_assertions() throws Excepti @Test @NeedReload public void test_column_with_index_from_change_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -528,7 +529,7 @@ public void test_column_with_index_from_table_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); Position position = (Position) fieldPosition.get(tableOutputter); Assertions.assertThat(fieldIndex.get(position)).isEqualTo(0); @@ -631,7 +632,7 @@ public void test_column_with_index_from_request_with_displays() throws Exception Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); Position position = (Position) fieldPosition.get(requestOutputter); Assertions.assertThat(fieldIndex.get(position)).isEqualTo(0); diff --git a/src/test/java/org/assertj/db/navigation/ToColumn_Column_String_Test.java b/src/test/java/org/assertj/db/navigation/ToColumn_Column_String_Test.java index c5e85acb..197eff18 100644 --- a/src/test/java/org/assertj/db/navigation/ToColumn_Column_String_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToColumn_Column_String_Test.java @@ -55,6 +55,7 @@ * {@link org.assertj.db.navigation.ToColumn#column(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToColumn_Column_String_Test extends AbstractTest { @@ -64,7 +65,7 @@ public class ToColumn_Column_String_Test extends AbstractTest { @Test @NeedReload public void test_column_with_column_name_from_change_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -179,7 +180,7 @@ public void test_column_with_column_name_from_table_with_assertions() throws Exc Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); Position position = (Position) fieldPosition.get(tableAssert); Assertions.assertThat(fieldIndex.get(position)).isEqualTo(0); @@ -275,7 +276,7 @@ public void test_column_with_column_name_from_request_with_assertions() throws E Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); Position position = (Position) fieldPosition.get(requestAssert); Assertions.assertThat(fieldIndex.get(position)).isEqualTo(0); @@ -365,7 +366,7 @@ public void test_column_with_column_name_from_request_with_assertions() throws E @Test @NeedReload public void test_column_with_column_name_from_change_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -480,7 +481,7 @@ public void test_column_with_column_name_from_table_with_displays() throws Excep Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); Position position = (Position) fieldPosition.get(tableOutputter); @@ -578,7 +579,7 @@ public void test_column_with_column_name_from_request_with_displays() throws Exc Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); Position position = (Position) fieldPosition.get(requestOutputter); diff --git a/src/test/java/org/assertj/db/navigation/ToColumn_Column_Test.java b/src/test/java/org/assertj/db/navigation/ToColumn_Column_Test.java index c949f594..ec493958 100644 --- a/src/test/java/org/assertj/db/navigation/ToColumn_Column_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToColumn_Column_Test.java @@ -56,6 +56,7 @@ * {@link org.assertj.db.navigation.ToColumn#column()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToColumn_Column_Test extends AbstractTest { @@ -65,7 +66,7 @@ public class ToColumn_Column_Test extends AbstractTest { @Test @NeedReload public void test_column_from_change_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -172,7 +173,7 @@ public void test_column_from_table_with_assertions() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); Position position = (Position) fieldPosition.get(tableAssert); assertThat(fieldIndex.get(position)).isEqualTo(0); @@ -259,7 +260,7 @@ public void test_column_from_request_with_assertions() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); Position position = (Position) fieldPosition.get(requestAssert); assertThat(fieldIndex.get(position)).isEqualTo(0); @@ -342,7 +343,7 @@ public void test_column_from_request_with_assertions() throws Exception { @Test @NeedReload public void test_column_from_change_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -449,7 +450,7 @@ public void test_column_from_table_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); Position position = (Position) fieldPosition.get(tableOutputter); @@ -538,7 +539,7 @@ public void test_column_from_request_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); Position position = (Position) fieldPosition.get(requestOutputter); assertThat(fieldIndex.get(position)).isEqualTo(0); diff --git a/src/test/java/org/assertj/db/navigation/ToRowFromChange_RowAtEndPoint_Test.java b/src/test/java/org/assertj/db/navigation/ToRowFromChange_RowAtEndPoint_Test.java index c939f3c7..6f1d65a4 100644 --- a/src/test/java/org/assertj/db/navigation/ToRowFromChange_RowAtEndPoint_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToRowFromChange_RowAtEndPoint_Test.java @@ -36,6 +36,7 @@ * {@link org.assertj.db.navigation.ToRowFromChange#rowAtEndPoint()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToRowFromChange_RowAtEndPoint_Test extends AbstractTest { @@ -45,7 +46,7 @@ public class ToRowFromChange_RowAtEndPoint_Test extends AbstractTest { @Test @NeedReload public void test_row_at_end_point_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -99,7 +100,7 @@ public void test_row_at_end_point_with_assertions() throws Exception { @Test @NeedReload public void test_row_at_end_point_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToRowFromChange_RowAtStartPoint_Test.java b/src/test/java/org/assertj/db/navigation/ToRowFromChange_RowAtStartPoint_Test.java index 20495cad..32b9891f 100644 --- a/src/test/java/org/assertj/db/navigation/ToRowFromChange_RowAtStartPoint_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToRowFromChange_RowAtStartPoint_Test.java @@ -36,6 +36,7 @@ * {@link org.assertj.db.navigation.ToRowFromChange#rowAtStartPoint()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToRowFromChange_RowAtStartPoint_Test extends AbstractTest { @@ -45,7 +46,7 @@ public class ToRowFromChange_RowAtStartPoint_Test extends AbstractTest { @Test @NeedReload public void test_row_at_start_point_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -99,7 +100,7 @@ public void test_row_at_start_point_with_assertions() throws Exception { @Test @NeedReload public void test_row_at_start_point_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToRow_Row_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToRow_Row_Integer_Test.java index 97466aa5..8e5fa1ac 100644 --- a/src/test/java/org/assertj/db/navigation/ToRow_Row_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToRow_Row_Integer_Test.java @@ -46,6 +46,7 @@ * {@link org.assertj.db.navigation.ToRow#row(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToRow_Row_Integer_Test extends AbstractTest { @@ -61,7 +62,7 @@ public void test_column_from_table_with_assertions() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); Position position = (Position) fieldPosition.get(tableAssert); @@ -157,7 +158,7 @@ public void test_column_from_request_with_assertions() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); Position position = (Position) fieldPosition.get(requestAssert); @@ -259,7 +260,7 @@ public void test_column_from_table_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); Position position = (Position) fieldPosition.get(tableOutputter); @@ -355,7 +356,7 @@ public void test_column_from_request_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); Position position = (Position) fieldPosition.get(requestOutputter); diff --git a/src/test/java/org/assertj/db/navigation/ToRow_Row_Test.java b/src/test/java/org/assertj/db/navigation/ToRow_Row_Test.java index 63798128..57cf622b 100644 --- a/src/test/java/org/assertj/db/navigation/ToRow_Row_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToRow_Row_Test.java @@ -46,6 +46,7 @@ * {@link org.assertj.db.navigation.ToRow#row()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToRow_Row_Test extends AbstractTest { @@ -61,7 +62,7 @@ public void test_row_from_table_with_assertions() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); Position position = (Position) fieldPosition.get(tableAssert); @@ -147,7 +148,7 @@ public void test_row_from_request_with_assertions() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); Position position = (Position) fieldPosition.get(requestAssert); @@ -233,7 +234,7 @@ public void test_row_from_table_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); Position position = (Position) fieldPosition.get(tableOutputter); @@ -319,7 +320,7 @@ public void test_row_from_request_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); Position position = (Position) fieldPosition.get(requestOutputter); diff --git a/src/test/java/org/assertj/db/navigation/ToValueFromColumn_ValueAtEndPoint_Test.java b/src/test/java/org/assertj/db/navigation/ToValueFromColumn_ValueAtEndPoint_Test.java index 732ed634..52fb061e 100644 --- a/src/test/java/org/assertj/db/navigation/ToValueFromColumn_ValueAtEndPoint_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToValueFromColumn_ValueAtEndPoint_Test.java @@ -40,6 +40,7 @@ * {@link org.assertj.db.navigation.ToValueFromColumn#valueAtEndPoint()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToValueFromColumn_ValueAtEndPoint_Test extends AbstractTest { @@ -49,7 +50,7 @@ public class ToValueFromColumn_ValueAtEndPoint_Test extends AbstractTest { @Test @NeedReload public void test_value_at_end_point_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -106,7 +107,7 @@ public void test_value_at_end_point_with_assertions() throws Exception { @Test @NeedReload public void test_value_at_end_point_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToValueFromColumn_ValueAtStartPoint_Test.java b/src/test/java/org/assertj/db/navigation/ToValueFromColumn_ValueAtStartPoint_Test.java index 86881417..66676720 100644 --- a/src/test/java/org/assertj/db/navigation/ToValueFromColumn_ValueAtStartPoint_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToValueFromColumn_ValueAtStartPoint_Test.java @@ -40,6 +40,7 @@ * {@link org.assertj.db.navigation.ToValueFromColumn#valueAtStartPoint()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToValueFromColumn_ValueAtStartPoint_Test extends AbstractTest { @@ -49,7 +50,7 @@ public class ToValueFromColumn_ValueAtStartPoint_Test extends AbstractTest { @Test @NeedReload public void test_value_at_start_point_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -107,7 +108,7 @@ public void test_value_at_start_point_with_assertions() throws Exception { @Test @NeedReload public void test_value_at_start_point_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/navigation/ToValueFromRow_Value_String_Test.java b/src/test/java/org/assertj/db/navigation/ToValueFromRow_Value_String_Test.java index 0804f38e..4df22db4 100644 --- a/src/test/java/org/assertj/db/navigation/ToValueFromRow_Value_String_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToValueFromRow_Value_String_Test.java @@ -47,6 +47,7 @@ * {@link org.assertj.db.navigation.ToValueFromRow#value(String)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToValueFromRow_Value_String_Test extends AbstractTest { @@ -57,7 +58,7 @@ public class ToValueFromRow_Value_String_Test extends AbstractTest { @Test @NeedReload public void should_fail_because_row_does_not_exist() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -75,7 +76,7 @@ public void should_fail_because_row_does_not_exist() { @Test @NeedReload public void test_value_from_row_of_change_with_column_name() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -165,7 +166,7 @@ public void test_value_from_row_of_table() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableRowAssert tableRowAssert = tableAssert.row(); Position position = (Position) fieldPosition.get(tableRowAssert); @@ -246,7 +247,7 @@ public void test_value_from_row_of_request() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); RequestRowAssert requestRowAssert = requestAssert.row(); Position position = (Position) fieldPosition.get(requestRowAssert); diff --git a/src/test/java/org/assertj/db/navigation/ToValue_Value_Integer_Test.java b/src/test/java/org/assertj/db/navigation/ToValue_Value_Integer_Test.java index e8a5eec4..75b72817 100644 --- a/src/test/java/org/assertj/db/navigation/ToValue_Value_Integer_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToValue_Value_Integer_Test.java @@ -73,6 +73,7 @@ * {@link org.assertj.db.navigation.ToValue#value(int)} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToValue_Value_Integer_Test extends AbstractTest { @@ -82,7 +83,7 @@ public class ToValue_Value_Integer_Test extends AbstractTest { @Test @NeedReload public void test_value_from_row_of_change_with_index_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -194,7 +195,7 @@ public void test_value_from_column_of_table_with_index_with_assertions() throws Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableColumnAssert tableColumnAssert = tableAssert.column(); Position position = @@ -270,7 +271,7 @@ public void test_value_from_row_of_table_with_index_with_assertions() throws Exc Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableRowAssert tableRowAssert = tableAssert.row(); Position position = @@ -360,7 +361,7 @@ public void test_value_from_column_of_request_with_index_with_assertions() throw Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); RequestColumnAssert requestColumnAssert = requestAssert.column(); Position position = (Position) fieldPosition.get(requestColumnAssert); @@ -434,7 +435,7 @@ public void test_value_from_row_of_request_with_index_with_assertions() throws E Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); RequestRowAssert requestRowAssert = requestAssert.row(); Position position = (Position) fieldPosition.get(requestRowAssert); @@ -516,7 +517,7 @@ public void test_value_from_row_of_request_with_index_with_assertions() throws E @Test @NeedReload public void test_value_from_row_of_change_with_index_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -626,7 +627,7 @@ public void test_value_from_column_of_table_with_index_with_displays() throws Ex Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); TableColumnOutputter tableColumnOutputter = tableOutputter.column(); Position position = (Position) fieldPosition.get(tableColumnOutputter); @@ -700,7 +701,7 @@ public void test_value_from_row_of_table_with_index_with_displays() throws Excep Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); TableRowOutputter tableRowOutputter = tableOutputter.row(); Position position = (Position) fieldPosition.get(tableRowOutputter); @@ -788,7 +789,7 @@ public void test_value_from_column_of_request_with_index_with_displays() throws Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); RequestColumnOutputter requestColumnOutputter = requestOutputter.column(); Position position = (Position) fieldPosition.get(requestColumnOutputter); @@ -862,7 +863,7 @@ public void test_value_from_row_of_request_with_index_with_displays() throws Exc Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); RequestRowOutputter requestRowOutputter = requestOutputter.row(); Position position = (Position) fieldPosition.get(requestRowOutputter); diff --git a/src/test/java/org/assertj/db/navigation/ToValue_Value_Test.java b/src/test/java/org/assertj/db/navigation/ToValue_Value_Test.java index f5477e97..6e10200d 100644 --- a/src/test/java/org/assertj/db/navigation/ToValue_Value_Test.java +++ b/src/test/java/org/assertj/db/navigation/ToValue_Value_Test.java @@ -73,6 +73,7 @@ * {@link org.assertj.db.navigation.ToValue#value()} method. * * @author Régis Pouiller + * @author Julien Roy */ public class ToValue_Value_Test extends AbstractTest { @@ -82,7 +83,7 @@ public class ToValue_Value_Test extends AbstractTest { @Test @NeedReload public void test_value_from_row_of_change_with_assertions() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -176,7 +177,7 @@ public void test_value_from_column_of_table_with_assertions() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableColumnAssert tableColumnAssert = tableAssert.column(); Position position = (Position) fieldPosition.get(tableColumnAssert); @@ -234,7 +235,7 @@ public void test_value_from_row_of_table_with_assertions() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableAssert tableAssert = assertThat(table); TableRowAssert tableRowAssert = tableAssert.row(); Position position = (Position) fieldPosition.get(tableRowAssert); @@ -306,7 +307,7 @@ public void test_value_from_column_of_request_with_assertions() throws Exception Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); RequestColumnAssert requestColumnAssert = requestAssert.column(); Position position = (Position) fieldPosition.get(requestColumnAssert); @@ -364,7 +365,7 @@ public void test_value_from_row_of_request_with_assertions() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestAssert requestAssert = assertThat(request); RequestRowAssert requestRowAssert = requestAssert.row(); Position position = (Position) fieldPosition.get(requestRowAssert); @@ -430,7 +431,7 @@ public void test_value_from_row_of_request_with_assertions() throws Exception { @Test @NeedReload public void test_value_from_row_of_change_with_displays() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -524,7 +525,7 @@ public void test_value_from_column_of_table_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); TableColumnOutputter tableColumnOutputter = tableOutputter.column(); Position position = (Position) fieldPosition.get(tableColumnOutputter); @@ -582,7 +583,7 @@ public void test_value_from_row_of_table_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = Outputs.output(table); TableRowOutputter tableRowOutputter = tableOutputter.row(); Position position = (Position) fieldPosition.get(tableRowOutputter); @@ -654,7 +655,7 @@ public void test_value_from_column_of_request_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); RequestColumnOutputter requestColumnOutputter = requestOutputter.column(); Position position = (Position) fieldPosition.get(requestColumnOutputter); @@ -712,7 +713,7 @@ public void test_value_from_row_of_request_with_displays() throws Exception { Field fieldIndex = Position.class.getDeclaredField("nextIndex"); fieldIndex.setAccessible(true); - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = Outputs.output(request); RequestRowOutputter requestRowOutputter = requestOutputter.row(); Position position = (Position) fieldPosition.get(requestRowOutputter); diff --git a/src/test/java/org/assertj/db/output/OutputterChange_Test.java b/src/test/java/org/assertj/db/output/OutputterChange_Test.java index f1b248c2..d60f63e8 100644 --- a/src/test/java/org/assertj/db/output/OutputterChange_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterChange_Test.java @@ -26,6 +26,7 @@ * Test the output of changes. * * @author Régis Pouiller + * @author Julien Roy */ public class OutputterChange_Test extends AbstractTest { @@ -35,7 +36,7 @@ public class OutputterChange_Test extends AbstractTest { @Test @NeedReload public void test_output() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -55,7 +56,7 @@ public void test_output() throws Exception { .change().toStream(byteArrayOutputStream5) .change().toStream(byteArrayOutputStream6) .change().toStream(byteArrayOutputStream7); - Assertions.assertThat(byteArrayOutputStream0.toString()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream0.toString()).isEqualTo(String.format("[Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|----------|-------|---------|----------------|-----------|-----------|-----------|------------|--------------------------------------|%n" + "| | | | | * | | | | |%n" + "| TYPE | TABLE | PRIMARY | | ID | NAME | FIRSTNAME | BIRTH | ACTOR_IMDB |%n" @@ -66,7 +67,7 @@ public void test_output() throws Exception { + "| CREATION | ACTOR | 4 |----------------|-----------|-----------|-----------|------------|--------------------------------------|%n" + "| | | | At end point | 4 | Murray | Bill | 1950-09-21 | 30b443ae-c0c9-4790-9bec-ce1380808435 |%n" + "|----------|-------|---------|----------------|-----------|-----------|-----------|------------|--------------------------------------|%n")); - Assertions.assertThat(byteArrayOutputStream1.toString()).isEqualTo(String.format("[Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream1.toString()).isEqualTo(String.format("[Change at index 1 (on table : INTERPRETATION and with primary key : [6]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|----------|----------------|---------|----------------|-----------|-----------|-----------|------------------|%n" + "| | | | | * | | | |%n" + "| TYPE | TABLE | PRIMARY | | ID | ID_MOVIE | ID_ACTOR | CHARACTER |%n" @@ -77,7 +78,7 @@ public void test_output() throws Exception { + "| CREATION | INTERPRETATION | 6 |----------------|-----------|-----------|-----------|------------------|%n" + "| | | | At end point | 6 | 4 | 4 | Dr Peter Venkman |%n" + "|----------|----------------|---------|----------------|-----------|-----------|-----------|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream2.toString()).isEqualTo(String.format("[Change at index 2 (on table : MOVIE and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream2.toString()).isEqualTo(String.format("[Change at index 2 (on table : MOVIE and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|----------|-------|---------|----------------|-----------|--------------|-----------|--------------------------------------|%n" + "| | | | | * | | | |%n" + "| TYPE | TABLE | PRIMARY | | ID | TITLE | YEAR | MOVIE_IMDB |%n" @@ -88,7 +89,7 @@ public void test_output() throws Exception { + "| CREATION | MOVIE | 4 |----------------|-----------|--------------|-----------|--------------------------------------|%n" + "| | | | At end point | 4 | Ghostbusters | 1984 | 30b443ae-c0c9-4790-9bec-ce1380808435 |%n" + "|----------|-------|---------|----------------|-----------|--------------|-----------|--------------------------------------|%n")); - Assertions.assertThat(byteArrayOutputStream3.toString()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream3.toString()).isEqualTo(String.format("[Change at index 3 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------------|------------|--------------------------------------|%n" + "| | | | | * | | | | |%n" + "| TYPE | TABLE | PRIMARY | | ID | NAME | FIRSTNAME | BIRTH | ACTOR_IMDB |%n" @@ -99,7 +100,7 @@ public void test_output() throws Exception { + "| MODIFICATION | ACTOR | 1 |----------------|-----------|-----------|-----------------|------------|--------------------------------------|%n" + "| | | | At end point | 1 | Weaver | Susan Alexandra | 1949-10-08 | 30b443ae-c0c9-4790-9bec-ce1380808435 |%n" + "|--------------|-------|---------|----------------|-----------|-----------|-----------------|------------|--------------------------------------|%n")); - Assertions.assertThat(byteArrayOutputStream4.toString()).isEqualTo(String.format("[Change at index 4 (on table : INTERPRETATION and with primary key : [3]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream4.toString()).isEqualTo(String.format("[Change at index 4 (on table : INTERPRETATION and with primary key : [3]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|--------------|----------------|---------|----------------|-----------|-----------|-----------|------------------------|%n" + "| | | | | * | | | |%n" + "| TYPE | TABLE | PRIMARY | | ID | ID_MOVIE | ID_ACTOR | CHARACTER |%n" @@ -110,7 +111,7 @@ public void test_output() throws Exception { + "| MODIFICATION | INTERPRETATION | 3 |----------------|-----------|-----------|-----------|------------------------|%n" + "| | | | At end point | 3 | 3 | 1 | Doctor Grace Augustine |%n" + "|--------------|----------------|---------|----------------|-----------|-----------|-----------|------------------------|%n")); - Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Change at index 5 (on table : MOVIE and with primary key : [3]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream5.toString()).isEqualTo(String.format("[Change at index 5 (on table : MOVIE and with primary key : [3]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|--------------|-------|---------|----------------|-----------|------------|-----------|--------------------------------------|%n" + "| | | | | * | | | |%n" + "| TYPE | TABLE | PRIMARY | | ID | TITLE | YEAR | MOVIE_IMDB |%n" @@ -121,7 +122,7 @@ public void test_output() throws Exception { + "| MODIFICATION | MOVIE | 3 |----------------|-----------|------------|-----------|--------------------------------------|%n" + "| | | | At end point | 3 | The Avatar | 2009 | d735221b-5de5-4112-aa1e-49090cb75ada |%n" + "|--------------|-------|---------|----------------|-----------|------------|-----------|--------------------------------------|%n")); - Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 6 (on table : ACTOR and with primary key : [3]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream6.toString()).isEqualTo(String.format("[Change at index 6 (on table : ACTOR and with primary key : [3]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|----------|-------|---------|----------------|-----------|-------------|-----------|------------|--------------------------------------|%n" + "| | | | | * | | | | |%n" + "| TYPE | TABLE | PRIMARY | | ID | NAME | FIRSTNAME | BIRTH | ACTOR_IMDB |%n" @@ -132,7 +133,7 @@ public void test_output() throws Exception { + "| DELETION | ACTOR | 3 |----------------|-----------|-------------|-----------|------------|--------------------------------------|%n" + "| | | | At end point | | | | | |%n" + "|----------|-------|---------|----------------|-----------|-------------|-----------|------------|--------------------------------------|%n")); - Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Change at index 7 (on table : INTERPRETATION and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream7.toString()).isEqualTo(String.format("[Change at index 7 (on table : INTERPRETATION and with primary key : [5]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|----------|----------------|---------|----------------|-----------|-----------|-----------|------------|%n" + "| | | | | * | | | |%n" + "| TYPE | TABLE | PRIMARY | | ID | ID_MOVIE | ID_ACTOR | CHARACTER |%n" diff --git a/src/test/java/org/assertj/db/output/OutputterChanges_Test.java b/src/test/java/org/assertj/db/output/OutputterChanges_Test.java index 10138a02..cea4f6c1 100644 --- a/src/test/java/org/assertj/db/output/OutputterChanges_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterChanges_Test.java @@ -26,6 +26,7 @@ * Test the output of changes. * * @author Régis Pouiller + * @author Julien Roy */ public class OutputterChanges_Test extends AbstractTest { @@ -35,13 +36,13 @@ public class OutputterChanges_Test extends AbstractTest { @Test @NeedReload public void test_output() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); output(changes).toStream(byteArrayOutputStream); - Assertions.assertThat(byteArrayOutputStream.toString()).isEqualTo(String.format("[Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream.toString()).isEqualTo(String.format("[Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|-----------|--------------|----------------|---------|----------------|-----------|-----------|-----------|------------|--------------------------------------|%n" + "| | | | | | * | | | | |%n" + "| | TYPE | TABLE | PRIMARY | | ID | NAME | FIRSTNAME | BIRTH | ACTOR_IMDB |%n" diff --git a/src/test/java/org/assertj/db/output/OutputterColumn_Test.java b/src/test/java/org/assertj/db/output/OutputterColumn_Test.java index 4091979c..4959e768 100644 --- a/src/test/java/org/assertj/db/output/OutputterColumn_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterColumn_Test.java @@ -28,6 +28,7 @@ * Test the output of columns. * * @author Régis Pouiller + * @author Julien Roy */ public class OutputterColumn_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class OutputterColumn_Test extends AbstractTest { */ @Test public void test_output_for_table() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream1 = new ByteArrayOutputStream(); @@ -78,7 +79,7 @@ public void test_output_for_table() throws Exception { */ @Test public void test_output_for_request() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream1 = new ByteArrayOutputStream(); @@ -121,7 +122,7 @@ public void test_output_for_request() throws Exception { @Test @NeedReload public void test_output_for_change() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -131,7 +132,7 @@ public void test_output_for_change() throws Exception { output(changes).change().column().toStream(byteArrayOutputStream0) .column().toStream(byteArrayOutputStream1) .column().toStream(byteArrayOutputStream2); - Assertions.assertThat(byteArrayOutputStream0.toString()).isEqualTo(String.format("[Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream0.toString()).isEqualTo(String.format("[Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|----------------|----------|%n" + "| | ID |%n" + "| | (NUMBER) |%n" @@ -140,7 +141,7 @@ public void test_output_for_change() throws Exception { + "|----------------|----------|%n" + "| At end point | 4 |%n" + "|----------------|----------|%n")); - Assertions.assertThat(byteArrayOutputStream1.toString()).isEqualTo(String.format("[Column at index 1 (column name : NAME) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream1.toString()).isEqualTo(String.format("[Column at index 1 (column name : NAME) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|----------------|--------|%n" + "| | NAME |%n" + "| | (TEXT) |%n" @@ -149,7 +150,7 @@ public void test_output_for_change() throws Exception { + "|----------------|--------|%n" + "| At end point | Murray |%n" + "|----------------|--------|%n")); - Assertions.assertThat(byteArrayOutputStream2.toString()).isEqualTo(String.format("[Column at index 2 (column name : FIRSTNAME) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream2.toString()).isEqualTo(String.format("[Column at index 2 (column name : FIRSTNAME) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|----------------|-----------|%n" + "| | FIRSTNAME |%n" + "| | (TEXT) |%n" diff --git a/src/test/java/org/assertj/db/output/OutputterException_Test.java b/src/test/java/org/assertj/db/output/OutputterException_Test.java index 5b375dd7..638ca9cc 100644 --- a/src/test/java/org/assertj/db/output/OutputterException_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterException_Test.java @@ -29,6 +29,7 @@ * Test the exception of output. * * @author Régis Pouiller + * @author Julien Roy * @author Pascal Schumacher */ public class OutputterException_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class OutputterException_Test extends AbstractTest { */ @Test public void test_display_from_column_for_table() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); try { Outputs.output(table).column(null); @@ -62,7 +63,7 @@ public void test_display_from_column_for_table() throws Exception { */ @Test public void test_display_from_column_for_request() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); try { Outputs.output(request).column(null); @@ -87,7 +88,7 @@ public void test_display_from_column_for_request() throws Exception { @Test @NeedReload public void test_output_for_row_from_change() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -118,7 +119,7 @@ public void test_output_for_row_from_change() throws Exception { */ @Test public void test_display_from_value_from_row_for_table() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); try { Outputs.output(table).row().value(null); @@ -142,7 +143,7 @@ public void test_display_from_value_from_row_for_table() throws Exception { */ @Test public void test_display_from_value_from_row_for_request() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); try { Outputs.output(request).row().value(null); @@ -163,7 +164,7 @@ public void test_display_from_value_from_row_for_request() throws Exception { @Test public void test_display_to_file() { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); try { Outputs.output(request).toFile("test" + File.separator + "test.txt"); diff --git a/src/test/java/org/assertj/db/output/OutputterRequest_Test.java b/src/test/java/org/assertj/db/output/OutputterRequest_Test.java index 35fddfdd..ed25f40b 100644 --- a/src/test/java/org/assertj/db/output/OutputterRequest_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterRequest_Test.java @@ -25,6 +25,7 @@ * Test the output of requests. * * @author Régis Pouiller + * @author Julien Roy */ public class OutputterRequest_Test extends AbstractTest { @@ -33,7 +34,7 @@ public class OutputterRequest_Test extends AbstractTest { */ @Test public void test_output() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); output(request).toStream(byteArrayOutputStream); @@ -55,7 +56,7 @@ public void test_output() throws Exception { */ @Test public void test_navigation() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); RequestOutputter requestOutputter = output(request); diff --git a/src/test/java/org/assertj/db/output/OutputterRow_Test.java b/src/test/java/org/assertj/db/output/OutputterRow_Test.java index a6bc2001..10e35b61 100644 --- a/src/test/java/org/assertj/db/output/OutputterRow_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterRow_Test.java @@ -28,6 +28,7 @@ * Test the output of rows. * * @author Régis Pouiller + * @author Julien Roy */ public class OutputterRow_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class OutputterRow_Test extends AbstractTest { */ @Test public void test_output_for_table() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream1 = new ByteArrayOutputStream(); @@ -78,7 +79,7 @@ public void test_output_for_table() throws Exception { */ @Test public void test_output_for_request() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream1 = new ByteArrayOutputStream(); @@ -121,7 +122,7 @@ public void test_output_for_request() throws Exception { @Test @NeedReload public void test_output_for_change() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -131,9 +132,9 @@ public void test_output_for_change() throws Exception { output(changes).change().rowAtStartPoint().toStream(byteArrayOutputStream0) .rowAtEndPoint().toStream(byteArrayOutputStream1) .changeOfModification().rowAtStartPoint().toStream(byteArrayOutputStream2); - Assertions.assertThat(byteArrayOutputStream0.toString()).isEqualTo(String.format("[Row at start point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream0.toString()).isEqualTo(String.format("[Row at start point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "Row does not exist%n")); - Assertions.assertThat(byteArrayOutputStream1.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream1.toString()).isEqualTo(String.format("[Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|---------|-----------|-----------|-----------|------------|--------------------------------------|%n" + "| | * | | | | |%n" + "| PRIMARY | ID | NAME | FIRSTNAME | BIRTH | ACTOR_IMDB |%n" @@ -142,7 +143,7 @@ public void test_output_for_change() throws Exception { + "|---------|-----------|-----------|-----------|------------|--------------------------------------|%n" + "| 4 | 4 | Murray | Bill | 1950-09-21 | 30b443ae-c0c9-4790-9bec-ce1380808435 |%n" + "|---------|-----------|-----------|-----------|------------|--------------------------------------|%n")); - Assertions.assertThat(byteArrayOutputStream2.toString()).isEqualTo(String.format("[Row at start point of Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only modification changes)]%n" + Assertions.assertThat(byteArrayOutputStream2.toString()).isEqualTo(String.format("[Row at start point of Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only modification changes)]%n" + "|---------|-----------|-----------|-----------|------------|--------------------------------------|%n" + "| | * | | | | |%n" + "| PRIMARY | ID | NAME | FIRSTNAME | BIRTH | ACTOR_IMDB |%n" diff --git a/src/test/java/org/assertj/db/output/OutputterTable_Test.java b/src/test/java/org/assertj/db/output/OutputterTable_Test.java index f0d19022..8fa8d8c4 100644 --- a/src/test/java/org/assertj/db/output/OutputterTable_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterTable_Test.java @@ -25,6 +25,7 @@ * Test the output of tables. * * @author Régis Pouiller + * @author Julien Roy */ public class OutputterTable_Test extends AbstractTest { @@ -33,7 +34,7 @@ public class OutputterTable_Test extends AbstractTest { */ @Test public void test_output() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); output(table).toStream(byteArrayOutputStream); @@ -55,7 +56,7 @@ public void test_output() throws Exception { */ @Test public void test_navigation() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); TableOutputter tableOutputter = output(table); diff --git a/src/test/java/org/assertj/db/output/OutputterToConsole_Test.java b/src/test/java/org/assertj/db/output/OutputterToConsole_Test.java index bc24c259..defa44ca 100644 --- a/src/test/java/org/assertj/db/output/OutputterToConsole_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterToConsole_Test.java @@ -24,6 +24,7 @@ * Test the output to console. * * @author Régis Pouiller + * @author Julien Roy */ public class OutputterToConsole_Test extends AbstractTest { @@ -32,7 +33,7 @@ public class OutputterToConsole_Test extends AbstractTest { */ @Test public void test_output_to_console() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); System.setOut(new PrintStream(byteArrayOutputStream0)); diff --git a/src/test/java/org/assertj/db/output/OutputterToFile_Test.java b/src/test/java/org/assertj/db/output/OutputterToFile_Test.java index 0e654a53..fe4e2d68 100644 --- a/src/test/java/org/assertj/db/output/OutputterToFile_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterToFile_Test.java @@ -25,6 +25,7 @@ * Test the output to File. * * @author Régis Pouiller + * @author Julien Roy */ public class OutputterToFile_Test extends AbstractTest { @@ -33,7 +34,7 @@ public class OutputterToFile_Test extends AbstractTest { */ @Test public void test_output_to_file() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); Outputs.output(table).row().value().toFile("target" + File.separator + "test.txt"); try (InputStream inputStream = new FileInputStream(new File("target" + File.separator + "test.txt"))) { diff --git a/src/test/java/org/assertj/db/output/OutputterToStream_Test.java b/src/test/java/org/assertj/db/output/OutputterToStream_Test.java index 705a1dc9..55d7e2b0 100644 --- a/src/test/java/org/assertj/db/output/OutputterToStream_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterToStream_Test.java @@ -23,6 +23,7 @@ * Test the output to Stream. * * @author Régis Pouiller + * @author Julien Roy */ public class OutputterToStream_Test extends AbstractTest { @@ -31,7 +32,7 @@ public class OutputterToStream_Test extends AbstractTest { */ @Test public void test_output_to_stream() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); Outputs.output(table).row().value().toStream(byteArrayOutputStream0); diff --git a/src/test/java/org/assertj/db/output/OutputterValue_Test.java b/src/test/java/org/assertj/db/output/OutputterValue_Test.java index 35e0f7be..635cd8bf 100644 --- a/src/test/java/org/assertj/db/output/OutputterValue_Test.java +++ b/src/test/java/org/assertj/db/output/OutputterValue_Test.java @@ -28,6 +28,7 @@ * Test the output of values. * * @author Régis Pouiller + * @author Julien Roy */ public class OutputterValue_Test extends AbstractTest { @@ -36,7 +37,7 @@ public class OutputterValue_Test extends AbstractTest { */ @Test public void test_output_for_row_from_table() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream1 = new ByteArrayOutputStream(); @@ -81,7 +82,7 @@ public void test_output_for_row_from_table() throws Exception { */ @Test public void test_output_for_row_from_request() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream1 = new ByteArrayOutputStream(); @@ -127,7 +128,7 @@ public void test_output_for_row_from_request() throws Exception { @Test @NeedReload public void test_output_for_row_from_change() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -139,28 +140,28 @@ public void test_output_for_row_from_change() throws Exception { .changeOfModification().rowAtStartPoint().value().toStream(byteArrayOutputStream1) .rowAtEndPoint().value().toStream(byteArrayOutputStream2) .value("firstname").toStream(byteArrayOutputStream3); - Assertions.assertThat(byteArrayOutputStream0.toString()).isEqualTo(String.format("[Value at index 0 (column name : ID) of Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream0.toString()).isEqualTo(String.format("[Value at index 0 (column name : ID) of Row at end point of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|----------|%n" + "| ID |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 4 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream1.toString()).isEqualTo(String.format("[Value at index 0 (column name : ID) of Row at start point of Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only modification changes)]%n" + Assertions.assertThat(byteArrayOutputStream1.toString()).isEqualTo(String.format("[Value at index 0 (column name : ID) of Row at start point of Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only modification changes)]%n" + "|----------|%n" + "| ID |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream2.toString()).isEqualTo(String.format("[Value at index 0 (column name : ID) of Row at end point of Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only modification changes)]%n" + Assertions.assertThat(byteArrayOutputStream2.toString()).isEqualTo(String.format("[Value at index 0 (column name : ID) of Row at end point of Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only modification changes)]%n" + "|----------|%n" + "| ID |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 1 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream3.toString()).isEqualTo(String.format("[Value at index 2 (column name : FIRSTNAME) of Row at end point of Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' source (only modification changes)]%n" + Assertions.assertThat(byteArrayOutputStream3.toString()).isEqualTo(String.format("[Value at index 2 (column name : FIRSTNAME) of Row at end point of Change at index 0 (on table : ACTOR and with primary key : [1]) of Changes on tables of 'sa/jdbc:h2:mem:test' (only modification changes)]%n" + "|-----------------|%n" + "| FIRSTNAME |%n" + "| (TEXT) |%n" @@ -174,7 +175,7 @@ public void test_output_for_row_from_change() throws Exception { */ @Test public void test_output_for_column_from_table() throws Exception { - Table table = new Table(source, "actor"); + Table table = new Table(jdbcConnectionProvider, "actor"); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream1 = new ByteArrayOutputStream(); @@ -219,7 +220,7 @@ public void test_output_for_column_from_table() throws Exception { */ @Test public void test_output_for_column_from_request() throws Exception { - Request request = new Request(source, "select * from actor"); + Request request = new Request(jdbcConnectionProvider, "select * from actor"); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream1 = new ByteArrayOutputStream(); @@ -266,7 +267,7 @@ public void test_output_for_column_from_request() throws Exception { @Test @NeedReload public void test_output_for_column_from_change() throws Exception { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -276,21 +277,21 @@ public void test_output_for_column_from_change() throws Exception { output(changes).change().column().valueAtStartPoint().toStream(byteArrayOutputStream0) .valueAtEndPoint().toStream(byteArrayOutputStream1) .column().valueAtEndPoint().toStream(byteArrayOutputStream2); - Assertions.assertThat(byteArrayOutputStream0.toString()).isEqualTo(String.format("[Value at start point of Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream0.toString()).isEqualTo(String.format("[Value at start point of Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|------------------|%n" + "| ID |%n" + "| (NOT_IDENTIFIED) |%n" + "|------------------|%n" + "| null |%n" + "|------------------|%n")); - Assertions.assertThat(byteArrayOutputStream1.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream1.toString()).isEqualTo(String.format("[Value at end point of Column at index 0 (column name : ID) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|----------|%n" + "| ID |%n" + "| (NUMBER) |%n" + "|----------|%n" + "| 4 |%n" + "|----------|%n")); - Assertions.assertThat(byteArrayOutputStream2.toString()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : NAME) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test' source]%n" + Assertions.assertThat(byteArrayOutputStream2.toString()).isEqualTo(String.format("[Value at end point of Column at index 1 (column name : NAME) of Change at index 0 (on table : ACTOR and with primary key : [4]) of Changes on tables of 'sa/jdbc:h2:mem:test']%n" + "|--------|%n" + "| NAME |%n" + "| (TEXT) |%n" diff --git a/src/test/java/org/assertj/db/output/impl/OutputType_ValueOf_Test.java b/src/test/java/org/assertj/db/output/impl/OutputType_ValueOf_Test.java index 37476d35..ae41c089 100644 --- a/src/test/java/org/assertj/db/output/impl/OutputType_ValueOf_Test.java +++ b/src/test/java/org/assertj/db/output/impl/OutputType_ValueOf_Test.java @@ -12,10 +12,10 @@ */ package org.assertj.db.output.impl; -import org.junit.Test; - import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + /** * Test on the type got from {@code valueOf} method from {@code RepresentationType} enum. * diff --git a/src/test/java/org/assertj/db/output/impl/PlainOutput_Test.java b/src/test/java/org/assertj/db/output/impl/PlainOutput_Test.java index c66aecbe..326b5063 100644 --- a/src/test/java/org/assertj/db/output/impl/PlainOutput_Test.java +++ b/src/test/java/org/assertj/db/output/impl/PlainOutput_Test.java @@ -12,14 +12,7 @@ */ package org.assertj.db.output.impl; -import org.assertj.core.api.WritableAssertionInfo; -import org.assertj.db.common.AbstractTest; -import org.assertj.db.type.Change; -import org.assertj.db.type.ChangeType; -import org.assertj.db.type.DataType; -import org.assertj.db.type.Row; -import org.assertj.db.type.Value; -import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; import java.sql.Date; import java.sql.Time; @@ -29,7 +22,14 @@ import java.util.Locale; import java.util.UUID; -import static org.assertj.core.api.Assertions.assertThat; +import org.assertj.core.api.WritableAssertionInfo; +import org.assertj.db.common.AbstractTest; +import org.assertj.db.type.Change; +import org.assertj.db.type.ChangeType; +import org.assertj.db.type.DataType; +import org.assertj.db.type.Row; +import org.assertj.db.type.Value; +import org.junit.Test; /** * Test on the utility class {@code PlainRepresentation}. diff --git a/src/test/java/org/assertj/db/type/AbstractDbElement_Exception_Test.java b/src/test/java/org/assertj/db/type/AbstractDbElement_Exception_Test.java deleted file mode 100644 index 8e47f1b9..00000000 --- a/src/test/java/org/assertj/db/type/AbstractDbElement_Exception_Test.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * Copyright 2015-2024 the original author or authors. - */ -package org.assertj.db.type; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; - -import java.sql.SQLException; - -import org.assertj.db.common.AbstractTest; -import org.assertj.db.common.DefaultConnection; -import org.junit.Test; - -/** - * Tests on the exceptions of {@code AbstractDbElement} - * - * @author Régis Pouiller - */ -public class AbstractDbElement_Exception_Test extends AbstractTest { - - /** - * This method should fail because {@code getCatalog} throws an SQL Exception. - */ - @Test - public void should_fail_because_getCatalog_throws_an_SQLException() { - try { - AbstractDbElement.getCatalog(new DefaultConnection(null) { - - @Override - public String getCatalog() throws SQLException { - throw new SQLException("test"); - } - }); - fail("An exception must be raised"); - } catch (SQLException exception) { - assertThat(exception.getMessage()).isEqualTo("test"); - } - } - - /** - * Tests if returns {@code null} because {@code getCatalog} throws an Exception. - * - * @throws SQLException - */ - @Test - public void test_if_returns_null_because_getCatalog_throws_an_Exception() throws SQLException { - String catalog = AbstractDbElement.getCatalog(new DefaultConnection(null) { - - @Override - public String getCatalog() throws SQLException { - throw new RuntimeException("test"); - } - }); - assertThat(catalog).isNull(); - } - - /** - * This method should fail because {@code getSchema} throws an SQL Exception. - */ - @Test - public void should_fail_because_getSchema_throws_an_SQLException() { - try { - AbstractDbElement.getSchema(new DefaultConnection(null) { - - @Override - public String getSchema() throws SQLException { - throw new SQLException("test"); - } - }); - fail("An exception must be raised"); - } catch (SQLException exception) { - assertThat(exception.getMessage()).isEqualTo("test"); - } - } - - /** - * Tests if returns {@code null} because {@code getSchema} throws an Exception. - * - * @throws SQLException - */ - @Test - public void test_if_returns_null_because_getSchema_throws_an_Exception() throws SQLException { - String schema = AbstractDbElement.getSchema(new DefaultConnection(null) { - - @Override - public String getCatalog() throws SQLException { - throw new RuntimeException("test"); - } - }); - assertThat(schema).isNull(); - } -} diff --git a/src/test/java/org/assertj/db/type/CachedSchemaMetaData_Test.java b/src/test/java/org/assertj/db/type/CachedSchemaMetaData_Test.java new file mode 100644 index 00000000..f1d5d61d --- /dev/null +++ b/src/test/java/org/assertj/db/type/CachedSchemaMetaData_Test.java @@ -0,0 +1,50 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2024 the original author or authors. + */ +package org.assertj.db.type; + +import org.assertj.db.common.AbstractTest; +import org.junit.Test; + +import javax.xml.validation.Schema; +import java.sql.Time; +import java.text.ParseException; +import java.time.LocalTime; +import java.util.Calendar; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Tests on the cached schema metadata. + * + * @author Julien Roy + */ +public class CachedSchemaMetaData_Test extends AbstractTest { + + @Test + public void test_get_tables() { + CachedSchemaMetaData metaData = new CachedSchemaMetaData(jdbcConnectionProvider); + assertThat(metaData.getTablesName()).containsExactly("ACTOR", "INTERPRETATION", "MOVIE", "TEST", "TEST2"); + } + + @Test + public void test_get_columns() { + CachedSchemaMetaData metaData = new CachedSchemaMetaData(jdbcConnectionProvider); + assertThat(metaData.getColumnsName("ACTOR")).containsExactly("ID", "NAME", "FIRSTNAME", "BIRTH", "ACTOR_IMDB"); + } + + @Test + public void test_get_primary_keys() { + CachedSchemaMetaData metaData = new CachedSchemaMetaData(jdbcConnectionProvider); + assertThat(metaData.getPrimaryKeys("ACTOR")).containsExactly("ID"); + } +} diff --git a/src/test/java/org/assertj/db/type/Change_GetDataType_Test.java b/src/test/java/org/assertj/db/type/Change_GetDataType_Test.java index f15a8855..28ab6c3c 100644 --- a/src/test/java/org/assertj/db/type/Change_GetDataType_Test.java +++ b/src/test/java/org/assertj/db/type/Change_GetDataType_Test.java @@ -21,7 +21,8 @@ /** * Tests on the {@code getDataType} method. * - * @author Régis Pouiller. + * @author Régis Pouiller + * @author Julien Roy. */ public class Change_GetDataType_Test extends AbstractTest { @@ -31,7 +32,7 @@ public class Change_GetDataType_Test extends AbstractTest { @Test @NeedReload public void test_getDataTypeOfTable() { - Changes changes = new Changes(source).setStartPointNow(); + Changes changes = new Changes(jdbcConnectionProvider).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); @@ -44,7 +45,7 @@ public void test_getDataTypeOfTable() { @Test @NeedReload public void test_getDataTypeOfRequest() { - Changes changes = new Changes(new Request(source, "select * from movie")).setStartPointNow(); + Changes changes = new Changes(new Request(jdbcConnectionProvider, "select * from movie")).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/type/Changes_Constructor_Test.java b/src/test/java/org/assertj/db/type/Changes_Constructor_Test.java index 9790b047..97ac7e0d 100644 --- a/src/test/java/org/assertj/db/type/Changes_Constructor_Test.java +++ b/src/test/java/org/assertj/db/type/Changes_Constructor_Test.java @@ -21,15 +21,16 @@ * Tests on the constructors of Changes * * @author Régis Pouiller + * @author Julien Roy */ public class Changes_Constructor_Test extends AbstractTest { /** - * This method test the constructor with source. + * This method test the constructor with jdbc connection provider. */ @Test - public void test_constructor_source() { - Changes changes = new Changes(source); + public void test_constructor_jdbc() { + Changes changes = new Changes(jdbcConnectionProvider); assertThat(changes.getRequestAtStartPoint()).isNull(); assertThat(changes.getRequestAtEndPoint()).isNull(); @@ -41,25 +42,20 @@ public void test_constructor_source() { assertThat(changes.getRequestAtStartPoint()).isNull(); assertThat(changes.getRequestAtEndPoint()).isNull(); assertThat(changes.getTablesAtStartPointList()).isNotNull(); - assertThat(changes.getTablesAtStartPointList().size()).isEqualTo(5); - assertThat(changes.getTablesAtStartPointList().get(0).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(0).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList()).hasSize(5); + assertThat(changes.getTablesAtStartPointList().get(0).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(0).getName()).isEqualTo("ACTOR"); assertThat(changes.getTablesAtStartPointList().get(0).getRequest()).isEqualTo("SELECT * FROM ACTOR"); - assertThat(changes.getTablesAtStartPointList().get(1).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(1).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList().get(1).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(1).getName()).isEqualTo("INTERPRETATION"); assertThat(changes.getTablesAtStartPointList().get(1).getRequest()).isEqualTo("SELECT * FROM INTERPRETATION"); - assertThat(changes.getTablesAtStartPointList().get(2).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(2).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList().get(2).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(2).getName()).isEqualTo("MOVIE"); assertThat(changes.getTablesAtStartPointList().get(2).getRequest()).isEqualTo("SELECT * FROM MOVIE"); - assertThat(changes.getTablesAtStartPointList().get(3).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(3).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList().get(3).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(3).getName()).isEqualTo("TEST"); assertThat(changes.getTablesAtStartPointList().get(3).getRequest()).isEqualTo("SELECT * FROM TEST"); - assertThat(changes.getTablesAtStartPointList().get(4).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(4).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList().get(4).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(4).getName()).isEqualTo("TEST2"); assertThat(changes.getTablesAtStartPointList().get(4).getRequest()).isEqualTo("SELECT * FROM TEST2"); assertThat(changes.getTablesAtEndPointList()).isNull(); @@ -69,47 +65,37 @@ public void test_constructor_source() { assertThat(changes.getRequestAtStartPoint()).isNull(); assertThat(changes.getRequestAtEndPoint()).isNull(); assertThat(changes.getTablesAtStartPointList()).isNotNull(); - assertThat(changes.getTablesAtStartPointList().size()).isEqualTo(5); - assertThat(changes.getTablesAtStartPointList().get(0).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(0).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList()).hasSize(5); + assertThat(changes.getTablesAtStartPointList().get(0).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(0).getName()).isEqualTo("ACTOR"); assertThat(changes.getTablesAtStartPointList().get(0).getRequest()).isEqualTo("SELECT * FROM ACTOR"); - assertThat(changes.getTablesAtStartPointList().get(1).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(1).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList().get(1).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(1).getName()).isEqualTo("INTERPRETATION"); assertThat(changes.getTablesAtStartPointList().get(1).getRequest()).isEqualTo("SELECT * FROM INTERPRETATION"); - assertThat(changes.getTablesAtStartPointList().get(2).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(2).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList().get(2).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(2).getName()).isEqualTo("MOVIE"); assertThat(changes.getTablesAtStartPointList().get(2).getRequest()).isEqualTo("SELECT * FROM MOVIE"); - assertThat(changes.getTablesAtStartPointList().get(3).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(3).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList().get(3).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(3).getName()).isEqualTo("TEST"); assertThat(changes.getTablesAtStartPointList().get(3).getRequest()).isEqualTo("SELECT * FROM TEST"); - assertThat(changes.getTablesAtStartPointList().get(4).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(4).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList().get(4).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(4).getName()).isEqualTo("TEST2"); assertThat(changes.getTablesAtStartPointList().get(4).getRequest()).isEqualTo("SELECT * FROM TEST2"); assertThat(changes.getTablesAtEndPointList()).isNotNull(); - assertThat(changes.getTablesAtEndPointList().size()).isEqualTo(5); - assertThat(changes.getTablesAtEndPointList().get(0).getSource()).isSameAs(source); - assertThat(changes.getTablesAtEndPointList().get(0).getDataSource()).isNull(); + assertThat(changes.getTablesAtEndPointList()).hasSize(5); + assertThat(changes.getTablesAtEndPointList().get(0).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(0).getName()).isEqualTo("ACTOR"); assertThat(changes.getTablesAtEndPointList().get(0).getRequest()).isEqualTo("SELECT * FROM ACTOR"); - assertThat(changes.getTablesAtEndPointList().get(1).getSource()).isSameAs(source); - assertThat(changes.getTablesAtEndPointList().get(1).getDataSource()).isNull(); + assertThat(changes.getTablesAtEndPointList().get(1).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(1).getName()).isEqualTo("INTERPRETATION"); assertThat(changes.getTablesAtEndPointList().get(1).getRequest()).isEqualTo("SELECT * FROM INTERPRETATION"); - assertThat(changes.getTablesAtEndPointList().get(2).getSource()).isSameAs(source); - assertThat(changes.getTablesAtEndPointList().get(2).getDataSource()).isNull(); + assertThat(changes.getTablesAtEndPointList().get(2).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(2).getName()).isEqualTo("MOVIE"); assertThat(changes.getTablesAtEndPointList().get(2).getRequest()).isEqualTo("SELECT * FROM MOVIE"); - assertThat(changes.getTablesAtEndPointList().get(3).getSource()).isSameAs(source); - assertThat(changes.getTablesAtEndPointList().get(3).getDataSource()).isNull(); + assertThat(changes.getTablesAtEndPointList().get(3).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(3).getName()).isEqualTo("TEST"); assertThat(changes.getTablesAtEndPointList().get(3).getRequest()).isEqualTo("SELECT * FROM TEST"); - assertThat(changes.getTablesAtEndPointList().get(4).getSource()).isSameAs(source); - assertThat(changes.getTablesAtEndPointList().get(4).getDataSource()).isNull(); + assertThat(changes.getTablesAtEndPointList().get(4).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(4).getName()).isEqualTo("TEST2"); assertThat(changes.getTablesAtEndPointList().get(4).getRequest()).isEqualTo("SELECT * FROM TEST2"); } @@ -119,7 +105,7 @@ public void test_constructor_source() { */ @Test public void test_constructor_datasource() { - Changes changes = new Changes(dataSource); + Changes changes = new Changes(dsConnectionProvider); assertThat(changes.getRequestAtStartPoint()).isNull(); assertThat(changes.getRequestAtEndPoint()).isNull(); @@ -131,25 +117,20 @@ public void test_constructor_datasource() { assertThat(changes.getRequestAtStartPoint()).isNull(); assertThat(changes.getRequestAtEndPoint()).isNull(); assertThat(changes.getTablesAtStartPointList()).isNotNull(); - assertThat(changes.getTablesAtStartPointList().size()).isEqualTo(5); - assertThat(changes.getTablesAtStartPointList().get(0).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(0).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList()).hasSize(5); + assertThat(changes.getTablesAtStartPointList().get(0).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(0).getName()).isEqualTo("ACTOR"); assertThat(changes.getTablesAtStartPointList().get(0).getRequest()).isEqualTo("SELECT * FROM ACTOR"); - assertThat(changes.getTablesAtStartPointList().get(1).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(1).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList().get(1).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(1).getName()).isEqualTo("INTERPRETATION"); assertThat(changes.getTablesAtStartPointList().get(1).getRequest()).isEqualTo("SELECT * FROM INTERPRETATION"); - assertThat(changes.getTablesAtStartPointList().get(2).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(2).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList().get(2).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(2).getName()).isEqualTo("MOVIE"); assertThat(changes.getTablesAtStartPointList().get(2).getRequest()).isEqualTo("SELECT * FROM MOVIE"); - assertThat(changes.getTablesAtStartPointList().get(3).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(3).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList().get(3).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(3).getName()).isEqualTo("TEST"); assertThat(changes.getTablesAtStartPointList().get(3).getRequest()).isEqualTo("SELECT * FROM TEST"); - assertThat(changes.getTablesAtStartPointList().get(4).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(4).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList().get(4).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(4).getName()).isEqualTo("TEST2"); assertThat(changes.getTablesAtStartPointList().get(4).getRequest()).isEqualTo("SELECT * FROM TEST2"); assertThat(changes.getTablesAtEndPointList()).isNull(); @@ -159,47 +140,37 @@ public void test_constructor_datasource() { assertThat(changes.getRequestAtStartPoint()).isNull(); assertThat(changes.getRequestAtEndPoint()).isNull(); assertThat(changes.getTablesAtStartPointList()).isNotNull(); - assertThat(changes.getTablesAtStartPointList().size()).isEqualTo(5); - assertThat(changes.getTablesAtStartPointList().get(0).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(0).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList()).hasSize(5); + assertThat(changes.getTablesAtStartPointList().get(0).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(0).getName()).isEqualTo("ACTOR"); assertThat(changes.getTablesAtStartPointList().get(0).getRequest()).isEqualTo("SELECT * FROM ACTOR"); - assertThat(changes.getTablesAtStartPointList().get(1).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(1).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList().get(1).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(1).getName()).isEqualTo("INTERPRETATION"); assertThat(changes.getTablesAtStartPointList().get(1).getRequest()).isEqualTo("SELECT * FROM INTERPRETATION"); - assertThat(changes.getTablesAtStartPointList().get(2).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(2).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList().get(2).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(2).getName()).isEqualTo("MOVIE"); assertThat(changes.getTablesAtStartPointList().get(2).getRequest()).isEqualTo("SELECT * FROM MOVIE"); - assertThat(changes.getTablesAtStartPointList().get(3).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(3).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList().get(3).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(3).getName()).isEqualTo("TEST"); assertThat(changes.getTablesAtStartPointList().get(3).getRequest()).isEqualTo("SELECT * FROM TEST"); - assertThat(changes.getTablesAtStartPointList().get(4).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(4).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList().get(4).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(4).getName()).isEqualTo("TEST2"); assertThat(changes.getTablesAtStartPointList().get(4).getRequest()).isEqualTo("SELECT * FROM TEST2"); assertThat(changes.getTablesAtEndPointList()).isNotNull(); - assertThat(changes.getTablesAtEndPointList().size()).isEqualTo(5); - assertThat(changes.getTablesAtEndPointList().get(0).getSource()).isNull(); - assertThat(changes.getTablesAtEndPointList().get(0).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtEndPointList()).hasSize(5); + assertThat(changes.getTablesAtEndPointList().get(0).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(0).getName()).isEqualTo("ACTOR"); assertThat(changes.getTablesAtEndPointList().get(0).getRequest()).isEqualTo("SELECT * FROM ACTOR"); - assertThat(changes.getTablesAtEndPointList().get(1).getSource()).isNull(); - assertThat(changes.getTablesAtEndPointList().get(1).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtEndPointList().get(1).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(1).getName()).isEqualTo("INTERPRETATION"); assertThat(changes.getTablesAtEndPointList().get(1).getRequest()).isEqualTo("SELECT * FROM INTERPRETATION"); - assertThat(changes.getTablesAtEndPointList().get(2).getSource()).isNull(); - assertThat(changes.getTablesAtEndPointList().get(2).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtEndPointList().get(2).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(2).getName()).isEqualTo("MOVIE"); assertThat(changes.getTablesAtEndPointList().get(2).getRequest()).isEqualTo("SELECT * FROM MOVIE"); - assertThat(changes.getTablesAtEndPointList().get(3).getSource()).isNull(); - assertThat(changes.getTablesAtEndPointList().get(3).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtEndPointList().get(3).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(3).getName()).isEqualTo("TEST"); assertThat(changes.getTablesAtEndPointList().get(3).getRequest()).isEqualTo("SELECT * FROM TEST"); - assertThat(changes.getTablesAtEndPointList().get(4).getSource()).isNull(); - assertThat(changes.getTablesAtEndPointList().get(4).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtEndPointList().get(4).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(4).getName()).isEqualTo("TEST2"); assertThat(changes.getTablesAtEndPointList().get(4).getRequest()).isEqualTo("SELECT * FROM TEST2"); } @@ -209,7 +180,7 @@ public void test_constructor_datasource() { */ @Test public void test_constructor_one_table() { - Changes changes = new Changes(new Table(source, "test")); + Changes changes = new Changes(new Table(jdbcConnectionProvider, "test")); assertThat(changes.getRequestAtStartPoint()).isNull(); assertThat(changes.getRequestAtEndPoint()).isNull(); @@ -217,18 +188,16 @@ public void test_constructor_one_table() { assertThat(changes.getTablesAtStartPointList()).isNull(); changes.setStartPointNow(); assertThat(changes.getTablesAtStartPointList()).isNotNull(); - assertThat(changes.getTablesAtStartPointList().size()).isEqualTo(1); - assertThat(changes.getTablesAtStartPointList().get(0).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(0).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList()).hasSize(1); + assertThat(changes.getTablesAtStartPointList().get(0).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(0).getName()).isEqualTo("TEST"); assertThat(changes.getTablesAtStartPointList().get(0).getRequest()).isEqualTo("SELECT * FROM TEST"); assertThat(changes.getTablesAtEndPointList()).isNull(); changes.setEndPointNow(); assertThat(changes.getTablesAtEndPointList()).isNotNull(); - assertThat(changes.getTablesAtEndPointList().size()).isEqualTo(1); - assertThat(changes.getTablesAtEndPointList().get(0).getSource()).isSameAs(source); - assertThat(changes.getTablesAtEndPointList().get(0).getDataSource()).isNull(); + assertThat(changes.getTablesAtEndPointList()).hasSize(1); + assertThat(changes.getTablesAtEndPointList().get(0).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(0).getName()).isEqualTo("TEST"); assertThat(changes.getTablesAtEndPointList().get(0).getRequest()).isEqualTo("SELECT * FROM TEST"); } @@ -238,7 +207,7 @@ public void test_constructor_one_table() { */ @Test public void test_constructor_two_tables() { - Changes changes = new Changes(new Table(source, "test"), new Table(dataSource, "test2")); + Changes changes = new Changes(new Table(jdbcConnectionProvider, "test"), new Table(dsConnectionProvider, "test2")); assertThat(changes.getRequestAtStartPoint()).isNull(); assertThat(changes.getRequestAtEndPoint()).isNull(); @@ -246,26 +215,22 @@ public void test_constructor_two_tables() { assertThat(changes.getTablesAtStartPointList()).isNull(); changes.setStartPointNow(); assertThat(changes.getTablesAtStartPointList()).isNotNull(); - assertThat(changes.getTablesAtStartPointList().size()).isEqualTo(2); - assertThat(changes.getTablesAtStartPointList().get(0).getSource()).isSameAs(source); - assertThat(changes.getTablesAtStartPointList().get(0).getDataSource()).isNull(); + assertThat(changes.getTablesAtStartPointList()).hasSize(2); + assertThat(changes.getTablesAtStartPointList().get(0).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(0).getName()).isEqualTo("TEST"); assertThat(changes.getTablesAtStartPointList().get(0).getRequest()).isEqualTo("SELECT * FROM TEST"); - assertThat(changes.getTablesAtStartPointList().get(1).getSource()).isNull(); - assertThat(changes.getTablesAtStartPointList().get(1).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtStartPointList().get(1).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtStartPointList().get(1).getName()).isEqualTo("TEST2"); assertThat(changes.getTablesAtStartPointList().get(1).getRequest()).isEqualTo("SELECT * FROM TEST2"); assertThat(changes.getTablesAtEndPointList()).isNull(); changes.setEndPointNow(); assertThat(changes.getTablesAtEndPointList()).isNotNull(); - assertThat(changes.getTablesAtEndPointList().size()).isEqualTo(2); - assertThat(changes.getTablesAtEndPointList().get(0).getSource()).isSameAs(source); - assertThat(changes.getTablesAtEndPointList().get(0).getDataSource()).isNull(); + assertThat(changes.getTablesAtEndPointList()).hasSize(2); + assertThat(changes.getTablesAtEndPointList().get(0).getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(0).getName()).isEqualTo("TEST"); assertThat(changes.getTablesAtEndPointList().get(0).getRequest()).isEqualTo("SELECT * FROM TEST"); - assertThat(changes.getTablesAtEndPointList().get(1).getSource()).isNull(); - assertThat(changes.getTablesAtEndPointList().get(1).getDataSource()).isSameAs(dataSource); + assertThat(changes.getTablesAtEndPointList().get(1).getConnectionProvider()).isSameAs(dsConnectionProvider); assertThat(changes.getTablesAtEndPointList().get(1).getName()).isEqualTo("TEST2"); assertThat(changes.getTablesAtEndPointList().get(1).getRequest()).isEqualTo("SELECT * FROM TEST2"); } @@ -275,7 +240,7 @@ public void test_constructor_two_tables() { */ @Test public void test_constructor_request() { - Changes changes = new Changes(new Request(source, "select * from test")); + Changes changes = new Changes(new Request(jdbcConnectionProvider, "select * from test")); assertThat(changes.getRequestAtStartPoint()).isNull(); assertThat(changes.getRequestAtEndPoint()).isNull(); @@ -285,7 +250,7 @@ public void test_constructor_request() { changes.setStartPointNow(); assertThat(changes.getRequestAtStartPoint()).isNotNull(); - assertThat(changes.getRequestAtStartPoint().getSource()).isSameAs(source); + assertThat(changes.getRequestAtStartPoint().getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getRequestAtStartPoint().getRequest()).isEqualTo("select * from test"); assertThat(changes.getRequestAtEndPoint()).isNull(); assertThat(changes.getTablesAtStartPointList()).isNull(); @@ -295,7 +260,7 @@ public void test_constructor_request() { assertThat(changes.getRequestAtStartPoint()).isNotNull(); assertThat(changes.getRequestAtEndPoint()).isNotNull(); - assertThat(changes.getRequestAtEndPoint().getSource()).isSameAs(source); + assertThat(changes.getRequestAtEndPoint().getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(changes.getRequestAtEndPoint().getRequest()).isEqualTo("select * from test"); assertThat(changes.getTablesAtStartPointList()).isNull(); assertThat(changes.getTablesAtEndPointList()).isNull(); diff --git a/src/test/java/org/assertj/db/type/Changes_Exception_Test.java b/src/test/java/org/assertj/db/type/Changes_Exception_Test.java index d3976a17..adfe4d7d 100644 --- a/src/test/java/org/assertj/db/type/Changes_Exception_Test.java +++ b/src/test/java/org/assertj/db/type/Changes_Exception_Test.java @@ -27,9 +27,10 @@ import org.junit.Test; /** - * Tests on the exceptions of Changes + * Tests on the exceptions to the Changes * * @author Régis Pouiller + * @author Julien Roy */ public class Changes_Exception_Test extends AbstractTest { @@ -38,8 +39,8 @@ public class Changes_Exception_Test extends AbstractTest { */ @Test(expected = AssertJDBException.class) public void should_fail_because_connection_throws_exception_when_getting_an_object() { - DataSource ds = new DefaultDataSource(dataSource); - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(new DefaultDataSource(dataSource)).create(); + Table table = new Table(connectionProvider, "movi"); Changes changes = new Changes().setTables(table); changes.setStartPointNow(); } @@ -62,7 +63,8 @@ public DatabaseMetaData getMetaData() throws SQLException { }; } }; - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Table table = new Table(connectionProvider, "movi"); Changes changes = new Changes().setTables(table); changes.setStartPointNow(); } @@ -91,7 +93,8 @@ public ResultSet executeQuery(String sql) throws SQLException { }; } }; - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Table table = new Table(connectionProvider, "movi"); Changes changes = new Changes().setTables(table); changes.setStartPointNow(); } @@ -113,7 +116,8 @@ public DatabaseMetaData getMetaData() throws SQLException { }; } }; - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Table table = new Table(connectionProvider, "movi"); Changes changes = new Changes().setTables(table); changes.setStartPointNow(); } @@ -135,7 +139,8 @@ public Statement createStatement() throws SQLException { }; } }; - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Table table = new Table(connectionProvider, "movi"); Changes changes = new Changes().setTables(table); changes.setStartPointNow(); } @@ -151,7 +156,8 @@ public Connection getConnection() throws SQLException { throw new SQLException(); } }; - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Table table = new Table(connectionProvider, "movi"); Changes changes = new Changes().setTables(table); changes.setStartPointNow(); } @@ -177,7 +183,7 @@ public void should_fail_because_request_is_null() { */ @Test(expected = AssertJDBException.class) public void should_fail_because_end_before_start() { - Table table = new Table(dataSource, "test"); + Table table = new Table(dsConnectionProvider, "test"); Changes changes = new Changes().setTables(table); changes.setEndPointNow(); } @@ -187,7 +193,7 @@ public void should_fail_because_end_before_start() { */ @Test(expected = AssertJDBException.class) public void should_fail_because_getting_list_of_changes_before_end() { - Table table = new Table(dataSource, "test"); + Table table = new Table(dsConnectionProvider, "test"); Changes changes = new Changes().setTables(table); changes.setStartPointNow(); changes.getChangesList(); @@ -198,7 +204,7 @@ public void should_fail_because_getting_list_of_changes_before_end() { */ @Test(expected = NullPointerException.class) public void should_fail_because_tablename_is_null() { - new Changes(source).getChangesOfTable(null); + new Changes(jdbcConnectionProvider).getChangesOfTable(null); } /** @@ -206,6 +212,6 @@ public void should_fail_because_tablename_is_null() { */ @Test(expected = NullPointerException.class) public void should_fail_because_type_is_null() { - new Changes(source).getChangesOfType(null); + new Changes(jdbcConnectionProvider).getChangesOfType(null); } } diff --git a/src/test/java/org/assertj/db/type/Changes_GetChangesOfTable_Test.java b/src/test/java/org/assertj/db/type/Changes_GetChangesOfTable_Test.java index 2f15ca14..916fbfca 100644 --- a/src/test/java/org/assertj/db/type/Changes_GetChangesOfTable_Test.java +++ b/src/test/java/org/assertj/db/type/Changes_GetChangesOfTable_Test.java @@ -25,7 +25,8 @@ /** * Tests on the {@code getChangesOfTable} method. * - * @author Régis Pouiller. + * @author Régis Pouiller + * @author Julien Roy. */ public class Changes_GetChangesOfTable_Test extends AbstractTest { @@ -35,8 +36,8 @@ public class Changes_GetChangesOfTable_Test extends AbstractTest { @Test @NeedReload public void test_getChangesOfTable() { - Changes changesSource = new Changes(source); - Changes changesRequest = new Changes(new Request(source, + Changes changesSource = new Changes(jdbcConnectionProvider); + Changes changesRequest = new Changes(new Request(jdbcConnectionProvider, "select interpretation.id, character, movie.title, actor.name " + " from interpretation, movie, actor " + " where interpretation.id_movie = movie.id " + " and interpretation.id_actor = actor.id ").setPksName("id")); diff --git a/src/test/java/org/assertj/db/type/Changes_GetChangesOfType_Test.java b/src/test/java/org/assertj/db/type/Changes_GetChangesOfType_Test.java index d95f5d4d..2d8cc2c3 100644 --- a/src/test/java/org/assertj/db/type/Changes_GetChangesOfType_Test.java +++ b/src/test/java/org/assertj/db/type/Changes_GetChangesOfType_Test.java @@ -25,7 +25,8 @@ /** * Tests on the {@code getChangesOfType} method. * - * @author Régis Pouiller. + * @author Régis Pouiller + * @author Julien Roy. */ public class Changes_GetChangesOfType_Test extends AbstractTest { @@ -35,8 +36,8 @@ public class Changes_GetChangesOfType_Test extends AbstractTest { @Test @NeedReload public void test_getChangesOfTable() { - Changes changesSource = new Changes(source); - Changes changesRequest = new Changes(new Request(source, + Changes changesSource = new Changes(jdbcConnectionProvider); + Changes changesRequest = new Changes(new Request(jdbcConnectionProvider, "select interpretation.id, character, movie.title, actor.name " + " from interpretation, movie, actor " + " where interpretation.id_movie = movie.id " + " and interpretation.id_actor = actor.id ").setPksName("id")); diff --git a/src/test/java/org/assertj/db/type/Changes_GetChanges_Test.java b/src/test/java/org/assertj/db/type/Changes_GetChanges_Test.java index fd3aab9e..3e038cfc 100644 --- a/src/test/java/org/assertj/db/type/Changes_GetChanges_Test.java +++ b/src/test/java/org/assertj/db/type/Changes_GetChanges_Test.java @@ -24,7 +24,8 @@ /** * Tests on the {@code getChangesOfTable} and {@code getChangesOfType} methods together. * - * @author Régis Pouiller. + * @author Régis Pouiller + * @author Julien Roy. */ public class Changes_GetChanges_Test extends AbstractTest { @@ -34,7 +35,7 @@ public class Changes_GetChanges_Test extends AbstractTest { @Test @NeedReload public void test_getChangesOfTableAndType() { - Changes changesSource = new Changes(source); + Changes changesSource = new Changes(jdbcConnectionProvider); changesSource.setStartPointNow(); updateChangesForTests(); @@ -65,7 +66,7 @@ public void test_getChangesOfTableAndType() { @Test @NeedReload public void test_getChangesOfTypeAndTable() { - Changes changesSource = new Changes(source); + Changes changesSource = new Changes(jdbcConnectionProvider); changesSource.setStartPointNow(); updateChangesForTests(); diff --git a/src/test/java/org/assertj/db/type/Changes_Request_GetChangesList_Test.java b/src/test/java/org/assertj/db/type/Changes_Request_GetChangesList_Test.java index b7a158f2..77fb41f5 100644 --- a/src/test/java/org/assertj/db/type/Changes_Request_GetChangesList_Test.java +++ b/src/test/java/org/assertj/db/type/Changes_Request_GetChangesList_Test.java @@ -38,7 +38,7 @@ public class Changes_Request_GetChangesList_Test extends AbstractTest { */ @Test public void test_when_there_is_no_change() { - Changes changes = new Changes(new Request(dataSource, "select * from test")); + Changes changes = new Changes(new Request(dsConnectionProvider, "select * from test")); changes.setStartPointNow(); changes.setEndPointNow(); assertThat(changes.getChangesList()).hasSize(0); @@ -52,7 +52,7 @@ public void test_when_there_is_no_change() { @Test @NeedReload public void test_when_there_is_no_change_found() throws SQLException { - Changes changes = new Changes(new Request(dataSource, "select * from test")); + Changes changes = new Changes(new Request(dsConnectionProvider, "select * from test")); changes.setStartPointNow(); update("delete from test2 where VAR1 is null"); changes.setEndPointNow(); @@ -67,7 +67,7 @@ public void test_when_there_is_no_change_found() throws SQLException { @Test @NeedReload public void test_when_there_is_deletion_change() throws SQLException { - Changes changes = new Changes(new Request(dataSource, "select * from test2")); + Changes changes = new Changes(new Request(dsConnectionProvider, "select * from test2")); changes.setStartPointNow(); update("delete from test2 where VAR1 is null"); changes.setEndPointNow(); @@ -106,7 +106,7 @@ public void test_when_there_is_deletion_change() throws SQLException { @Test @NeedReload public void test_when_there_is_creation_change() throws SQLException { - Changes changes = new Changes(new Request(dataSource, "select * from test2")); + Changes changes = new Changes(new Request(dsConnectionProvider, "select * from test2")); changes.setStartPointNow(); update("insert into test2(VAR1) values(200)"); changes.setEndPointNow(); @@ -145,7 +145,7 @@ public void test_when_there_is_creation_change() throws SQLException { @Test @NeedReload public void test_when_there_is_modification_change_without_primary_key() throws SQLException { - Changes changes = new Changes(new Request(dataSource, "select * from test2")); + Changes changes = new Changes(new Request(dsConnectionProvider, "select * from test2")); changes.setStartPointNow(); update("update test2 set VAR12 = 'modification' where VAR1 = 1"); changes.setEndPointNow(); @@ -212,7 +212,7 @@ public void test_when_there_is_modification_change_without_primary_key() throws @Test @NeedReload public void test_when_there_is_modification_change_with_primary_key() throws SQLException { - Changes changes = new Changes(new Request(dataSource, "select * from interpretation").setPksName("id")); + Changes changes = new Changes(new Request(dsConnectionProvider, "select * from interpretation").setPksName("id")); changes.setStartPointNow(); update("update interpretation set character = 'Doctor Grace Augustine' where id = 3"); changes.setEndPointNow(); @@ -240,7 +240,7 @@ public void test_when_there_is_modification_change_with_primary_key() throws SQL @Test @NeedReload public void test_when_there_is_creation_change_with_primary_key() throws SQLException { - Changes changes = new Changes(new Request(dataSource, "select * from movie").setPksName("id")); + Changes changes = new Changes(new Request(dsConnectionProvider, "select * from movie").setPksName("id")); changes.setStartPointNow(); update("insert into movie values(4, 'Ghostbusters', 1984, '16319617-AE95-4087-9264-D3D21BF611B6')"); changes.setEndPointNow(); @@ -267,7 +267,7 @@ public void test_when_there_is_creation_change_with_primary_key() throws SQLExce @Test @NeedReload public void test_when_there_is_deletion_change_with_primary_key() throws SQLException { - Changes changes = new Changes(new Request(dataSource, "select * from interpretation").setPksName("id")); + Changes changes = new Changes(new Request(dsConnectionProvider, "select * from interpretation").setPksName("id")); changes.setStartPointNow(); update("delete interpretation where id = 3"); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/type/Changes_SetTables_Test.java b/src/test/java/org/assertj/db/type/Changes_SetTables_Test.java index b1f7e3bf..561fca75 100644 --- a/src/test/java/org/assertj/db/type/Changes_SetTables_Test.java +++ b/src/test/java/org/assertj/db/type/Changes_SetTables_Test.java @@ -19,6 +19,7 @@ * Tests on the setTables method. * * @author Régis Pouiller + * @author Julien Roy */ public class Changes_SetTables_Test extends AbstractTest { @@ -27,7 +28,7 @@ public class Changes_SetTables_Test extends AbstractTest { */ @Test public void test_when_setting_tables_with_empty_parameters() { - Changes changes = new Changes(source); + Changes changes = new Changes(jdbcConnectionProvider); changes.setTables(); } } diff --git a/src/test/java/org/assertj/db/type/Changes_Table_GetChangesList_Test.java b/src/test/java/org/assertj/db/type/Changes_Table_GetChangesList_Test.java index b0cff50f..c2bf257d 100644 --- a/src/test/java/org/assertj/db/type/Changes_Table_GetChangesList_Test.java +++ b/src/test/java/org/assertj/db/type/Changes_Table_GetChangesList_Test.java @@ -29,7 +29,8 @@ /** * Tests on the list of changes on tables. * - * @author Régis Pouiller. + * @author Régis Pouiller + * @author Julien Roy. */ public class Changes_Table_GetChangesList_Test extends AbstractTest { @@ -38,7 +39,7 @@ public class Changes_Table_GetChangesList_Test extends AbstractTest { */ @Test public void test_when_there_is_no_change() { - Changes changes = new Changes(source); + Changes changes = new Changes(jdbcConnectionProvider); changes.setStartPointNow(); changes.setEndPointNow(); assertThat(changes.getChangesList()).hasSize(0); @@ -52,7 +53,7 @@ public void test_when_there_is_no_change() { @Test @NeedReload public void test_when_there_is_no_change_found() throws SQLException { - Changes changes = new Changes(new Table(source, "test")); + Changes changes = new Changes(new Table(jdbcConnectionProvider, "test")); changes.setStartPointNow(); update("delete from test2 where VAR1 is null"); changes.setEndPointNow(); @@ -67,7 +68,7 @@ public void test_when_there_is_no_change_found() throws SQLException { @Test @NeedReload public void test_when_there_is_deletion_change() throws SQLException { - Changes changes = new Changes(source); + Changes changes = new Changes(jdbcConnectionProvider); changes.setStartPointNow(); update("delete from test2 where VAR1 is null"); changes.setEndPointNow(); @@ -106,7 +107,7 @@ public void test_when_there_is_deletion_change() throws SQLException { @Test @NeedReload public void test_when_there_is_creation_change() throws SQLException { - Changes changes = new Changes(source); + Changes changes = new Changes(jdbcConnectionProvider); changes.setStartPointNow(); update("insert into test2(VAR1) values(200)"); changes.setEndPointNow(); @@ -146,7 +147,7 @@ public void test_when_there_is_creation_change() throws SQLException { @Test @NeedReload public void test_when_there_is_modification_change_without_primary_key() throws SQLException { - Changes changes = new Changes(source); + Changes changes = new Changes(jdbcConnectionProvider); changes.setStartPointNow(); update("update test2 set VAR12 = 'modification' where VAR1 = 1"); changes.setEndPointNow(); @@ -218,7 +219,7 @@ public void test_when_there_is_modification_change_without_primary_key() throws @Test @NeedReload public void test_when_there_is_modification_change_with_primary_key() throws SQLException { - Changes changes = new Changes(source); + Changes changes = new Changes(jdbcConnectionProvider); changes.setStartPointNow(); update("update interpretation set character = 'Doctor Grace Augustine' where id = 3"); changes.setEndPointNow(); @@ -246,7 +247,7 @@ public void test_when_there_is_modification_change_with_primary_key() throws SQL @Test @NeedReload public void test_when_there_is_creation_change_with_primary_key() throws SQLException { - Changes changes = new Changes(new Table(source, "movie")); + Changes changes = new Changes(new Table(jdbcConnectionProvider, "movie")); changes.setStartPointNow(); update("insert into movie values(4, 'Ghostbusters', 1984, '16319617-AE95-4087-9264-D3D21BF611B6')"); changes.setEndPointNow(); @@ -273,7 +274,7 @@ public void test_when_there_is_creation_change_with_primary_key() throws SQLExce @Test @NeedReload public void test_when_there_is_deletion_change_with_primary_key() throws SQLException { - Changes changes = new Changes(new Table(source, "interpretation")); + Changes changes = new Changes(new Table(jdbcConnectionProvider, "interpretation")); changes.setStartPointNow(); update("delete interpretation where id = 3"); changes.setEndPointNow(); diff --git a/src/test/java/org/assertj/db/type/DataSourceWithLetterCase_Test.java b/src/test/java/org/assertj/db/type/DataSourceWithLetterCase_Test.java deleted file mode 100644 index 4727575d..00000000 --- a/src/test/java/org/assertj/db/type/DataSourceWithLetterCase_Test.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * Copyright 2015-2024 the original author or authors. - */ -package org.assertj.db.type; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.logging.Logger; -import javax.sql.DataSource; - -import org.assertj.db.common.AbstractTest; -import org.assertj.db.common.DefaultConnection; -import org.assertj.db.type.lettercase.LetterCase; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests on the {@code DataSourceWithLetterCase_Test}. - * - * @author Régis Pouiller - */ -public class DataSourceWithLetterCase_Test extends AbstractTest { - - private DataSource delegate; - - ; - private DataSourceWithLetterCase dataSourceWithLetterCase; - - @Before - public void init() throws SQLException { - delegate = new MyDataSource(dataSource); - dataSourceWithLetterCase = new DataSourceWithLetterCase(delegate, LetterCase.TABLE_DEFAULT, LetterCase.COLUMN_DEFAULT, LetterCase.PRIMARY_KEY_DEFAULT); - } - - /** - * This method test the {@code getConnection} method. - * - * @throws SQLException - */ - @Test - public void test_getConnection() throws SQLException { - assertThat(dataSourceWithLetterCase.getConnection()).isSameAs(delegate.getConnection()); - assertThat(dataSourceWithLetterCase.getConnection("SA", "")).isSameAs(delegate.getConnection("SA", "")); - } - - /** - * This method test the {@code getLogWriter} and {@code setLogWriter} method. - * - * @throws SQLException - */ - @Test - public void test_LogWriter() throws SQLException { - assertThat(dataSourceWithLetterCase.getLogWriter()).isSameAs(delegate.getLogWriter()); - PrintWriter printWriter = new PrintWriter(System.out); - dataSourceWithLetterCase.setLogWriter(printWriter); - assertThat(dataSourceWithLetterCase.getLogWriter()).isSameAs(delegate.getLogWriter()).isSameAs(printWriter); - } - - /** - * This method test the {@code getLoginTimeout} and {@code setLoginTimeout} method. - * - * @throws SQLException - */ - @Test - public void test_LoginTimeout() throws SQLException { - assertThat(dataSourceWithLetterCase.getLoginTimeout()).isEqualTo(delegate.getLoginTimeout()).isEqualTo(0); - dataSourceWithLetterCase.setLoginTimeout(10); - assertThat(dataSourceWithLetterCase.getLoginTimeout()).isEqualTo(delegate.getLoginTimeout()).isEqualTo(10); - } - - /** - * This method test the {@code getParentLogger} method. - * - * @throws SQLException - */ - @Test - public void test_getParentLogger() throws SQLException { - assertThat(dataSourceWithLetterCase.getParentLogger()).isSameAs(delegate.getParentLogger()); - } - - /** - * This method test the {@code isWrapperFor} method. - * - * @throws SQLException - */ - @Test - public void test_isWrapperFor() throws SQLException { - assertThat(dataSourceWithLetterCase.isWrapperFor(Boolean.class)).isEqualTo(delegate.isWrapperFor(Boolean.class)).isTrue(); - assertThat(dataSourceWithLetterCase.isWrapperFor(Integer.class)).isEqualTo(delegate.isWrapperFor(Integer.class)).isFalse(); - } - - /** - * This method test the {@code unwrap} method. - * - * @throws SQLException - */ - @Test - public void test_unwrap() throws SQLException { - assertThat(dataSourceWithLetterCase.unwrap(Boolean.class)).isEqualTo(delegate.unwrap(Boolean.class)).isTrue(); - assertThat(dataSourceWithLetterCase.unwrap(String.class)).isEqualTo(delegate.unwrap(String.class)).isEqualTo("test"); - assertThat(dataSourceWithLetterCase.unwrap(Integer.class)).isEqualTo(delegate.unwrap(Integer.class)).isNull(); - } - - private static class MyDataSource implements DataSource { - - private Connection connection; - private int loginTimeout; - private PrintWriter printWriter; - private Logger logger; - - private MyDataSource(DataSource dataSource) throws SQLException { - connection = new DefaultConnection(dataSource.getConnection()); - loginTimeout = 0; - printWriter = new PrintWriter(System.out); - logger = Logger.getGlobal(); - } - - @Override - public PrintWriter getLogWriter() throws SQLException { - return printWriter; - } - - @Override - public void setLogWriter(PrintWriter arg0) throws SQLException { - printWriter = arg0; - } - - @Override - public int getLoginTimeout() throws SQLException { - return loginTimeout; - } - - @Override - public void setLoginTimeout(int arg0) throws SQLException { - loginTimeout = arg0; - } - - @Override - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - return logger; - } - - @Override - public boolean isWrapperFor(Class arg0) throws SQLException { - if (Boolean.class.equals(arg0)) { - return true; - } - return false; - } - - @SuppressWarnings("unchecked") - @Override - public T unwrap(Class iface) throws SQLException { - if (Boolean.class.equals(iface)) { - return (T) Boolean.TRUE; - } else if (String.class.equals(iface)) { - return (T) "test"; - } - return null; - } - - @Override - public Connection getConnection() throws SQLException { - return connection; - } - - @Override - public Connection getConnection(String arg0, String arg1) throws SQLException { - return connection; - } - - } -} diff --git a/src/test/java/org/assertj/db/type/Request_Columns_Name_Test.java b/src/test/java/org/assertj/db/type/Request_Columns_Name_Test.java index e028986e..e1723aed 100644 --- a/src/test/java/org/assertj/db/type/Request_Columns_Name_Test.java +++ b/src/test/java/org/assertj/db/type/Request_Columns_Name_Test.java @@ -25,15 +25,16 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Request_Columns_Name_Test extends AbstractTest { /** - * This method test the columns name got from a {@code Source}. + * This method test the columns name got from a {@code ConnectionProvider}. */ @Test - public void test_columns_name_with_source_set() { - Request request = new Request(source, + public void test_columns_name_with_jdbc_set() { + Request request = new Request(jdbcConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -50,7 +51,7 @@ public void test_columns_name_with_source_set() { */ @Test public void test_columns_name_with_datasource_set() { - Request request = new Request(dataSource, + Request request = new Request(dsConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -63,11 +64,11 @@ public void test_columns_name_with_datasource_set() { } /** - * This method test the columns name got from a {@code Source}. + * This method test the columns name got from a {@code ConnectionProvider}. */ @Test - public void test_columns_name_with_source_and_parameters_set() { - Request request = new Request(source, + public void test_columns_name_with_jdbc_and_parameters_set() { + Request request = new Request(jdbcConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -85,7 +86,7 @@ public void test_columns_name_with_source_and_parameters_set() { */ @Test public void test_columns_name_with_datasource_and_parameters_set() { - Request request = new Request(dataSource, + Request request = new Request(dsConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -105,7 +106,7 @@ public void test_columns_name_with_datasource_and_parameters_set() { */ @Test(expected = AssertJDBException.class) public void should_throw_AssertJDBException_because_SQLException_caused_by_table_not_found() { - Table table = new Table(dataSource, "select * from interpret"); + Table table = new Table(dsConnectionProvider, "select * from interpret"); table.getColumnsNameList(); } diff --git a/src/test/java/org/assertj/db/type/Request_Columns_Test.java b/src/test/java/org/assertj/db/type/Request_Columns_Test.java index eccb77c9..31873329 100644 --- a/src/test/java/org/assertj/db/type/Request_Columns_Test.java +++ b/src/test/java/org/assertj/db/type/Request_Columns_Test.java @@ -24,15 +24,16 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Request_Columns_Test extends AbstractTest { /** - * This method test the columns got from a {@code Source}. + * This method test the columns got from a {@code ConnectionProvider}. */ @Test - public void test_columns_with_source_set() { - Request request = new Request(source, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + public void test_columns_with_jdbc_set() { + Request request = new Request(jdbcConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" + " AND interpretation.id_actor = actor.id" @@ -54,7 +55,7 @@ public void test_columns_with_source_set() { */ @Test public void test_columns_with_datasource_set() { - Request request = new Request(dataSource, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + Request request = new Request(dsConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" + " AND interpretation.id_actor = actor.id" diff --git a/src/test/java/org/assertj/db/type/Request_Exception_Test.java b/src/test/java/org/assertj/db/type/Request_Exception_Test.java index 1d84eba3..0c5cf56a 100644 --- a/src/test/java/org/assertj/db/type/Request_Exception_Test.java +++ b/src/test/java/org/assertj/db/type/Request_Exception_Test.java @@ -38,23 +38,15 @@ public class Request_Exception_Test extends AbstractTest { */ @Test(expected = AssertJDBException.class) public void should_fail_because_setting_primarykey_which_donot_exist() { - new Request(dataSource, "select var1 from test").setPksName("var2").getRowsList(); + new Request(dsConnectionProvider, "select var1 from test").setPksName("var2").getRowsList(); } /** - * This method should fail because setting the datasource to null. + * This method should fail because setting the connection provider to null. */ @Test(expected = NullPointerException.class) - public void should_fail_because_setting_datasource_to_null() { - new Request().setDataSource(null); - } - - /** - * This method should fail because setting the source to null. - */ - @Test(expected = NullPointerException.class) - public void should_fail_because_setting_source_to_null() { - new Request().setSource(null); + public void should_fail_because_setting_connection_provider_to_null() { + new Request().setConnectionProvider(null); } /** @@ -63,7 +55,8 @@ public void should_fail_because_setting_source_to_null() { @Test(expected = AssertJDBException.class) public void should_fail_because_connection_throws_exception_when_getting_an_object() { DataSource ds = new DefaultDataSource(dataSource); - Request request = new Request(ds, "select * from movi where id = ?", 1); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Request request = new Request(connectionProvider, "select * from movi where id = ?", 1); request.getColumnsNameList(); } @@ -90,7 +83,8 @@ public ResultSet executeQuery() throws SQLException { }; } }; - Request request = new Request(ds, "select * from movi where id = ?", 1); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Request request = new Request(connectionProvider, "select * from movi where id = ?", 1); request.getColumnsNameList(); } @@ -111,7 +105,8 @@ public DatabaseMetaData getMetaData() throws SQLException { }; } }; - Request request = new Request(ds, "select * from movi where id = ?", 1); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Request request = new Request(connectionProvider, "select * from movi where id = ?", 1); request.getColumnsNameList(); } @@ -132,7 +127,8 @@ public PreparedStatement prepareStatement(String sql) throws SQLException { }; } }; - Request request = new Request(ds, "select * from movi where id = ?", 1); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Request request = new Request(connectionProvider, "select * from movi where id = ?", 1); request.getColumnsNameList(); } @@ -147,7 +143,8 @@ public Connection getConnection() throws SQLException { throw new SQLException(); } }; - Request request = new Request(ds, "select * from movi where id = ?", 1); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Request request = new Request(connectionProvider, "select * from movi where id = ?", 1); request.getColumnsNameList(); } } diff --git a/src/test/java/org/assertj/db/type/Request_GetRowFromPksValues_Test.java b/src/test/java/org/assertj/db/type/Request_GetRowFromPksValues_Test.java index de1f9f22..beece44f 100644 --- a/src/test/java/org/assertj/db/type/Request_GetRowFromPksValues_Test.java +++ b/src/test/java/org/assertj/db/type/Request_GetRowFromPksValues_Test.java @@ -23,6 +23,7 @@ * Tests on getting a {@code Row} in a {@code Request} from primary keys values. * * @author Régis Pouiller + * @author Julien Roy */ public class Request_GetRowFromPksValues_Test extends AbstractTest { @@ -31,7 +32,7 @@ public class Request_GetRowFromPksValues_Test extends AbstractTest { */ @Test public void test_getting_row_from_primary_keys_values_without_finding() throws Exception { - Request request = new Request(source, + Request request = new Request(jdbcConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.id, interpretation.character " + " FROM movie, actor, interpretation WHERE movie.id = interpretation.id_movie" + " AND interpretation.id_actor = actor.id ORDER BY actor.name, movie.year"); @@ -50,7 +51,7 @@ public void test_getting_row_from_primary_keys_values_without_finding() throws E */ @Test public void test_getting_row_from_primary_keys_values_with_finding() throws Exception { - Request request = new Request(source, + Request request = new Request(jdbcConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.id, interpretation.character " + " FROM movie, actor, interpretation WHERE movie.id = interpretation.id_movie" + " AND interpretation.id_actor = actor.id ORDER BY actor.name, movie.year").setPksName("id"); diff --git a/src/test/java/org/assertj/db/type/Request_Getters_Test.java b/src/test/java/org/assertj/db/type/Request_Getters_Test.java index 2ea0da6f..240a06c0 100644 --- a/src/test/java/org/assertj/db/type/Request_Getters_Test.java +++ b/src/test/java/org/assertj/db/type/Request_Getters_Test.java @@ -24,49 +24,35 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Request_Getters_Test extends AbstractTest { /** - * This method test the getters of a {@code Table} when only the source is set. + * This method test the getters of a {@code Table} when only the jdbc connection is set. */ @Test - public void test_getters_with_only_source_set() { - Request request = new Request().setSource(source); + public void test_getters_with_only_jdbc_connection_set() { + Request request = new Request().setConnectionProvider(jdbcConnectionProvider); - assertThat(request.getSource()).isSameAs(source); - assertThat(request.getDataSource()).isNull(); + assertThat(request.getConnectionProvider()).isSameAs(jdbcConnectionProvider); assertThat(request.getRequest()).isNull(); assertThat(request.getParameters()).isNull(); } /** - * This method test the getters of a {@code Table} when only the datasource is set. + * This method test the getters of a {@code Table} when the jdbc connection and the name are set. */ @Test - public void test_getters_with_only_datasource_set() { - Request request = new Request().setDataSource(dataSource); - - assertThat(request.getSource()).isNull(); - assertThat(request.getDataSource()).isSameAs(dataSource); - assertThat(request.getRequest()).isNull(); - assertThat(request.getParameters()).isNull(); - } - - /** - * This method test the getters of a {@code Table} when the source and the name are set. - */ - @Test - public void test_getters_with_source_and_name_set() { - Request request = new Request(source, + public void test_getters_with_jdbc_and_name_set() { + Request request = new Request(jdbcConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" + " AND interpretation.id_actor = actor.id" + " ORDER BY actor.name, movie.year"); - assertThat(request.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(request.getDataSource()).isNull(); + assertThat(request.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(request.getRequest()).isEqualTo("SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -76,12 +62,12 @@ public void test_getters_with_source_and_name_set() { } /** - * This method test the getters of a {@code Table} when the source, the name and the information about the columns + * This method test the getters of a {@code Table} when the jdbc connection, the name and the information about the columns * are set. */ @Test - public void test_getters_with_source_name_and_columns_set() { - Request request = new Request(source, + public void test_getters_with_jdbc_name_and_columns_set() { + Request request = new Request(jdbcConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -89,8 +75,7 @@ public void test_getters_with_source_name_and_columns_set() { + " AND movie.year > ?" + " ORDER BY actor.name, movie.year", 2000); - assertThat(request.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(request.getDataSource()).isNull(); + assertThat(request.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(request.getRequest()).isEqualTo("SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" diff --git a/src/test/java/org/assertj/db/type/Request_Instantiation_Test.java b/src/test/java/org/assertj/db/type/Request_Instantiation_Test.java index 7c6d2341..f8128810 100644 --- a/src/test/java/org/assertj/db/type/Request_Instantiation_Test.java +++ b/src/test/java/org/assertj/db/type/Request_Instantiation_Test.java @@ -12,8 +12,6 @@ */ package org.assertj.db.type; -import javax.sql.DataSource; - import org.assertj.db.common.AbstractTest; import org.assertj.db.exception.AssertJDBException; import org.junit.Test; @@ -25,77 +23,61 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Request_Instantiation_Test extends AbstractTest { /** - * This method should throw a {@code NullPointerException}, because the {@code Source} parameter is {@code null}. - */ - @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_instantiate_with_Source_null() { - new Request((Source) null, null); - } - - /** - * This method should throw a {@code NullPointerException}, because the {@code DataSource} parameter is {@code null}. + * This method should throw a {@code NullPointerException}, because the {@code ConnectionProvider} parameter is {@code null}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_instantiate_with_DataSource_null() { - new Request((DataSource) null, null); + public void should_throw_NullPointerException_if_instantiate_with_connection_provider_null() { + new Request(null, null); } /** - * This method should throw a {@code NullPointerException}, because the {@code Source} parameter is not {@code null} + * This method should throw a {@code NullPointerException}, because the {@code ConnectionProvider} parameter is not {@code null} * and request is {@code null}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_instantiate_with_Source_not_null_and_table_name_null() { - new Request(source, null); + public void should_throw_NullPointerException_if_instantiate_with_jdbc_not_null_and_table_name_null() { + new Request(jdbcConnectionProvider, null); } /** - * This method should throw a {@code NullPointerException}, because the {@code DataSource} parameter is {@code null} + * This method should throw a {@code NullPointerException}, because the {@code ConnectionProvider} parameter is {@code null} * and request is {@code null}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_instantiate_with_DataSource_not_null_and_table_name_null() { - new Request(dataSource, null); + public void should_throw_NullPointerException_if_instantiate_with_data_source_not_null_and_table_name_null() { + new Request(dsConnectionProvider, null); } /** - * This method should throw a {@code NullPointerException}, because the {@code DataSource} and the {@code Source} + * This method should throw a {@code NullPointerException}, because the {@code DataSource} and the {@code ConnectionProvider} * fields are not set when call {@code getColumnsNameList()}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_get_list_of_columns_name_without_setting_source_or_datasource() { + public void should_throw_NullPointerException_if_get_list_of_columns_name_without_setting_connection_provider_or_datasource() { new Request().getColumnsNameList(); } /** - * This method should throw a {@code NullPointerException}, because the {@code Source} field is set but not the table + * This method should throw a {@code NullPointerException}, because the {@code ConnectionProvider} field is set but not the table * name when call {@code getColumnsNameList()}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_get_list_of_columns_name_with_setting_source_and_without_setting_table_name() { - new Request().setSource(source).getColumnsNameList(); - } - - /** - * This method should throw a {@code NullPointerException}, because the {@code DataSource} field is set but not the - * table name when call {@code getColumnsNameList()}. - */ - @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_get_list_of_columns_name_with_setting_datasource_and_without_setting_table_name() { - new Request().setDataSource(dataSource).getColumnsNameList(); + public void should_throw_NullPointerException_if_get_list_of_columns_name_with_setting_connection_provider_and_without_setting_table_name() { + new Request().setConnectionProvider(jdbcConnectionProvider).getColumnsNameList(); } /** - * This method should throw a {@code AssertJDBException}, because the {@code Source} field is set but not - * all the information of the {@code Source}. + * This method should throw a {@code AssertJDBException}, because the {@code ConnectionProvider} field is set but not + * all the information of the {@code ConnectionProvider}. */ @Test(expected = AssertJDBException.class) - public void should_throw_AssertJDBException_if_get_list_of_rows_with_setting_source_having_bad_user() { - Request request = new Request(new Source(source.getUrl(), "", ""), ""); + public void should_throw_AssertJDBException_if_get_list_of_rows_with_setting_connection_provider_having_bad_user() { + Request request = new Request(ConnectionProviderFactory.of("jdbc:h2:mem:test", "", "").create(), ""); request.getRowsList(); } } diff --git a/src/test/java/org/assertj/db/type/Request_PrimaryKeys_Name_Test.java b/src/test/java/org/assertj/db/type/Request_PrimaryKeys_Name_Test.java index dbd70b90..5ec0dcc4 100644 --- a/src/test/java/org/assertj/db/type/Request_PrimaryKeys_Name_Test.java +++ b/src/test/java/org/assertj/db/type/Request_PrimaryKeys_Name_Test.java @@ -25,15 +25,16 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Request_PrimaryKeys_Name_Test extends AbstractTest { /** - * This method test the primary keys name got from a {@code Source}. + * This method test the primary keys name got from a {@code JdbcUrlConnectionProvider}. */ @Test - public void test_pks_name_with_source_set_but_not_primary_keys() { - Request request = new Request(source, + public void test_pks_name_with_jdbc_set_but_not_primary_keys() { + Request request = new Request(jdbcConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -45,11 +46,11 @@ public void test_pks_name_with_source_set_but_not_primary_keys() { } /** - * This method test the primary keys name got from a {@code Source}. + * This method test the primary keys name got from a {@code JdbcUrlConnectionProvider}. */ @Test - public void test_pks_name_with_source_set() { - Request request = new Request(source, + public void test_pks_name_with_jdbc_set() { + Request request = new Request(jdbcConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -62,11 +63,11 @@ public void test_pks_name_with_source_set() { } /** - * This method test the primary keys name got from a {@code DataSource}. + * This method test the primary keys name got from a {@code DataSourceConnectionProvider}. */ @Test public void test_pks_name_with_datasource_set() { - Request request = new Request(dataSource, + Request request = new Request(dsConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -79,11 +80,11 @@ public void test_pks_name_with_datasource_set() { } /** - * This method test the primary keys name got from a {@code Source}. + * This method test the primary keys name got from a {@code DataSourceConnectionProvider}. */ @Test - public void test_pks_name_with_source_and_parameters_set() { - Request request = new Request(source, + public void test_pks_name_with_jdbc_and_parameters_set() { + Request request = new Request(dsConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -97,11 +98,11 @@ public void test_pks_name_with_source_and_parameters_set() { } /** - * This method test the primary keys name got from a {@code DataSource}. + * This method test the primary keys name got from a {@code DataSourceConnectionProvider}. */ @Test public void test_pks_name_with_datasource_and_parameters_set() { - Request request = new Request(dataSource, + Request request = new Request(dsConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" @@ -121,7 +122,7 @@ public void test_pks_name_with_datasource_and_parameters_set() { */ @Test(expected = AssertJDBException.class) public void should_throw_AssertJDBException_because_SQLException_caused_by_table_not_found() { - Table table = new Table(dataSource, "select * from interpret"); + Table table = new Table(dsConnectionProvider, "select * from interpret"); table.getPksNameList(); } diff --git a/src/test/java/org/assertj/db/type/Request_Rows_Test.java b/src/test/java/org/assertj/db/type/Request_Rows_Test.java index 2e6c5e5c..1769dc53 100644 --- a/src/test/java/org/assertj/db/type/Request_Rows_Test.java +++ b/src/test/java/org/assertj/db/type/Request_Rows_Test.java @@ -26,15 +26,16 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Request_Rows_Test extends AbstractTest { /** - * This method test the rows got from a {@code Source}. + * This method test the rows got from a {@code ConnectionProvider}. */ @Test - public void test_rows_with_source_set() { - Request request = new Request(source, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + public void test_rows_with_jdbc_set() { + Request request = new Request(jdbcConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" + " AND interpretation.id_actor = actor.id" @@ -74,7 +75,7 @@ public void test_rows_with_source_set() { */ @Test public void test_rows_with_datasource_set() { - Request request = new Request(dataSource, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + Request request = new Request(dsConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" + " AND interpretation.id_actor = actor.id" @@ -109,7 +110,7 @@ public void test_rows_with_datasource_set() { */ @Test(expected = NullPointerException.class) public void should_throw_NullPointerException_because_column_name_parameter_is_null_when_calling_getColumnValue() { - Request request = new Request(dataSource, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + Request request = new Request(dsConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" + " AND interpretation.id_actor = actor.id" @@ -122,7 +123,7 @@ public void should_throw_NullPointerException_because_column_name_parameter_is_n */ @Test public void test_that_we_get_null_when_calling_getColumnValue_and_the_column_name_dont_exist() { - Request request = new Request(dataSource, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + Request request = new Request(dsConnectionProvider, "SELECT actor.name, actor.firstname, movie.year, interpretation.character " + " FROM movie, actor, interpretation" + " WHERE movie.id = interpretation.id_movie" + " AND interpretation.id_actor = actor.id" diff --git a/src/test/java/org/assertj/db/type/Table_Columns_Name_Test.java b/src/test/java/org/assertj/db/type/Table_Columns_Name_Test.java index 8a0fa849..be6cb9aa 100644 --- a/src/test/java/org/assertj/db/type/Table_Columns_Name_Test.java +++ b/src/test/java/org/assertj/db/type/Table_Columns_Name_Test.java @@ -25,15 +25,16 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Table_Columns_Name_Test extends AbstractTest { /** - * This method test the columns got from a {@code Source}. + * This method test the columns got from a {@code ConnectionProvider}. */ @Test - public void test_columns_name_with_source_set() { - Table table = new Table(source, "movie"); + public void test_columns_name_with_jdbc_set() { + Table table = new Table(jdbcConnectionProvider, "movie"); assertThat(table.getColumnsNameList()).as("Columns of MOVIE table").hasSize(4) .containsExactly("ID", "TITLE", "YEAR", "MOVIE_IMDB"); @@ -44,18 +45,18 @@ public void test_columns_name_with_source_set() { */ @Test public void test_columns_name_with_datasource_set() { - Table table = new Table(dataSource, "movie"); + Table table = new Table(dsConnectionProvider, "movie"); assertThat(table.getColumnsNameList()).as("Columns of MOVIE table").hasSize(4) .containsExactly("ID", "TITLE", "YEAR", "MOVIE_IMDB"); } /** - * This method test the columns got from a {@code Source} when the columns to check are set. + * This method test the columns got from a {@code ConnectionProvider} when the columns to check are set. */ @Test - public void test_columns_name_to_check_with_source_set() { - Table table = new Table(source, "actor", new String[]{"id", "name", "birth"}, null); + public void test_columns_name_to_check_with_jdbc_set() { + Table table = new Table(jdbcConnectionProvider, "actor", new String[]{"id", "name", "birth"}, null); assertThat(table.getColumnsNameList()).as("Columns of ACTOR table").hasSize(3) .containsExactly("ID", "NAME", "BIRTH"); @@ -66,18 +67,18 @@ public void test_columns_name_to_check_with_source_set() { */ @Test public void test_columns_name_to_check_with_datasource_set() { - Table table = new Table(dataSource, "actor", new String[]{"id", "name", "birth"}, null); + Table table = new Table(dsConnectionProvider, "actor", new String[]{"id", "name", "birth"}, null); assertThat(table.getColumnsNameList()).as("Columns of ACTOR table").hasSize(3) .containsExactly("ID", "NAME", "BIRTH"); } /** - * This method test the columns got from a {@code Source} when the columns to exclude are set. + * This method test the columns got from a {@code ConnectionProvider} when the columns to exclude are set. */ @Test - public void test_columns_name_to_exclude_with_source_set() { - Table table = new Table(source, "interpretation", null, new String[]{"id"}); + public void test_columns_name_to_exclude_with_jdbc_set() { + Table table = new Table(jdbcConnectionProvider, "interpretation", null, new String[]{"id"}); assertThat(table.getColumnsNameList()).as("Columns of INTERPRETATION table").hasSize(3) .containsExactly("ID_MOVIE", "ID_ACTOR", "CHARACTER"); @@ -88,7 +89,7 @@ public void test_columns_name_to_exclude_with_source_set() { */ @Test public void test_columns_name_to_exclude_with_datasource_set() { - Table table = new Table(dataSource, "interpretation", null, new String[]{"id"}); + Table table = new Table(dsConnectionProvider, "interpretation", null, new String[]{"id"}); assertThat(table.getColumnsNameList()).as("Columns of INTERPRETATION table").hasSize(3) .containsExactly("ID_MOVIE", "ID_ACTOR", "CHARACTER"); @@ -100,7 +101,7 @@ public void test_columns_name_to_exclude_with_datasource_set() { */ @Test(expected = AssertJDBException.class) public void should_throw_AssertJDBException_because_SQLException_caused_by_table_not_found() { - Table table = new Table(dataSource, "interpret"); + Table table = new Table(dsConnectionProvider, "interpret"); table.getColumnsNameList(); } } diff --git a/src/test/java/org/assertj/db/type/Table_Columns_Test.java b/src/test/java/org/assertj/db/type/Table_Columns_Test.java index bf2aea18..95e71389 100644 --- a/src/test/java/org/assertj/db/type/Table_Columns_Test.java +++ b/src/test/java/org/assertj/db/type/Table_Columns_Test.java @@ -25,15 +25,16 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Table_Columns_Test extends AbstractTest { /** - * This method test the columns got from a {@code Source}. + * This method test the columns got from a {@code ConnectionProvider}. */ @Test - public void test_columns_with_source_set() { - Table table = new Table(source, "movie"); + public void test_columns_with_jdbc_set() { + Table table = new Table(jdbcConnectionProvider, "movie"); Column columnFromIndex = table.getColumn(1); @@ -49,7 +50,7 @@ public void test_columns_with_source_set() { */ @Test public void test_columns_with_datasource_set() { - Table table = new Table(dataSource, "movie"); + Table table = new Table(dsConnectionProvider, "movie"); Column columnFromIndex = table.getColumn(1); @@ -65,7 +66,7 @@ public void test_columns_with_datasource_set() { */ @Test public void test_columns_to_check() { - Table table = new Table(source, "movie"); + Table table = new Table(jdbcConnectionProvider, "movie"); assertThat(table.getColumnsToCheck()).isNull(); @@ -80,7 +81,7 @@ public void test_columns_to_check() { */ @Test public void test_columns_to_exclude() { - Table table = new Table(source, "movie"); + Table table = new Table(jdbcConnectionProvider, "movie"); assertThat(table.getColumnsToExclude()).isNull(); @@ -95,7 +96,7 @@ public void test_columns_to_exclude() { */ @Test public void test_columns_to_order() { - Table table = new Table(source, "movie"); + Table table = new Table(jdbcConnectionProvider, "movie"); assertThat(table.getColumnsToOrder()).isNull(); diff --git a/src/test/java/org/assertj/db/type/Table_Exception_Test.java b/src/test/java/org/assertj/db/type/Table_Exception_Test.java index 1aa2364b..31f8fb15 100644 --- a/src/test/java/org/assertj/db/type/Table_Exception_Test.java +++ b/src/test/java/org/assertj/db/type/Table_Exception_Test.java @@ -34,23 +34,16 @@ * Test on loading of the data for a table and exception during the different steps. * * @author Régis Pouiller + * @author Julien Roy */ public class Table_Exception_Test extends AbstractTest { /** - * This method should fail because setting the datasource to null. + * This method should fail because setting the connection provider to null. */ @Test(expected = NullPointerException.class) - public void should_fail_because_setting_datasource_to_null() { - new Table().setDataSource(null); - } - - /** - * This method should fail because setting the source to null. - */ - @Test(expected = NullPointerException.class) - public void should_fail_because_setting_source_to_null() { - new Table().setSource(null); + public void should_fail_because_setting_connection_provider_to_null() { + new Table().setConnectionProvider(null); } /** @@ -59,7 +52,8 @@ public void should_fail_because_setting_source_to_null() { @Test(expected = AssertJDBException.class) public void should_fail_because_connection_throws_exception_when_getting_an_object() { DataSource ds = new DefaultDataSource(dataSource); - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Table table = new Table(connectionProvider, "movi"); table.getColumnsNameList(); } @@ -72,7 +66,7 @@ public void should_fail_because_trying_to_set_columns_to_check_first() { new Table().setColumnsToCheck(new String[]{"test"}); fail("An exception must be raised"); } catch (AssertJDBException e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("The table name and the source or datasource must be set first")); + Assertions.assertThat(e.getMessage()).isEqualTo("The table name and the connectionProvider must be set first"); } } @@ -85,7 +79,7 @@ public void should_fail_because_trying_to_set_columns_to_exclude_first() { new Table().setColumnsToExclude(new String[]{"test"}); fail("An exception must be raised"); } catch (AssertJDBException e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("The table name and the source or datasource must be set first")); + Assertions.assertThat(e.getMessage()).isEqualTo("The table name and the connectionProvider must be set first"); } } @@ -98,7 +92,7 @@ public void should_fail_because_trying_to_set_columns_order_first() { new Table().setColumnsToOrder(new Order[]{Order.asc("test")}); fail("An exception must be raised"); } catch (AssertJDBException e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("The table name and the source or datasource must be set first")); + Assertions.assertThat(e.getMessage()).isEqualTo("The table name and the connectionProvider must be set first"); } } @@ -108,10 +102,10 @@ public void should_fail_because_trying_to_set_columns_order_first() { @Test public void should_fail_because_trying_to_set_columns_order_with_order_null() { try { - new Table(source, "test").setColumnsToOrder(new Order[]{null}); + new Table(jdbcConnectionProvider, "test").setColumnsToOrder(new Order[]{null}); fail("An exception must be raised"); } catch (NullPointerException e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("The order can not be null")); + Assertions.assertThat(e.getMessage()).isEqualTo("The order can not be null"); } } @@ -121,10 +115,10 @@ public void should_fail_because_trying_to_set_columns_order_with_order_null() { @Test public void should_fail_because_trying_to_set_columns_order_with_column_null() { try { - new Table(source, "test").setColumnsToOrder(new Order[]{Order.asc(null)}); + new Table(jdbcConnectionProvider, "test").setColumnsToOrder(new Order[]{Order.asc(null)}); fail("An exception must be raised"); } catch (NullPointerException e) { - Assertions.assertThat(e.getMessage()).isEqualTo(String.format("The name of the column for order can not be null")); + Assertions.assertThat(e.getMessage()).isEqualTo("The name of the column for order can not be null"); } } @@ -151,7 +145,8 @@ public ResultSet executeQuery(String sql) throws SQLException { }; } }; - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Table table = new Table(connectionProvider, "movi"); table.getColumnsNameList(); } @@ -172,7 +167,8 @@ public DatabaseMetaData getMetaData() throws SQLException { }; } }; - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Table table = new Table(connectionProvider, "movi"); table.getColumnsNameList(); } @@ -193,7 +189,8 @@ public Statement createStatement() throws SQLException { }; } }; - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Table table = new Table(connectionProvider, "movi"); table.getColumnsNameList(); } @@ -208,7 +205,8 @@ public Connection getConnection() throws SQLException { throw new SQLException(); } }; - Table table = new Table(ds, "movi"); + ConnectionProvider connectionProvider = ConnectionProviderFactory.of(ds).create(); + Table table = new Table(connectionProvider, "movi"); table.getColumnsNameList(); } } diff --git a/src/test/java/org/assertj/db/type/Table_GetRowFromPksValues_Test.java b/src/test/java/org/assertj/db/type/Table_GetRowFromPksValues_Test.java index 07c2ca09..891b862c 100644 --- a/src/test/java/org/assertj/db/type/Table_GetRowFromPksValues_Test.java +++ b/src/test/java/org/assertj/db/type/Table_GetRowFromPksValues_Test.java @@ -24,6 +24,7 @@ * Tests on getting a {@code Row} in a {@code Table} from primary keys values. * * @author Régis Pouiller + * @author Julien Roy */ public class Table_GetRowFromPksValues_Test extends AbstractTest { @@ -32,7 +33,7 @@ public class Table_GetRowFromPksValues_Test extends AbstractTest { */ @Test public void test_getting_row_from_primary_keys_values_without_finding() throws Exception { - Table table = new Table(source, "movie"); + Table table = new Table(jdbcConnectionProvider, "movie"); assertThat(table.getRowFromPksValues()).isNull(); assertThat(table.getRowFromPksValues(getValue(null, 1L), getValue(null, 3))).isNull(); @@ -43,7 +44,7 @@ public void test_getting_row_from_primary_keys_values_without_finding() throws E */ @Test public void test_getting_row_from_primary_keys_values_with_finding() throws Exception { - Table table = new Table(source, "movie"); + Table table = new Table(jdbcConnectionProvider, "movie"); assertThat(table.getRowFromPksValues(getValue(null, 3)).getValuesList().get(0).getValue()).isEqualTo(new BigDecimal(3)); assertThat(table.getRowFromPksValues(getValue(null, 3)).getValuesList().get(1).getValue()).isEqualTo("Avatar"); diff --git a/src/test/java/org/assertj/db/type/Table_Getters_Test.java b/src/test/java/org/assertj/db/type/Table_Getters_Test.java index 770b6c76..575b6ab6 100644 --- a/src/test/java/org/assertj/db/type/Table_Getters_Test.java +++ b/src/test/java/org/assertj/db/type/Table_Getters_Test.java @@ -26,18 +26,18 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Table_Getters_Test extends AbstractTest { /** - * This method test the getters of a {@code Table} when only the source is set. + * This method test the getters of a {@code Table} when only the connection provider is set. */ @Test - public void test_getters_with_only_source_set() { - Table table = new Table().setSource(source); + public void test_getters_with_only_connection_provider_set() { + Table table = new Table().setConnectionProvider(jdbcConnectionProvider); - assertThat(table.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(table.getDataSource()).isNull(); + assertThat(table.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(table.getName()).isNull(); assertThat(table.getColumnsToCheck()).isNull(); assertThat(table.getColumnsToExclude()).isNull(); @@ -46,62 +46,13 @@ public void test_getters_with_only_source_set() { } /** - * This method test the getters of a {@code Table} when only the datasource is set. + * This method test the getters of a {@code Table} when the connection provider and the name are set. */ @Test - public void test_getters_with_only_datasource_set() { - Table table = new Table().setDataSource(dataSource); + public void test_getters_with_connection_provider_and_name_set() { + Table table = new Table(jdbcConnectionProvider, "movie"); - assertThat(table.getSource()).isNull(); - assertThat(table.getDataSource()).as("DataSource of MOVIE table").isSameAs(dataSource); - assertThat(table.getName()).isNull(); - assertThat(table.getColumnsToCheck()).isNull(); - assertThat(table.getColumnsToExclude()).isNull(); - assertThat(table.getStartDelimiter()).isNull(); - assertThat(table.getEndDelimiter()).isNull(); - } - - /** - * This method test the getters of a {@code Table} when only the source is set after the datasource was set. - */ - @Test - public void test_getters_with_only_datasource_set_and_after_only_source_set() { - Table table = new Table().setDataSource(dataSource).setSource(source); - - assertThat(table.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(table.getDataSource()).isNull(); - assertThat(table.getName()).isNull(); - assertThat(table.getColumnsToCheck()).isNull(); - assertThat(table.getColumnsToExclude()).isNull(); - assertThat(table.getStartDelimiter()).isNull(); - assertThat(table.getEndDelimiter()).isNull(); - } - - /** - * This method test the getters of a {@code Table} when only the datasource is set after the source was set. - */ - @Test - public void test_getters_with_only_source_set_and_after_only_datasource_set() { - Table table = new Table().setSource(source).setDataSource(dataSource); - - assertThat(table.getSource()).isNull(); - assertThat(table.getDataSource()).as("DataSource of MOVIE table").isSameAs(dataSource); - assertThat(table.getName()).isNull(); - assertThat(table.getColumnsToCheck()).isNull(); - assertThat(table.getColumnsToExclude()).isNull(); - assertThat(table.getStartDelimiter()).isNull(); - assertThat(table.getEndDelimiter()).isNull(); - } - - /** - * This method test the getters of a {@code Table} when the source and the name are set. - */ - @Test - public void test_getters_with_source_and_name_set() { - Table table = new Table(source, "movie"); - - assertThat(table.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(table.getDataSource()).isNull(); + assertThat(table.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(table.getName()).isEqualTo("MOVIE"); assertThat(table.getColumnsToCheck()).isNull(); assertThat(table.getColumnsToExclude()).isNull(); @@ -111,15 +62,14 @@ public void test_getters_with_source_and_name_set() { } /** - * This method test the getters of a {@code Table} when the source, the name and the information about the columns + * This method test the getters of a {@code Table} when the connection provider, the name and the information about the columns * are set. */ @Test - public void test_getters_with_source_name_and_columns_set() { - Table table = new Table(source, "movie", new String[]{"title", "year"}, new String[]{"id"}); + public void test_getters_with_connection_provider_name_and_columns_set() { + Table table = new Table(jdbcConnectionProvider, "movie", new String[]{"title", "year"}, new String[]{"id"}); - assertThat(table.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(table.getDataSource()).isNull(); + assertThat(table.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(table.getName()).isEqualTo("MOVIE"); assertThat(table.getColumnsToCheck()).containsExactly("TITLE", "YEAR"); assertThat(table.getColumnsToExclude()).containsExactly("ID"); @@ -129,17 +79,16 @@ public void test_getters_with_source_name_and_columns_set() { } /** - * This method test the getters of a {@code Table} when the source, the name and the information about the columns + * This method test the getters of a {@code Table} when the connection provider, the name and the information about the columns * and the orders are set. */ @Test - public void test_getters_with_source_name_columns_and_order_set() { - Table table = new Table(source, "movie", + public void test_getters_with_connection_provider_name_columns_and_order_set() { + Table table = new Table(jdbcConnectionProvider, "movie", new Table.Order[]{asc("title"), desc("year")}, new String[]{"title", "year"}, new String[]{"id"}); - assertThat(table.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(table.getDataSource()).isNull(); + assertThat(table.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(table.getName()).isEqualTo("MOVIE"); assertThat(table.getColumnsToCheck()).containsExactly("TITLE", "YEAR"); assertThat(table.getColumnsToExclude()).containsExactly("ID"); @@ -150,16 +99,15 @@ public void test_getters_with_source_name_columns_and_order_set() { } /** - * This method test the getters of a {@code Table} when the source, the name and the information about the orders + * This method test the getters of a {@code Table} when the connection provider, the name and the information about the orders * are set. */ @Test - public void test_getters_with_source_name_and_order_set() { - Table table = new Table(source, "movie", + public void test_getters_with_connection_provider_name_and_order_set() { + Table table = new Table(jdbcConnectionProvider, "movie", new Table.Order[]{asc("title"), desc("year")}); - assertThat(table.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(table.getDataSource()).isNull(); + assertThat(table.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(table.getName()).isEqualTo("MOVIE"); assertThat(table.getColumnsToCheck()).isNull(); assertThat(table.getColumnsToExclude()).isNull(); @@ -170,14 +118,13 @@ public void test_getters_with_source_name_and_order_set() { } /** - * This method test the getters of a {@code Table} when the source, delimiteres and the name are set. + * This method test the getters of a {@code Table} when the connection provider, delimiters and the name are set. */ @Test - public void test_getters_with_source_delimiters_and_name_set() { - Table table = new Table(source, "movie", '1', '2'); + public void test_getters_with_connection_provider_delimiters_and_name_set() { + Table table = new Table(jdbcConnectionProvider, "movie", '1', '2'); - assertThat(table.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(table.getDataSource()).isNull(); + assertThat(table.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(table.getName()).isEqualTo("MOVIE"); assertThat(table.getColumnsToCheck()).isNull(); assertThat(table.getColumnsToExclude()).isNull(); @@ -187,16 +134,15 @@ public void test_getters_with_source_delimiters_and_name_set() { } /** - * This method test the getters of a {@code Table} when the source, the name, the delimiters + * This method test the getters of a {@code Table} when the connection provider, the name, the delimiters * and the information about the columns are set. */ @Test - public void test_getters_with_source_name_delimiters_and_columns_set() { - Table table = new Table(source, "movie", '1', '2', + public void test_getters_with_connection_provider_name_delimiters_and_columns_set() { + Table table = new Table(jdbcConnectionProvider, "movie", '1', '2', new String[]{"title", "year"}, new String[]{"id"}); - assertThat(table.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(table.getDataSource()).isNull(); + assertThat(table.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(table.getName()).isEqualTo("MOVIE"); assertThat(table.getColumnsToCheck()).containsExactly("TITLE", "YEAR"); assertThat(table.getColumnsToExclude()).containsExactly("ID"); @@ -206,17 +152,16 @@ public void test_getters_with_source_name_delimiters_and_columns_set() { } /** - * This method test the getters of a {@code Table} when the source, the name, the delimiters + * This method test the getters of a {@code Table} when the connection provider, the name, the delimiters * and the information about the columns and the orders are set. */ @Test - public void test_getters_with_source_name_columns_delimiters_and_order_set() { - Table table = new Table(source, "movie", '1', '2', + public void test_getters_with_connection_provider_name_columns_delimiters_and_order_set() { + Table table = new Table(jdbcConnectionProvider, "movie", '1', '2', new Table.Order[]{asc("title"), desc("year")}, new String[]{"title", "year"}, new String[]{"id"}); - assertThat(table.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(table.getDataSource()).isNull(); + assertThat(table.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(table.getName()).isEqualTo("MOVIE"); assertThat(table.getColumnsToCheck()).containsExactly("TITLE", "YEAR"); assertThat(table.getColumnsToExclude()).containsExactly("ID"); @@ -227,16 +172,15 @@ public void test_getters_with_source_name_columns_delimiters_and_order_set() { } /** - * This method test the getters of a {@code Table} when the source, the name, the delimiters + * This method test the getters of a {@code Table} when the connection provider, the name, the delimiters * and the information about the orders are set. */ @Test - public void test_getters_with_source_name_delimiters_and_order_set() { - Table table = new Table(source, "movie", '1', '2', + public void test_getters_with_connection_provider_name_delimiters_and_order_set() { + Table table = new Table(jdbcConnectionProvider, "movie", '1', '2', new Table.Order[]{asc("title"), desc("year")}); - assertThat(table.getSource()).as("Source of MOVIE table").isSameAs(source); - assertThat(table.getDataSource()).isNull(); + assertThat(table.getConnectionProvider()).as("Source of MOVIE table").isSameAs(jdbcConnectionProvider); assertThat(table.getName()).isEqualTo("MOVIE"); assertThat(table.getColumnsToCheck()).isNull(); assertThat(table.getColumnsToExclude()).isNull(); diff --git a/src/test/java/org/assertj/db/type/Table_Instantiation_Test.java b/src/test/java/org/assertj/db/type/Table_Instantiation_Test.java index eb61d305..b356b3d8 100644 --- a/src/test/java/org/assertj/db/type/Table_Instantiation_Test.java +++ b/src/test/java/org/assertj/db/type/Table_Instantiation_Test.java @@ -12,8 +12,6 @@ */ package org.assertj.db.type; -import javax.sql.DataSource; - import org.assertj.db.common.AbstractTest; import org.assertj.db.exception.AssertJDBException; import org.junit.Test; @@ -25,34 +23,26 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Table_Instantiation_Test extends AbstractTest { /** - * This method should throw a {@code NullPointerException}, because the {@code Source} parameter is - * {@code null}. - */ - @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_instantiate_with_Source_null() { - new Table((Source) null, null); - } - - /** - * This method should throw a {@code NullPointerException}, because the {@code DataSource} parameter is + * This method should throw a {@code NullPointerException}, because the {@code ConnectionProvider} parameter is * {@code null}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_instantiate_with_DataSource_null() { - new Table((DataSource) null, null); + public void should_throw_NullPointerException_if_instantiate_with_connection_provider_null() { + new Table(null, null); } /** - * This method should throw a {@code NullPointerException}, because the {@code Source} parameter is not + * This method should throw a {@code NullPointerException}, because the {@code ConnectionProvider} parameter is not * {@code null} and table name is {@code null}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_instantiate_with_Source_not_null_and_table_name_null() { - new Table(source, null); + public void should_throw_NullPointerException_if_instantiate_with_jdbc_connection_provider_not_null_and_table_name_null() { + new Table(jdbcConnectionProvider, null); } /** @@ -60,26 +50,26 @@ public void should_throw_NullPointerException_if_instantiate_with_Source_not_nul * {@code null} and table name is {@code null}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_instantiate_with_DataSource_not_null_and_table_name_null() { - new Table(dataSource, null); + public void should_throw_NullPointerException_if_instantiate_with_ds_connection_provider_not_null_and_table_name_null() { + new Table(dsConnectionProvider, null); } /** * This method should throw a {@code NullPointerException}, because the {@code DataSource} and the - * {@code Source} fields are not set when call {@code getColumnsNameList()}. + * {@code ConnectionProvider} fields are not set when call {@code getColumnsNameList()}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_get_list_of_columns_name_without_setting_source_or_datasource() { + public void should_throw_NullPointerException_if_get_list_of_columns_name_without_setting_connection_provider_or_datasource() { new Table().getColumnsNameList(); } /** - * This method should throw a {@code NullPointerException}, because the {@code Source} field is set but not + * This method should throw a {@code NullPointerException}, because the {@code ConnectionProvider} field is set but not * the table name when call {@code getColumnsNameList()}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_get_list_of_columns_name_with_setting_source_and_without_setting_table_name() { - new Table().setSource(source).getColumnsNameList(); + public void should_throw_NullPointerException_if_get_list_of_columns_name_with_setting_connection_provider_and_without_setting_table_name() { + new Table().setConnectionProvider(jdbcConnectionProvider).getColumnsNameList(); } /** @@ -88,16 +78,16 @@ public void should_throw_NullPointerException_if_get_list_of_columns_name_with_s */ @Test(expected = NullPointerException.class) public void should_throw_NullPointerException_if_get_list_of_columns_name_with_setting_datasource_and_without_setting_table_name() { - new Table().setDataSource(dataSource).getColumnsNameList(); + new Table().setConnectionProvider(dsConnectionProvider).getColumnsNameList(); } /** - * This method should throw a {@code NullPointerException}, because the {@code Source} field is set but not + * This method should throw a {@code NullPointerException}, because the {@code ConnectionProvider} field is set but not * the table name when call {@code getRequest()}. */ @Test(expected = NullPointerException.class) - public void should_throw_NullPointerException_if_get_request_with_setting_source_and_without_setting_table_name() { - new Table().setSource(source).getRequest(); + public void should_throw_NullPointerException_if_get_request_with_setting_jdbc_connection_and_without_setting_table_name() { + new Table().setConnectionProvider(jdbcConnectionProvider).getRequest(); } /** @@ -106,16 +96,16 @@ public void should_throw_NullPointerException_if_get_request_with_setting_source */ @Test(expected = NullPointerException.class) public void should_throw_NullPointerException_if_get_request_with_setting_datasource_and_without_setting_table_name() { - new Table().setDataSource(dataSource).getRequest(); + new Table().setConnectionProvider(dsConnectionProvider).getRequest(); } /** - * This method should throw a {@code AssertJDBException}, because the {@code Source} field is set but not - * all the information of the {@code Source}. + * This method should throw a {@code AssertJDBException}, because the {@code ConnectionProvider} field is set but not + * all the information of the {@code ConnectionProvider}. */ @Test(expected = AssertJDBException.class) - public void should_throw_AssertJDBException_if_get_list_of_rows_with_setting_source_having_bad_user() { - Table table = new Table(new Source(source.getUrl(), "", ""), ""); + public void should_throw_AssertJDBException_if_get_list_of_rows_with_setting_connection_provider_having_bad_user() { + Table table = new Table(ConnectionProviderFactory.of("jdbc:h2:mem:test", "", "").create(), ""); table.getRowsList(); } @@ -124,7 +114,7 @@ public void should_throw_AssertJDBException_if_get_list_of_rows_with_setting_sou */ @Test(expected = NullPointerException.class) public void should_throw_NullPointerException_if_one_of_the_columns_to_check_is_null() { - new Table(source, "movie", new String[]{"id", null, "birth"}, null); + new Table(jdbcConnectionProvider, "movie", new String[]{"id", null, "birth"}, null); } /** @@ -132,6 +122,6 @@ public void should_throw_NullPointerException_if_one_of_the_columns_to_check_is_ */ @Test(expected = NullPointerException.class) public void should_throw_NullPointerException_if_one_of_the_columns_to_exclude_is_null() { - new Table(source, "movie", new String[]{"id", "name", "birth"}, new String[]{null}); + new Table(jdbcConnectionProvider, "movie", new String[]{"id", "name", "birth"}, new String[]{null}); } } diff --git a/src/test/java/org/assertj/db/type/Table_PrimaryKeys_Name_Test.java b/src/test/java/org/assertj/db/type/Table_PrimaryKeys_Name_Test.java index 548cf787..d093d9d9 100644 --- a/src/test/java/org/assertj/db/type/Table_PrimaryKeys_Name_Test.java +++ b/src/test/java/org/assertj/db/type/Table_PrimaryKeys_Name_Test.java @@ -25,15 +25,16 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Table_PrimaryKeys_Name_Test extends AbstractTest { /** - * This method test the primary keys got from a {@code Source}. + * This method test the primary keys got from a {@code ConnectionProvider}. */ @Test - public void test_pks_name_with_source_set() { - Table table = new Table(source, "movie"); + public void test_pks_name_with_jdbc_set() { + Table table = new Table(jdbcConnectionProvider, "movie"); assertThat(table.getPksNameList()).as("Primary Keys of MOVIE table").hasSize(1) .containsExactly("ID"); @@ -44,18 +45,18 @@ public void test_pks_name_with_source_set() { */ @Test public void test_pks_name_with_datasource_set() { - Table table = new Table(dataSource, "movie"); + Table table = new Table(dsConnectionProvider, "movie"); assertThat(table.getPksNameList()).as("Primary Keys of MOVIE table").hasSize(1) .containsExactly("ID"); } /** - * This method test the primary keys got from a {@code Source} when the columns to check are set. + * This method test the primary keys got from a {@code ConnectionProvider} when the columns to check are set. */ @Test - public void test_pks_name_to_check_with_source_set() { - Table table = new Table(source, "actor", new String[]{"id", "name", "birth"}, null); + public void test_pks_name_to_check_with_jdbc_set() { + Table table = new Table(jdbcConnectionProvider, "actor", new String[]{"id", "name", "birth"}, null); assertThat(table.getPksNameList()).as("Primary Keys of ACTOR table").hasSize(1) .containsExactly("ID"); @@ -66,18 +67,18 @@ public void test_pks_name_to_check_with_source_set() { */ @Test public void test_pks_name_to_check_with_datasource_set() { - Table table = new Table(dataSource, "actor", new String[]{"id", "name", "birth"}, null); + Table table = new Table(dsConnectionProvider, "actor", new String[]{"id", "name", "birth"}, null); assertThat(table.getPksNameList()).as("Primary Keys of ACTOR table").hasSize(1) .containsExactly("ID"); } /** - * This method test the primary keys got from a {@code Source} when the columns to exclude are set. + * This method test the primary keys got from a {@code ConnectionProvider} when the columns to exclude are set. */ @Test - public void test_pks_name_to_exclude_with_source_set() { - Table table = new Table(source, "interpretation", null, new String[]{"ID"}); + public void test_pks_name_to_exclude_with_jdbc_set() { + Table table = new Table(jdbcConnectionProvider, "interpretation", null, new String[]{"ID"}); assertThat(table.getPksNameList()).as("Primary Keys of INTERPRETATION table").hasSize(0); } @@ -87,7 +88,7 @@ public void test_pks_name_to_exclude_with_source_set() { */ @Test public void test_pks_name_to_exclude_with_datasource_set() { - Table table = new Table(dataSource, "interpretation", null, new String[]{"id"}); + Table table = new Table(dsConnectionProvider, "interpretation", null, new String[]{"id"}); assertThat(table.getPksNameList()).as("Primary Keys of INTERPRETATION table").hasSize(0); } @@ -98,7 +99,7 @@ public void test_pks_name_to_exclude_with_datasource_set() { */ @Test(expected = AssertJDBException.class) public void should_throw_AssertJDBException_because_SQLException_caused_by_table_not_found() { - Table table = new Table(dataSource, "interpret"); + Table table = new Table(dsConnectionProvider, "interpret"); table.getPksNameList(); } diff --git a/src/test/java/org/assertj/db/type/Table_Rows_Test.java b/src/test/java/org/assertj/db/type/Table_Rows_Test.java index b38f2193..1b8f8f0a 100644 --- a/src/test/java/org/assertj/db/type/Table_Rows_Test.java +++ b/src/test/java/org/assertj/db/type/Table_Rows_Test.java @@ -28,15 +28,16 @@ *

    * * @author Régis Pouiller + * @author Julien Roy */ public class Table_Rows_Test extends AbstractTest { /** - * This method test the rows got from a {@code Source}. + * This method test the rows got from a {@code ConnectionProvider}. */ @Test - public void test_rows_with_source_set() { - Table table = new Table(source, "movie"); + public void test_rows_with_jdbc_set() { + Table table = new Table(jdbcConnectionProvider, "movie"); assertThat(table.getRowsList()).as("Values of MOVIE table").hasSize(3); @@ -73,7 +74,7 @@ public void test_rows_with_source_set() { */ @Test public void test_rows_with_datasource_set() { - Table table = new Table(dataSource, "movie"); + Table table = new Table(dsConnectionProvider, "movie"); assertThat(table.getRowsList()).as("Values of MOVIE table").hasSize(3); @@ -107,7 +108,7 @@ public void test_rows_with_datasource_set() { */ @Test public void test_rows_with_datasource_and_order_set() { - Table table = new Table(dataSource, "movie", new Table.Order[]{asc("title")}); + Table table = new Table(dsConnectionProvider, "movie", new Table.Order[]{asc("title")}); assertThat(table.getRowsList()).as("Values of MOVIE table").hasSize(3); @@ -141,7 +142,7 @@ public void test_rows_with_datasource_and_order_set() { */ @Test(expected = NullPointerException.class) public void should_throw_NullPointerException_because_column_name_parameter_is_null_when_calling_getColumnValue() { - Table table = new Table(source, "movie"); + Table table = new Table(jdbcConnectionProvider, "movie"); table.getRow(0).getColumnValue(null); } @@ -150,7 +151,7 @@ public void should_throw_NullPointerException_because_column_name_parameter_is_n */ @Test public void test_that_we_get_null_when_calling_getColumnValue_and_the_column_name_dont_exist() { - Table table = new Table(source, "movie"); + Table table = new Table(jdbcConnectionProvider, "movie"); assertThat(table.getRow(0).getColumnValue("not_exist")).isNull(); } diff --git a/src/test/java/org/assertj/db/util/Descriptions_GetDescription_Test.java b/src/test/java/org/assertj/db/util/Descriptions_GetDescription_Test.java index 33afcb1a..3663334a 100644 --- a/src/test/java/org/assertj/db/util/Descriptions_GetDescription_Test.java +++ b/src/test/java/org/assertj/db/util/Descriptions_GetDescription_Test.java @@ -26,6 +26,7 @@ * Tests on {@code getDescription} method from utility class {@code Descriptions}. * * @author Régis Pouiller + * @author Julien Roy */ public class Descriptions_GetDescription_Test extends AbstractTest { @@ -34,8 +35,8 @@ public class Descriptions_GetDescription_Test extends AbstractTest { */ @Test public void test_get_description_for_table() { - Table fromSource = new Table(source, "actor"); - Table fromDataSource = new Table(dataSource, "actor"); + Table fromSource = new Table(jdbcConnectionProvider, "actor"); + Table fromDataSource = new Table(dsConnectionProvider, "actor"); String descriptionFromSource = Descriptions.getDescription(fromSource); String descriptionFromDataSource = Descriptions.getDescription(fromDataSource); @@ -49,10 +50,10 @@ public void test_get_description_for_table() { */ @Test public void test_get_description_for_request() { - Request fromSource = new Request(source, "select * from actor"); - Request fromDataSource = new Request(dataSource, "select * from actor"); - Request fromSourceLong = new Request(source, "select id, name, firstname, birth, actor_imdb from actor"); - Request fromDataSourceLong = new Request(dataSource, "select id, name, firstname, birth, actor_imdb from actor"); + Request fromSource = new Request(jdbcConnectionProvider, "select * from actor"); + Request fromDataSource = new Request(dsConnectionProvider, "select * from actor"); + Request fromSourceLong = new Request(jdbcConnectionProvider, "select id, name, firstname, birth, actor_imdb from actor"); + Request fromDataSourceLong = new Request(dsConnectionProvider, "select id, name, firstname, birth, actor_imdb from actor"); String descriptionFromSource = Descriptions.getDescription(fromSource); String descriptionFromDataSource = Descriptions.getDescription(fromDataSource); @@ -71,8 +72,8 @@ public void test_get_description_for_request() { @Test @NeedReload public void test_get_description_for_changes() { - org.assertj.db.type.Changes fromSource = new org.assertj.db.type.Changes(source).setStartPointNow(); - org.assertj.db.type.Changes fromDataSource = new org.assertj.db.type.Changes(dataSource).setStartPointNow(); + org.assertj.db.type.Changes fromSource = new org.assertj.db.type.Changes(jdbcConnectionProvider).setStartPointNow(); + org.assertj.db.type.Changes fromDataSource = new org.assertj.db.type.Changes(dsConnectionProvider).setStartPointNow(); updateChangesForTests(); fromSource.setEndPointNow(); fromDataSource.setEndPointNow(); @@ -80,8 +81,8 @@ public void test_get_description_for_changes() { String descriptionFromSource = Descriptions.getDescription(fromSource); String descriptionFromDataSource = Descriptions.getDescription(fromDataSource); - assertThat(descriptionFromSource).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test' source"); - assertThat(descriptionFromDataSource).isEqualTo("Changes on tables of a data source"); + assertThat(descriptionFromSource).isEqualTo("Changes on tables of 'sa/jdbc:h2:mem:test'"); + assertThat(descriptionFromDataSource).isEqualTo("Changes on tables of 'data source'"); } /** @@ -90,9 +91,9 @@ public void test_get_description_for_changes() { @Test @NeedReload public void test_get_description_for_changes_from_table() { - org.assertj.db.type.Changes fromSource = new org.assertj.db.type.Changes(new Table(source, "actor")) + org.assertj.db.type.Changes fromSource = new org.assertj.db.type.Changes(new Table(jdbcConnectionProvider, "actor")) .setStartPointNow(); - org.assertj.db.type.Changes fromDataSource = new org.assertj.db.type.Changes(new Table(dataSource, "actor")) + org.assertj.db.type.Changes fromDataSource = new org.assertj.db.type.Changes(new Table(dsConnectionProvider, "actor")) .setStartPointNow(); updateChangesForTests(); fromSource.setEndPointNow(); @@ -101,8 +102,8 @@ public void test_get_description_for_changes_from_table() { String descriptionFromSource = Descriptions.getDescription(fromSource); String descriptionFromDataSource = Descriptions.getDescription(fromDataSource); - assertThat(descriptionFromSource).isEqualTo("Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source"); - assertThat(descriptionFromDataSource).isEqualTo("Changes on ACTOR table of a data source"); + assertThat(descriptionFromSource).isEqualTo("Changes on ACTOR table of 'sa/jdbc:h2:mem:test'"); + assertThat(descriptionFromDataSource).isEqualTo("Changes on ACTOR table of 'data source'"); } /** @@ -111,14 +112,14 @@ public void test_get_description_for_changes_from_table() { @Test @NeedReload public void test_get_description_for_changes_from_request() { - org.assertj.db.type.Changes fromSource = new org.assertj.db.type.Changes(new Request(source, "select * from actor")) + org.assertj.db.type.Changes fromSource = new org.assertj.db.type.Changes(new Request(jdbcConnectionProvider, "select * from actor")) .setStartPointNow(); org.assertj.db.type.Changes fromDataSource = new org.assertj.db.type.Changes( - new Request(dataSource, "select * from actor")).setStartPointNow(); + new Request(dsConnectionProvider, "select * from actor")).setStartPointNow(); org.assertj.db.type.Changes fromSourceLong = new org.assertj.db.type.Changes( - new Request(source, "select id, name, firstname, birth, actor_imdb from actor")).setStartPointNow(); + new Request(jdbcConnectionProvider, "select id, name, firstname, birth, actor_imdb from actor")).setStartPointNow(); org.assertj.db.type.Changes fromDataSourceLong = new org.assertj.db.type.Changes( - new Request(dataSource, "select id, name, firstname, birth, actor_imdb from actor")).setStartPointNow(); + new Request(dsConnectionProvider, "select id, name, firstname, birth, actor_imdb from actor")).setStartPointNow(); updateChangesForTests(); fromSource.setEndPointNow(); fromDataSource.setEndPointNow(); @@ -130,10 +131,10 @@ public void test_get_description_for_changes_from_request() { String descriptionFromSourceLong = Descriptions.getDescription(fromSourceLong); String descriptionFromDataSourceLong = Descriptions.getDescription(fromDataSourceLong); - assertThat(descriptionFromSource).isEqualTo("Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test' source"); - assertThat(descriptionFromDataSource).isEqualTo("Changes on 'select * from actor' request of a data source"); - assertThat(descriptionFromSourceLong).isEqualTo("Changes on 'select id, name, firstname, bi...' request of 'sa/jdbc:h2:mem:test' source"); - assertThat(descriptionFromDataSourceLong).isEqualTo("Changes on 'select id, name, firstname, bi...' request of a data source"); + assertThat(descriptionFromSource).isEqualTo("Changes on 'select * from actor' request of 'sa/jdbc:h2:mem:test'"); + assertThat(descriptionFromDataSource).isEqualTo("Changes on 'select * from actor' request of 'data source'"); + assertThat(descriptionFromSourceLong).isEqualTo("Changes on 'select id, name, firstname, bi...' request of 'sa/jdbc:h2:mem:test'"); + assertThat(descriptionFromDataSourceLong).isEqualTo("Changes on 'select id, name, firstname, bi...' request of 'data source'"); } /** @@ -260,9 +261,9 @@ public void test_get_description_for_changes_from_changes() { @Test @NeedReload public void test_get_description_for_change_from_changes_from_table() { - org.assertj.db.type.Changes fromSource = new org.assertj.db.type.Changes(new Table(source, "actor")) + org.assertj.db.type.Changes fromSource = new org.assertj.db.type.Changes(new Table(jdbcConnectionProvider, "actor")) .setStartPointNow(); - org.assertj.db.type.Changes fromDataSource = new org.assertj.db.type.Changes(new Table(dataSource, "actor")) + org.assertj.db.type.Changes fromDataSource = new org.assertj.db.type.Changes(new Table(dsConnectionProvider, "actor")) .setStartPointNow(); updateChangesForTests(); fromSource.setEndPointNow(); @@ -296,14 +297,14 @@ public void test_get_description_for_change_from_changes_from_table() { @Test @NeedReload public void test_get_description_for_change_from_changes_from_request() { - org.assertj.db.type.Changes fromSource = new org.assertj.db.type.Changes(new Request(source, "select * from actor")) + org.assertj.db.type.Changes fromSource = new org.assertj.db.type.Changes(new Request(jdbcConnectionProvider, "select * from actor")) .setStartPointNow(); org.assertj.db.type.Changes fromDataSource = new org.assertj.db.type.Changes( - new Request(dataSource, "select * from actor")).setStartPointNow(); + new Request(dsConnectionProvider, "select * from actor")).setStartPointNow(); org.assertj.db.type.Changes fromSourceLong = new org.assertj.db.type.Changes( - new Request(source, "select id, name, firstname, birth, actor_imdb from actor")).setStartPointNow(); + new Request(jdbcConnectionProvider, "select id, name, firstname, birth, actor_imdb from actor")).setStartPointNow(); org.assertj.db.type.Changes fromDataSourceLong = new org.assertj.db.type.Changes( - new Request(dataSource, "select id, name, firstname, birth, actor_imdb from actor")).setStartPointNow(); + new Request(dsConnectionProvider, "select id, name, firstname, birth, actor_imdb from actor")).setStartPointNow(); updateChangesForTests(); fromSource.setEndPointNow(); fromDataSource.setEndPointNow();