-
-
Notifications
You must be signed in to change notification settings - Fork 262
ReleaseNotes30
-
Renamed the
until(Runnable)method inorg.awaitility.core.ConditionFactorytountilAsserted(Runnable)(see backward incompatible changes for more info) -
Moved proxy creation to a new project called "awaitility-proxy" which you have to depend on in addition to
awaitilityif you want to make use of this functionality. This means that Awaitility can be smaller for most users who are using Java 8 and doesn't require proxy conditions due to lambda expressions (see backward incompatible changes for more info). -
Migrated from CgLib to ByteBuddy for class proxies
-
Catching throwable instead of exception in poll-scheduling thread
-
Added root cause to ConditionTimeoutException when applicable so that one can more easily distinguish where an error occurred (issue 67)
-
Removed the need for the Awaitility poll scheduling thread which means that Awaitility only uses one thread by default
-
Added ability to specify the executor service or thread to be used to perform condition evaluations (polling) by using
ConditionFactory#pollThreadorConditionFactory#pollExecutorService, for example:given().pollThread(Thread::new).await().atMost(1000, MILLISECONDS).until(() -> fakeRepository.getValue() == 1);
Awaitility will now use the Thread created by in the
Thread::newsupplier when performing evaluation of the() -> fakeRepository.getValue() == 1lambda expression.It's also possible to configure Awaitility poll in the same thread as the test:
given().pollInSameThread().await().atMost(1000, MILLISECONDS).until(() -> fakeRepository.getValue() == 1);
This is an advanced feature and you should be careful when combining
pollInSameThreadwith conditions that wait forever (or a long time) since Awaitility cannot interrupt the thread when it's using the same thread as the test.
-
Renamed the
until(Runnable)method inorg.awaitility.core.ConditionFactorytountilAsserted(Runnable). The reasons for this are:- Runnable and Callable are ambiguous in other languages such as Kotlin and Groovy which causes problems when integration with these languages.
- It's not clear (enough) when to use the Callable variant vs the Runnable variant when using plain Java
This means that if you previously did:
await().until(() -> assertThat(something()).isEqualTo("Something"));
you now need to do:
await().untilAsserted(() -> assertThat(something()).isEqualTo("Something"));
-
The
untilAssertedmethod (previouslyuntil(Runnable)) no longer takes aRunnableas argument but rather aThrowingRunnablewhich allows the runnable to throw checked exceptions. This is backward incompatible only if you've supplied an explicit instance of Runnable to the function. If using Java 8 lambda expressions then nothing should change. -
Moved proxy creation to a new project called "awaitility-proxy". This means that if you need to use proxies depend on this project:
<dependency> <groupId>org.awaitility</groupId> <artifactId>awaitility-proxy</artifactId> <version>3.0.0</version> </dependency>
You create a proxy when you do:
await().untilCall( to(someObject).someMethod(), is(4) );
-
You can now ignore throwables and not only exceptions. This shouldn't affect your old code if you previously used Java 8 lamda expressions or method references but if you previously did:
await().atMost(1000, MILLISECONDS).with().ignoreExceptionsMatching(new Predicate<Exception>() { public boolean matches(Exception e) { return e instanceof RuntimeException; } }).until(..);
then you now have to change the
Predicateto use aThrowableinstead:await().atMost(1000, MILLISECONDS).with().ignoreExceptionsMatching(new Predicate<Throwable>() { public boolean matches(Throwable e) { return e instanceof RuntimeException; } }).until(..);
-
Removed
org.awaitility.Awaitility#matchesmethod since it's no longer needed -
Removed most public constructors in
org.awaitility.core.ConditionFactorysince they shouldn't be used -
Moved inner class
org.awaitility.pollinterval.IterativePollInterval.Functiontoorg.awaitility.core.Functionand changed it to use generics for input and output -
Removed the deprecated value
org.awaitility.Duration#SAME_AS_POLL_INTERVAL
Refer to the change log.