void () { final String messages = "##teamcity[start bar='1']\nmessage\nanothermessage##teamcity[end]\nfuu\n"; for (int step = 1; step < 20 + 1; step++) { int i = 0; final int stringLength = messages.length(); while (i < stringLength) { final String substring = messages.substring(i, Math.min(i + step, stringLength)); mySplitter.process(substring, ProcessOutputTypes.STDOUT); i += step; } mySplitter.flush(); final List<String> actual = myOutput.get(ProcessOutputTypes.STDOUT).toList(); Assert.assertThat(actual, IsCollectionContaining.hasItem("##teamcity[end]\n")); Assert.assertThat(actual, IsCollectionContaining.hasItem("##teamcity[start bar='1']\n")); myOutput.clear(); } }