ReleaseNotes30

Johan Haleby edited this page Apr 28, 2017 · 17 revisions

Release Notes 3.0.0

Highlights

  • Renamed the until(Runnable) method in org.awaitility.core.ConditionFactory to untilAsserted(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 awaitility if 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#pollThread or ConditionFactory#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::new supplier when performing evaluation of the () -> fakeRepository.getValue() == 1 lambda 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 pollInSameThread with conditions that wait forever (or a long time) since Awaitility cannot interrupt the thread when it's using the same thread as the test.

Backward incompatible changes

  • Renamed the until(Runnable) method in org.awaitility.core.ConditionFactory to untilAsserted(Runnable). The reasons for this are:

    1. Runnable and Callable are ambiguous in other languages such as Kotlin and Groovy which causes problems when integration with these languages.
    2. 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 untilAsserted method (previously until(Runnable)) no longer takes a Runnable as argument but rather a ThrowingRunnable which 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 Predicate to use a Throwable instead:

    await().atMost(1000, MILLISECONDS).with().ignoreExceptionsMatching(new Predicate<Throwable>() {
            public boolean matches(Throwable e) {
                return e instanceof RuntimeException;
            }
        }).until(..);
  • Removed org.awaitility.Awaitility#matches method since it's no longer needed

  • Removed most public constructors in org.awaitility.core.ConditionFactory since they shouldn't be used

  • Moved inner class org.awaitility.pollinterval.IterativePollInterval.Function to org.awaitility.core.Function and changed it to use generics for input and output

  • Removed the deprecated value org.awaitility.Duration#SAME_AS_POLL_INTERVAL

Minor changes

Refer to the change log.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.