void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final String className = "a.ATest"; listener.onSuiteStart(className, true); for(String methodName : new String[] {"test1", "test2"}) { final MockTestNGResult setUp = new MockTestNGResult(className, "setUp"); listener.onConfigurationStart(setUp); listener.onConfigurationSuccess(setUp); final MockTestNGResult result = new MockTestNGResult(className, methodName); listener.onTestStart(result); listener.onTestFinished(result); final MockTestNGResult tearDown = new MockTestNGResult(className, "tearDown"); listener.onConfigurationStart(tearDown); listener.onConfigurationSuccess(tearDown); } listener.onSuiteFinish(className); Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest'] ##teamcity[testStarted name='ATest.setUp' locationHint='java:test://a.ATest/setUp' config='true'] ##teamcity[testFinished name='ATest.setUp'] ##teamcity[testStarted name='ATest.test1' locationHint='java:test://a.ATest/test1'] ##teamcity[testFinished name='ATest.test1'] ##teamcity[testStarted name='ATest.tearDown' locationHint='java:test://a.ATest/tearDown' config='true'] ##teamcity[testFinished name='ATest.tearDown'] ##teamcity[testStarted name='ATest.setUp (1)' locationHint='java:test://a.ATest/setUp|[1|]' config='true'] ##teamcity[testFinished name='ATest.setUp (1)'] ##teamcity[testStarted name='ATest.test2' locationHint='java:test://a.ATest/test2'] ##teamcity[testFinished name='ATest.test2'] ##teamcity[testStarted name='ATest.tearDown (1)' locationHint='java:test://a.ATest/tearDown|[1|]' config='true'] ##teamcity[testFinished name='ATest.tearDown (1)'] ##teamcity[testSuiteFinished name='a.ATest'] """, StringUtil.convertLineSeparators(buf.toString())); }