diff options
Diffstat (limited to 'sonar-channel/src/test/java/org/sonar/channel/RegexChannelTest.java')
-rw-r--r-- | sonar-channel/src/test/java/org/sonar/channel/RegexChannelTest.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sonar-channel/src/test/java/org/sonar/channel/RegexChannelTest.java b/sonar-channel/src/test/java/org/sonar/channel/RegexChannelTest.java index 322899266ab..75a30fb0acd 100644 --- a/sonar-channel/src/test/java/org/sonar/channel/RegexChannelTest.java +++ b/sonar-channel/src/test/java/org/sonar/channel/RegexChannelTest.java @@ -39,8 +39,15 @@ public class RegexChannelTest { ChannelDispatcher<StringBuilder> dispatcher = ChannelDispatcher.builder().addChannel(new MyLiteralChannel()).build(); StringBuilder output = new StringBuilder(); - dispatcher.consume(new CodeReader("\"bonjour\""), output); - assertThat(output.toString(), is("<literal>\"bonjour\"</literal>")); + CodeReaderConfiguration codeReaderConfiguration = new CodeReaderConfiguration(); + codeReaderConfiguration.setBufferCapacity(2); + + int literalLength = 100000; + String veryLongLiteral = String.format(String.format("%%0%dd", literalLength), 0).replace("0", "a"); + + assertThat(veryLongLiteral.length(), is(100000)); + dispatcher.consume(new CodeReader("\">" + veryLongLiteral + "<\"", codeReaderConfiguration), output); + assertThat(output.toString(), is("<literal>\">" + veryLongLiteral + "<\"</literal>")); } private static class MyLiteralChannel extends RegexChannel<StringBuilder> { |