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

@@ -186,7 +186,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
EntityManager em = entityManagerFactory.createEntityManager();
Query q = em.createQuery("select p from Person as p");
List<Person> people = q.getResultList();
assertThat(people).hasSize(0);
assertThat(people).isEmpty();
assertThatExceptionOfType(NoResultException.class).isThrownBy(q::getSingleResult);
}
@@ -198,7 +198,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
EntityManager em = entityManagerFactory.createEntityManager();
Query q = em.createQuery("select p from Person as p");
List<Person> people = q.getResultList();
assertThat(people).hasSize(0);
assertThat(people).isEmpty();
assertThatExceptionOfType(NoResultException.class).isThrownBy(q::getSingleResult);
}
@@ -208,7 +208,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
Query q = this.sharedEntityManager.createQuery("select p from Person as p");
q.setFlushMode(FlushModeType.AUTO);
List<Person> people = q.getResultList();
assertThat(people).hasSize(0);
assertThat(people).isEmpty();
assertThatExceptionOfType(NoResultException.class).isThrownBy(q::getSingleResult);
}
@@ -221,7 +221,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
Query q = em.createQuery("select p from Person as p");
q.setFlushMode(FlushModeType.AUTO);
List<Person> people = q.getResultList();
assertThat(people).hasSize(0);
assertThat(people).isEmpty();
assertThatException()
.isThrownBy(q::getSingleResult)
.withMessageContaining("closed");

View File

@@ -95,7 +95,7 @@ public class PersistenceXmlParsingTests {
assertThat(info[0].getMappingFileNames()).hasSize(1);
assertThat(info[0].getMappingFileNames().get(0)).isEqualTo("mappings.xml");
assertThat(info[0].getProperties().keySet()).hasSize(0);
assertThat(info[0].getProperties().keySet()).isEmpty();
assertThat(info[0].excludeUnlistedClasses()).as("Exclude unlisted should default false in 1.0.").isFalse();
}
@@ -115,7 +115,7 @@ public class PersistenceXmlParsingTests {
assertThat(info[0].getJarFileUrls().get(0)).isEqualTo(new ClassPathResource("order.jar").getURL());
assertThat(info[0].getJarFileUrls().get(1)).isEqualTo(new ClassPathResource("order-supplemental.jar").getURL());
assertThat(info[0].getProperties().keySet()).hasSize(0);
assertThat(info[0].getProperties().keySet()).isEmpty();
assertThat(info[0].getJtaDataSource()).isNull();
assertThat(info[0].getNonJtaDataSource()).isNull();
@@ -148,7 +148,7 @@ public class PersistenceXmlParsingTests {
assertThat(info[0].excludeUnlistedClasses()).as("Exclude unlisted should be true when no value.").isTrue();
assertThat(info[0].getTransactionType()).isSameAs(PersistenceUnitTransactionType.RESOURCE_LOCAL);
assertThat(info[0].getProperties().keySet()).hasSize(0);
assertThat(info[0].getProperties().keySet()).isEmpty();
builder.clear();
}
@@ -173,7 +173,7 @@ public class PersistenceXmlParsingTests {
assertThat(info[0].getJarFileUrls().get(1)).isEqualTo(new ClassPathResource("order-supplemental.jar").getURL());
assertThat(info[0].getPersistenceProviderClassName()).isEqualTo("com.acme.AcmePersistence");
assertThat(info[0].getProperties().keySet()).hasSize(0);
assertThat(info[0].getProperties().keySet()).isEmpty();
assertThat(info[0].excludeUnlistedClasses()).as("Exclude unlisted should default false in 1.0.").isFalse();
}
@@ -249,7 +249,7 @@ public class PersistenceXmlParsingTests {
PersistenceUnitInfo[] info = reader.readPersistenceUnitInfos(resource);
assertThat(info).hasSize(1);
assertThat(info[0].getPersistenceUnitName()).isEqualTo("pu");
assertThat(info[0].getProperties().keySet()).hasSize(0);
assertThat(info[0].getProperties().keySet()).isEmpty();
assertThat(info[0].excludeUnlistedClasses()).as("Exclude unlisted should default false in 1.0.").isFalse();
}