Hi.

On Tue, 27 Dec 2016 09:54:29 +0000 (UTC), djo...@apache.org wrote:
Repository: commons-text
Updated Branches:
  refs/heads/master 1b3e44809 -> 0b1ca53b3


Complete test coverage for RandomStringGenerator

Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/0b1ca53b Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/0b1ca53b Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/0b1ca53b

Branch: refs/heads/master
Commit: 0b1ca53b3e00e74364849a14372e4b3f57c2d3a0
Parents: 1b3e448
Author: duncan <dun...@wortharead.com>
Authored: Tue Dec 27 09:54:19 2016 +0000
Committer: duncan <dun...@wortharead.com>
Committed: Tue Dec 27 09:54:19 2016 +0000


----------------------------------------------------------------------
.../org/apache/commons/text/RandomStringGeneratorTest.java | 6 ++++++
 1 file changed, 6 insertions(+)

----------------------------------------------------------------------



http://git-wip-us.apache.org/repos/asf/commons-text/blob/0b1ca53b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java

----------------------------------------------------------------------
diff --git

a/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java

b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
index 2ff7a67..36ce5e0 100644
--- a/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java +++ b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
@@ -203,4 +203,10 @@ public class RandomStringGeneratorTest {
             assertTrue(c == 'b');
         }
     }
+
+    @Test
+    public void testZeroLength() throws Exception {
+        RandomStringGenerator generator = new
RandomStringGenerator.Builder().build();
+        assertEquals("", generator.generate(0));
+    }
 }

A string of length zero hardly qualifies as random.
Shouldn't "generate(0)" rather raise an exception?
[I know that "nextInt(1)" is also not random, but what applies to a
general-purpose low-level utility might not be the best option for
applications that would use TEXT.]

Regards,
Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to