Permalink
Browse files

Use <? super T> in Assert.assertThat

As the Matcher is only a consumer, ? super T is more appropriate.  Otherwise, a Matcher<Object> cannot be used with a String actual, for example.
  • Loading branch information...
1 parent 61f0654 commit 1cff207ea15039aea63ea63254a056d516ca690b @fbarber committed Sep 28, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/main/java/org/junit/Assert.java
View
4 src/main/java/org/junit/Assert.java
@@ -734,7 +734,7 @@ public static void assertEquals(Object[] expecteds, Object[] actuals) {
* @see org.hamcrest.CoreMatchers
* @see org.junit.matchers.JUnitMatchers
*/
- public static <T> void assertThat(T actual, Matcher<T> matcher) {
+ public static <T> void assertThat(T actual, Matcher<? super T> matcher) {
assertThat("", actual, matcher);
}
@@ -768,7 +768,7 @@ public static void assertEquals(Object[] expecteds, Object[] actuals) {
* @see org.junit.matchers.JUnitMatchers
*/
public static <T> void assertThat(String reason, T actual,
- Matcher<T> matcher) {
+ Matcher<? super T> matcher) {
if (!matcher.matches(actual)) {
Description description= new StringDescription();
description.appendText(reason);

0 comments on commit 1cff207

Please sign in to comment.