void () { final Description root = Description.createSuiteDescription("root"); Description testA = Description.createTestDescription("TestA", "test1"); root.addChild(testA); final StringBuffer buf = new StringBuffer(); final JUnit4TestListener sender = createListener(buf); sender.testRunStarted(root); sender.testStarted(testA); final Exception ex1 = new Exception(); ex1.setStackTrace(new StackTraceElement[0]); final Exception ex2 = new Exception(); ex2.setStackTrace(new StackTraceElement[0]); final Throwable exception = new MultipleFailuresError("Multiple errors", List.of(ex1, ex2)); exception.setStackTrace(new StackTraceElement[0]); sender.testFailure(new Failure(testA, exception)); sender.testFinished(testA); sender.testRunFinished(new Result()); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name='TestA' locationHint='java:suite://TestA'] ##teamcity[testStarted name='TestA.test1' locationHint='java:test://TestA/test1'] ##teamcity[testFailed name='TestA.test1' error='true' message='' details='java.lang.Exception|n'] ##teamcity[testFailed name='TestA.test1' error='true' message='' details='java.lang.Exception|n'] ##teamcity[testFinished name='TestA.test1'] ##teamcity[testSuiteFinished name='TestA'] """, StringUtil.convertLineSeparators(buf.toString())); }