Skip to content

Instantly share code, notes, and snippets.

View moelholm's full-sized avatar
:bowtie:

Nicky Moelholm moelholm

:bowtie:
View GitHub Profile
@moelholm
moelholm / assertEventualCollectionCondition.java
Created September 22, 2017 08:02
assertEventualCollectionCondition ... awaiting some future condition
// >>> How to use
assertEventualCollectionCondition(
() -> em.createQuery("from Dog").getResultList(),
Collection::isEmpty);
// >>>
private <T> void assertEventualCollectionCondition(Supplier<Collection<T>> supplier, Predicate<Collection<T>> test) throws Exception {
assertEventualCollectionCondition(30, TimeUnit.SECONDS, supplier, test);