eclipse-vertx / vertx-junit5

Testing Vert.x applications with JUnit 5
Apache License 2.0
44 stars 32 forks source link

Fast fail when any exception occurs in the handler #63

Closed arniu closed 2 years ago

arniu commented 5 years ago

@jponge ?

jponge commented 5 years ago

Do you have an example where the handler throws an exception?

In any case the exception will be handled and the test context will fail, but things like assertions must be wrapped using verify(() -> { ... }.

arniu commented 5 years ago

In the handler, there is not only assertion. Users may write any code here. And as a result, any exception may happen, not just assertion failures.

arniu commented 5 years ago

For example:

// `tc` is a `VertxTestContext`
tc. succeeding(it -> {
  // some other code <1>

  tc.verify(() -> {
    // assertions <2>
  });
}); 

When any exception occurs at <1>, it takes too long to get result.

jponge commented 5 years ago

You are right, but do you have any example of Vert.x-related code that throws an exception in <1>? Vert.x code typically forwards errors not as exceptions, but as asynchronous results with an exception.

arniu commented 5 years ago

Vert.x is fine. It's nothing about vertx, it's just about ergonomics.

julianladisch commented 2 years ago

This PR can be closed. The requested feature has been implemented in #81 that has been released in Vert.x 4.0.0.