Tests don't need to catch non-runtime exceptions and rethrow them. The
following:
Awaitility.await().atMost(60, TimeUnit.SECONDS).untilAsserted(() -> {
try {
assertEquals(size, query.findPages().size());
} catch (LuceneQueryException e) {
throw new RuntimeException(e);
}
});
Can be simplified to:
Awaitility.await().atMost(60, TimeUnit.SECONDS).untilAsserted(() -> {
assertEquals(size, query.findPages().size());
});
And even better would be to use AssertJ and make it a lambda with some
static imports:
await().atMost(60,SECONDS).untilAsserted(() ->
assertThat(query.findPages()).hasSize(size));