hamcrest matchers extended support (IDEA-102730)

(cherry picked from commit 392d239dcf8bc1a35c0744b37270493743720e70)
This commit is contained in:
anna
2013-03-15 22:01:35 +01:00
parent e5f39e3f44
commit 9acf2f827c
@@ -121,6 +121,9 @@ public class JUnit4TestResultsSender extends RunListener {
final String message = assertion.getMessage();
if (message != null) {
PacketFactory notification = createExceptionNotification(assertion, message, "\nExpected: is \"(.*)\"\n\\s*got: \"(.*)\"\n");
if (notification == null) {
notification = createExceptionNotification(assertion, message, "\nExpected: is \"(.*)\"\n\\s*but: was \"(.*)\"");
}
if (notification == null) {
notification = createExceptionNotification(assertion, message, "\nExpected: (.*)\n\\s*got: (.*)");
}
@@ -141,7 +144,7 @@ public class JUnit4TestResultsSender extends RunListener {
}
private static PacketFactory createExceptionNotification(Throwable assertion, String message, final String regex) {
final Matcher matcher = Pattern.compile(regex, Pattern.DOTALL).matcher(message);
final Matcher matcher = Pattern.compile(regex, Pattern.DOTALL | Pattern.CASE_INSENSITIVE).matcher(message);
if (matcher.matches()) {
return ComparisonDetailsExtractor.create(assertion, matcher.group(1).replaceAll("\\\\n", "\n"), matcher.group(2).replaceAll("\\\\n", "\n"));
}