void () { final StringBuffer buf = new StringBuffer(); final IDEATestNGRemoteListener listener = createListener(buf); final MockTestNGResult result = new MockTestNGResult("ATest", "testMe", null, new Object[]{null, null}) { @Override public List<Integer> getIncludeMethods() { return Arrays.asList(1, 3, 5); } }; for (int i = 0; i < 3; i++) { listener.onTestStart(result); listener.onTestFinished(result); } Assert.assertEquals("output: " + buf, """ ##teamcity[enteredTheMatrix] ##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest'] ##teamcity[testStarted name='ATest.testMe|[null, null|] (1)' locationHint='java:test://ATest/testMe|[1|]'] ##teamcity[testFinished name='ATest.testMe|[null, null|] (1)'] ##teamcity[testStarted name='ATest.testMe|[null, null|] (3)' locationHint='java:test://ATest/testMe|[3|]'] ##teamcity[testFinished name='ATest.testMe|[null, null|] (3)'] ##teamcity[testStarted name='ATest.testMe|[null, null|] (5)' locationHint='java:test://ATest/testMe|[5|]'] ##teamcity[testFinished name='ATest.testMe|[null, null|] (5)'] """, StringUtil.convertLineSeparators(buf.toString())); }