Collection.isEmpty() should be used to test for emptiness

Closes gh-1670
This commit is contained in:
igor-suhorukov
2018-02-09 00:31:43 +03:00
committed by Stephane Nicoll
parent 7da40abba5
commit e381514b07
14 changed files with 17 additions and 17 deletions

View File

@@ -151,7 +151,7 @@ abstract class BootstrapUtils {
@Nullable
private static Class<?> resolveExplicitTestContextBootstrapper(Class<?> testClass) {
Set<BootstrapWith> annotations = AnnotatedElementUtils.findAllMergedAnnotations(testClass, BootstrapWith.class);
if (annotations.size() < 1) {
if (annotations.isEmpty()) {
return null;
}
Assert.state(annotations.size() <= 1, () -> String.format(

View File

@@ -201,7 +201,7 @@ public abstract class ModelAndViewAssert {
tempSet.addAll(incorrectSet);
tempSet.removeAll(assertionSet);
if (tempSet.size() > 0) {
if (!tempSet.isEmpty()) {
sb.append("Set has too many elements:\n");
for (Object element : tempSet) {
sb.append('-');
@@ -214,7 +214,7 @@ public abstract class ModelAndViewAssert {
tempSet.addAll(assertionSet);
tempSet.removeAll(incorrectSet);
if (tempSet.size() > 0) {
if (!tempSet.isEmpty()) {
sb.append("Set is missing elements:\n");
for (Object element : tempSet) {
sb.append('-');