eclipse-vertx / vertx-junit5

Testing Vert.x applications with JUnit 5
Apache License 2.0
42 stars 30 forks source link

Add failNow method that accepts string in VertxTestContext #87

Closed ndr-brt closed 3 years ago

ndr-brt commented 3 years ago

At the moment when I need to fail the text context, there's only this method:

public synchronized void failNow(Throwable t)

that forces me, everytime, to specify a throwable, that's not interesting for my test:

test.failNow(new RuntimeException("should fail"));

Can be a good idea to define an utility method, like class Promise defines two tryFail methods: https://github.com/eclipse-vertx/vert.x/blob/ecd0a3b4ca161d5a4727e33b00b5d90daafde8e8/src/main/java/io/vertx/core/Promise.java#L131

Something like:

public synchronized void failNow(String message) {
  failNow(new NoStackTraceThrowable(message));
}