junit comparison failure extended to support assertThat/assertSame (IDEA-66648)

This commit is contained in:
anna
2011-03-24 10:12:46 +01:00
parent e9a4d7e5e3
commit dae87bc329
@@ -94,9 +94,13 @@ public class JUnit4TestResultsSender extends RunListener {
catch (Throwable ignore) {}
}
if (assertion.getMessage() != null) {
final Matcher matcher =
Pattern.compile("\nExpected: \"(.*)\"\n got: \"(.*)\"\n", Pattern.DOTALL).matcher(assertion.getMessage());
final String message = assertion.getMessage();
if (message != null) {
Matcher matcher =
Pattern.compile("\nExpected: (.*)\n\\s*got: (.*)", Pattern.DOTALL).matcher(message);
if (!matcher.matches()) {
matcher = Pattern.compile("expected same:<(.*)> was not:<(.*)>", Pattern.DOTALL).matcher(message);
}
if (matcher.matches()) {
return ComparisonDetailsExtractor
.create(assertion, matcher.group(1).replaceAll("\\\\n", "\n"), matcher.group(2).replaceAll("\\\\n", "\n"));