Skip to content

Commit

Permalink
fix ResultMatchers#hasFailureContaining
Browse files Browse the repository at this point in the history
It should not match when the given PrintableResult has no failures.
  • Loading branch information
alb-i986 committed May 13, 2016
1 parent 9b1bc4a commit 9f5dfd8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.hamcrest.TypeSafeMatcher;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;

/**
* Matchers on a PrintableResult, to enable JUnit self-tests.
Expand Down Expand Up @@ -77,7 +78,7 @@ public void describeTo(Description description) {
public static Matcher<PrintableResult> hasFailureContaining(final String string) {
return new BaseMatcher<PrintableResult>() {
public boolean matches(Object item) {
return item.toString().contains(string);
return failureCount(greaterThan(0)).matches(item) && item.toString().contains(string);
}

public void describeTo(Description description) {
Expand Down

0 comments on commit 9f5dfd8

Please sign in to comment.