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 2020/06/28 22:12:48 UTC

[commons-text] branch master updated: More testing.

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 2d0a14f  More testing.
2d0a14f is described below

commit 2d0a14f5c559bdca178e91b6bb4ac44e08ae461c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 28 18:12:42 2020 -0400

    More testing.
---
 .../apache/commons/text/TextStringBuilderTest.java   | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java
index 8151e8b..efa0026 100644
--- a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java
+++ b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java
@@ -675,14 +675,22 @@ public class TextStringBuilderTest {
         assertEquals("", sb.toString());
     }
 
-    // -----------------------------------------------------------------------
     @Test
     public void testDeleteCharAt() {
-        final TextStringBuilder sb = new TextStringBuilder("abc");
-        sb.deleteCharAt(0);
-        assertEquals("bc", sb.toString());
-
-        assertThrows(IndexOutOfBoundsException.class, () -> sb.deleteCharAt(1000));
+        final String str = "abc";
+        {
+            final TextStringBuilder sb = new TextStringBuilder(str);
+            sb.deleteCharAt(0);
+            assertEquals("bc", sb.toString());
+        }
+        {
+            final TextStringBuilder sb = new TextStringBuilder(str);
+            sb.deleteCharAt(str.length() - 1);
+            assertEquals("ab", sb.toString());
+        }
+        final TextStringBuilder sb2 = new TextStringBuilder(str);
+        assertThrows(IndexOutOfBoundsException.class, () -> sb2.deleteCharAt(str.length()));
+        assertThrows(IndexOutOfBoundsException.class, () -> sb2.deleteCharAt(1000));
     }
 
     @Test