Skip to content

Conversation

UrsMetz
Copy link

@UrsMetz UrsMetz commented Sep 10, 2015

This fixes #12 but in contrast to the proposed solution there it changes the signature of ExpectedException#except(Matcher<?>) to expect(Matcher<? super Throwable>).

Following the PECS guideline expect() should take Matcher<? super
Throwable>.

One test had to be adjusted so that the code still compiles:
any(Expection.class) was replaced by instanceOf(Expection.class).
Judging from the JavaDoc of both matchers the latter is anyway the
better fitting one.
* use Java 7's diamond operator
* harmonize generics
* remove unused "generics handling" code
@UrsMetz UrsMetz mentioned this pull request Sep 10, 2015
@kcooney
Copy link

kcooney commented Dec 2, 2016

As a maintainer of JUnit, I support this change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExpectedException#expect() should take Matcher<? extends Throwable> as its argument

2 participants