void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final String className = "a.ATest"; AssertionError throwable = new AssertionError("expected [expected\nnewline] but found [actual\nnewline]"); MockTestNGResult foo = new MockTestNGResult(className, "testFoo", throwable, ArrayUtil.EMPTY_OBJECT_ARRAY); listener.onTestFailure(foo); String message = buf.toString(); String expectedFailureMessage = "##teamcity[testFailed name='ATest.testFoo' message='java.lang.AssertionError:' expected='expected|nnewline' actual='actual|nnewline'"; Assert.assertTrue(message, message.contains(expectedFailureMessage)); }