Add cause assertions to ThrowableAssert #112

ash2k opened this Issue Sep 14, 2012 · 6 comments

3 participants


Add two new assertions to ThrowableAssert:

hasCause(Throwable e);
hasRootCause(Throwable e);

Also, maybe (is this too specific?) add instanceOf checks for cause:

hasCauseOfClass(Class<? extends Throwable> eClass);
hasRootCauseOfClass(Class<? extends Throwable> eClass);

I'll be removing ThrowableAssert from the code base. It provide little benefit since anything that you need to check in a Throwable can be done with other assertions.

@alexruiz alexruiz closed this Oct 5, 2012

Pressed "Close" by accident. I'm leaving the issue open in case we'd like to discuss it further.

@alexruiz alexruiz reopened this Oct 5, 2012

From wiki:

FEST Assertions 2.0 is a Java library that provides a fluent interface for writing assertions.
Its main goal is to improve test code readability and make maintenance of tests easier.

Dont you agree that the first sample is MUCH more radable?

Throwables is from Guava.


It is more readable, no doubt. But we cannot provide an assertion for everything. We need to draw the line somewhere. We may reconsider after releasing 2.0.


I agree with Mikhail, the thing that made me choose Fest over Hamcrest was the richness of Fest Assertions, IMHO this is why Fest is successfull (along with the ease of use).

Question is : do we had some user complain about providing too much assertions ?

I'm gonna post the question on the fest-dev list of where we should draw the line of what we provide.
Maybe the solution would a small core assertions and an extended assertions module ... but let's disuss that on the dev-list.


Good idea, Joel! I think automatic notification of issues (creation, updates) to the dev mailing list can be pretty helpful. This way, others can participate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment