Use AssertJ's isEmpty() instead of hasSize(0)

Achieved via global search-and-replace.
This commit is contained in:
Sam Brannen
2022-11-22 17:11:50 +01:00
parent d5b0b2b1a1
commit 7fcd1de8e3
79 changed files with 260 additions and 295 deletions

View File

@@ -249,7 +249,7 @@ public class NamedParameterUtilsTests {
String expectedSql = "select foo from bar where baz = b:{}z";
String sql = "select foo from bar where baz = b:{}z";
ParsedSql parsedSql = NamedParameterUtils.parseSqlStatement(sql);
assertThat(parsedSql.getParameterNames()).hasSize(0);
assertThat(parsedSql.getParameterNames()).isEmpty();
String finalSql = NamedParameterUtils.substituteNamedParameters(parsedSql, null);
assertThat(finalSql).isEqualTo(expectedSql);
@@ -257,7 +257,7 @@ public class NamedParameterUtilsTests {
String sql2 = "select foo from bar where baz = 'b:{p1}z'";
ParsedSql parsedSql2 = NamedParameterUtils.parseSqlStatement(sql2);
assertThat(parsedSql2.getParameterNames()).hasSize(0);
assertThat(parsedSql2.getParameterNames()).isEmpty();
String finalSql2 = NamedParameterUtils.substituteNamedParameters(parsedSql2, null);
assertThat(finalSql2).isEqualTo(expectedSql2);
}

View File

@@ -81,7 +81,7 @@ public class BatchSqlUpdateTests {
}
else {
assertThat(update.getQueueCount()).isEqualTo(2);
assertThat(update.getRowsAffected()).hasSize(0);
assertThat(update.getRowsAffected()).isEmpty();
}
int[] actualRowsAffected = update.flush();
@@ -102,7 +102,7 @@ public class BatchSqlUpdateTests {
assertThat(actualRowsAffected[1]).isEqualTo(rowsAffected[1]);
update.reset();
assertThat(update.getRowsAffected()).hasSize(0);
assertThat(update.getRowsAffected()).isEmpty();
verify(preparedStatement).setObject(1, ids[0], Types.INTEGER);
verify(preparedStatement).setObject(1, ids[1], Types.INTEGER);

View File

@@ -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()).hasSize(0);
assertThat(sf.getErrorCodes("Oracle").getBadSqlGrammarCodes()).isEmpty();
}
/**
@@ -371,8 +371,8 @@ public class SQLErrorCodesFactoryTests {
}
private void assertIsEmpty(SQLErrorCodes sec) {
assertThat(sec.getBadSqlGrammarCodes()).hasSize(0);
assertThat(sec.getDataIntegrityViolationCodes()).hasSize(0);
assertThat(sec.getBadSqlGrammarCodes()).isEmpty();
assertThat(sec.getDataIntegrityViolationCodes()).isEmpty();
}
}