void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final String className = "a.ATest"; AssertionError throwable = new ComparisonFailure("[there is an unexpected value]", "1", "0"); 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='org.junit.ComparisonFailure: |[there is an unexpected value|] ' expected='1' actual='0' "; Assert.assertTrue(message, message.contains(expectedFailureMessage)); }