diff options
author | Dinesh Bolkensteyn <dinesh@dinsoft.net> | 2011-10-27 16:27:41 +0200 |
---|---|---|
committer | Dinesh Bolkensteyn <dinesh@dinsoft.net> | 2011-10-27 16:27:41 +0200 |
commit | 9ca0e7dfd87934fba1ea49923c4d922fdbad2ba5 (patch) | |
tree | ceb57acb0a3932da13a9296b21b674cd9ec4fb26 | |
parent | 2b140b9700b79704675b8a5ab1fe435e34069b1e (diff) | |
download | sonarqube-9ca0e7dfd87934fba1ea49923c4d922fdbad2ba5.tar.gz sonarqube-9ca0e7dfd87934fba1ea49923c4d922fdbad2ba5.zip |
SONAR-2632 Improved the unit test associated to removal of channel buffer length limit
-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> { |