You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/06/26 20:20:37 UTC

[commons-text] branch master updated: Add RandomStringGeneratorTest#testSelectFromEmptyCharVarargs()

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git


The following commit(s) were added to refs/heads/master by this push:
     new e98e63bd Add RandomStringGeneratorTest#testSelectFromEmptyCharVarargs()
e98e63bd is described below

commit e98e63bdaa0d5a6917daabff58e47d5b037c8377
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jun 26 16:20:33 2023 -0400

    Add RandomStringGeneratorTest#testSelectFromEmptyCharVarargs()
---
 .../org/apache/commons/text/RandomStringGeneratorTest.java     | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
index d3c8b2b2..ee5d580a 100644
--- a/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
+++ b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
@@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
 import static org.assertj.core.api.Assertions.assertThatNullPointerException;
 import static org.assertj.core.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.junit.jupiter.api.Test;
 
@@ -212,6 +213,15 @@ public class RandomStringGeneratorTest {
         }
     }
 
+    @Test
+    public void testSelectFromEmptyCharVarargs() {
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().selectFrom().build();
+        final String randomText = generator.generate(5);
+        for (final char c : randomText.toCharArray()) {
+            assertTrue(c >= Character.MIN_CODE_POINT && c <= Character.MAX_CODE_POINT);
+        }
+    }
+
     @Test
     public void testSetLength() {
         final int length = 99;