From 5c2dcfef512613e3d6a56a2ca1f7b7d185fb1c0a Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 30 Sep 2014 16:12:05 +0200 Subject: [PATCH] IDEA-130394 TestNG, diff link is not displayed when hamcrest is used --- .../src/com/theoryinpractice/testng/model/TestProxy.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/testng/src/com/theoryinpractice/testng/model/TestProxy.java b/plugins/testng/src/com/theoryinpractice/testng/model/TestProxy.java index b5e24707bba7..1d69c2dba2e6 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/model/TestProxy.java +++ b/plugins/testng/src/com/theoryinpractice/testng/model/TestProxy.java @@ -52,6 +52,8 @@ public class TestProxy extends AbstractTestProxy { Pattern.compile("(.*)expected not same with:\\<(.*)\\> but was same:\\<(.*)\\>.*", Pattern.DOTALL); @NonNls public static final Pattern EXPECTED_BUT_FOUND_PATTERN = Pattern.compile("(.*)expected \\[(.*)\\] but found \\[(.*)\\].*", Pattern.DOTALL); + @NonNls public static final Pattern EXPECTED_BUT_WAS_HAMCREST_PATTERN = + Pattern.compile("(.*)\nExpected: .*?\"(.*)\"\n\\s*but: .*?\"(.*)\".*", Pattern.DOTALL); private final List results = new ArrayList(); private TestResultMessage resultMessage; private String name; @@ -371,6 +373,9 @@ public class TestProxy extends AbstractTestProxy { if (appendDiffChuncks(result, s, printables, EXPECTED_BUT_FOUND_PATTERN)) { return printables; } + if (appendDiffChuncks(result, s, printables, EXPECTED_BUT_WAS_HAMCREST_PATTERN)) { + return printables; + } printables.add(new Chunk(s, ConsoleViewContentType.ERROR_OUTPUT)); return printables; }