User AssertJ's hasSize() for arrays
Achieved via global search-and-replace.
This commit is contained in:
@@ -161,7 +161,7 @@ public class NamedParameterUtilsTests {
|
||||
paramMap.addValue("b", "b");
|
||||
paramMap.addValue("c", "c");
|
||||
Object[] params = NamedParameterUtils.buildValueArray(psql1, paramMap, null);
|
||||
assertThat(params.length).isEqualTo(4);
|
||||
assertThat(params).hasSize(4);
|
||||
assertThat(params[0]).isEqualTo("a");
|
||||
assertThat(params[1]).isEqualTo("b");
|
||||
assertThat(params[2]).isEqualTo("c");
|
||||
|
||||
@@ -77,11 +77,11 @@ public class BatchSqlUpdateTests {
|
||||
|
||||
if (flushThroughBatchSize) {
|
||||
assertThat(update.getQueueCount()).isEqualTo(0);
|
||||
assertThat(update.getRowsAffected().length).isEqualTo(2);
|
||||
assertThat(update.getRowsAffected()).hasSize(2);
|
||||
}
|
||||
else {
|
||||
assertThat(update.getQueueCount()).isEqualTo(2);
|
||||
assertThat(update.getRowsAffected().length).isEqualTo(0);
|
||||
assertThat(update.getRowsAffected()).hasSize(0);
|
||||
}
|
||||
|
||||
int[] actualRowsAffected = update.flush();
|
||||
@@ -102,7 +102,7 @@ public class BatchSqlUpdateTests {
|
||||
assertThat(actualRowsAffected[1]).isEqualTo(rowsAffected[1]);
|
||||
|
||||
update.reset();
|
||||
assertThat(update.getRowsAffected().length).isEqualTo(0);
|
||||
assertThat(update.getRowsAffected()).hasSize(0);
|
||||
|
||||
verify(preparedStatement).setObject(1, ids[0], Types.INTEGER);
|
||||
verify(preparedStatement).setObject(1, ids[1], Types.INTEGER);
|
||||
|
||||
@@ -185,7 +185,7 @@ public class SQLErrorCodesFactoryTests {
|
||||
// Should have loaded without error
|
||||
TestSQLErrorCodesFactory sf = new TestSQLErrorCodesFactory();
|
||||
assertThat(sf.getErrorCodes("XX").getBadSqlGrammarCodes().length == 0).isTrue();
|
||||
assertThat(sf.getErrorCodes("Oracle").getBadSqlGrammarCodes().length).isEqualTo(2);
|
||||
assertThat(sf.getErrorCodes("Oracle").getBadSqlGrammarCodes()).hasSize(2);
|
||||
assertThat(sf.getErrorCodes("Oracle").getBadSqlGrammarCodes()[0]).isEqualTo("1");
|
||||
assertThat(sf.getErrorCodes("Oracle").getBadSqlGrammarCodes()[1]).isEqualTo("2");
|
||||
}
|
||||
@@ -206,7 +206,7 @@ public class SQLErrorCodesFactoryTests {
|
||||
// Should have failed to load without error
|
||||
TestSQLErrorCodesFactory sf = new TestSQLErrorCodesFactory();
|
||||
assertThat(sf.getErrorCodes("XX").getBadSqlGrammarCodes().length == 0).isTrue();
|
||||
assertThat(sf.getErrorCodes("Oracle").getBadSqlGrammarCodes().length).isEqualTo(0);
|
||||
assertThat(sf.getErrorCodes("Oracle").getBadSqlGrammarCodes()).hasSize(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,11 +226,11 @@ public class SQLErrorCodesFactoryTests {
|
||||
|
||||
// Should have loaded without error
|
||||
TestSQLErrorCodesFactory sf = new TestSQLErrorCodesFactory();
|
||||
assertThat(sf.getErrorCodes("Oracle").getCustomTranslations().length).isEqualTo(1);
|
||||
assertThat(sf.getErrorCodes("Oracle").getCustomTranslations()).hasSize(1);
|
||||
CustomSQLErrorCodesTranslation translation =
|
||||
sf.getErrorCodes("Oracle").getCustomTranslations()[0];
|
||||
assertThat(translation.getExceptionClass()).isEqualTo(CustomErrorCodeException.class);
|
||||
assertThat(translation.getErrorCodes().length).isEqualTo(1);
|
||||
assertThat(translation.getErrorCodes()).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -371,8 +371,8 @@ public class SQLErrorCodesFactoryTests {
|
||||
}
|
||||
|
||||
private void assertIsEmpty(SQLErrorCodes sec) {
|
||||
assertThat(sec.getBadSqlGrammarCodes().length).isEqualTo(0);
|
||||
assertThat(sec.getDataIntegrityViolationCodes().length).isEqualTo(0);
|
||||
assertThat(sec.getBadSqlGrammarCodes()).hasSize(0);
|
||||
assertThat(sec.getDataIntegrityViolationCodes()).hasSize(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user