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 145ecc1 Document empty blocks. 145ecc1 is described below commit 145ecc173a0387531819f678c8517b9886d37e82 Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Fri May 24 09:02:21 2019 -0400 Document empty blocks. --- src/test/java/org/apache/commons/text/StrBuilderTest.java | 15 +++++++++++++++ .../org/apache/commons/text/StringEscapeUtilsTest.java | 12 ++++++++++++ .../org/apache/commons/text/TextStringBuilderTest.java | 15 +++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/src/test/java/org/apache/commons/text/StrBuilderTest.java b/src/test/java/org/apache/commons/text/StrBuilderTest.java index c17631a..200c255 100644 --- a/src/test/java/org/apache/commons/text/StrBuilderTest.java +++ b/src/test/java/org/apache/commons/text/StrBuilderTest.java @@ -514,24 +514,28 @@ public class StrBuilderTest { sb.getChars(-1, 0, a, 0); fail("no exception"); } catch (final IndexOutOfBoundsException e) { + // expected } try { sb.getChars(0, -1, a, 0); fail("no exception"); } catch (final IndexOutOfBoundsException e) { + // expected } try { sb.getChars(0, 20, a, 0); fail("no exception"); } catch (final IndexOutOfBoundsException e) { + // expected } try { sb.getChars(4, 2, a, 0); fail("no exception"); } catch (final IndexOutOfBoundsException e) { + // expected } } @@ -701,6 +705,7 @@ public class StrBuilderTest { sb.replace(2, 1, "anything"); fail("Expected IndexOutOfBoundsException"); } catch (final IndexOutOfBoundsException e) { + // expected } sb = new StrBuilder(); @@ -708,11 +713,13 @@ public class StrBuilderTest { sb.replace(1, 2, "anything"); fail("Expected IndexOutOfBoundsException"); } catch (final IndexOutOfBoundsException e) { + // expected } try { sb.replace(-1, 1, "anything"); fail("Expected IndexOutOfBoundsException"); } catch (final IndexOutOfBoundsException e) { + // expected } } @@ -978,6 +985,7 @@ public class StrBuilderTest { sb.replace(StrMatcher.stringMatcher("aa"), "-", 11, sb.length(), -1); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } assertEquals("aaxaaaayaa", sb.toString()); @@ -986,6 +994,7 @@ public class StrBuilderTest { sb.replace(StrMatcher.stringMatcher("aa"), "-", -1, sb.length(), -1); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } assertEquals("aaxaaaayaa", sb.toString()); } @@ -1041,6 +1050,7 @@ public class StrBuilderTest { sb.replace(StrMatcher.stringMatcher("aa"), "-", 2, 1, -1); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } assertEquals("aaxaaaayaa", sb.toString()); } @@ -1665,26 +1675,31 @@ public class StrBuilderTest { reader.read(array, -1, 0); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } try { reader.read(array, 0, -1); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } try { reader.read(array, 100, 1); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } try { reader.read(array, 0, 100); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } try { reader.read(array, Integer.MAX_VALUE, Integer.MAX_VALUE); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } assertEquals(0, reader.read(array, 0, 0)); diff --git a/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java index 16209f2..8ca3667 100644 --- a/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java +++ b/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java @@ -67,6 +67,7 @@ public class StringEscapeUtilsTest { } catch (final IOException ex) { fail("Exception expected!"); } catch (final IllegalArgumentException ex) { + // expected } try { StringEscapeUtils.ESCAPE_JAVA.translate("", null); @@ -74,6 +75,7 @@ public class StringEscapeUtilsTest { } catch (final IOException ex) { fail("Exception expected!"); } catch (final IllegalArgumentException ex) { + // expected } assertEscapeJava("", "", "empty string"); @@ -136,6 +138,7 @@ public class StringEscapeUtilsTest { } catch (final IOException ex) { fail("Exception expected!"); } catch (final IllegalArgumentException ex) { + // expected } try { StringEscapeUtils.UNESCAPE_JAVA.translate("", null); @@ -143,6 +146,7 @@ public class StringEscapeUtilsTest { } catch (final IOException ex) { fail("Exception expected!"); } catch (final IllegalArgumentException ex) { + // expected } assertThrows(RuntimeException.class, () -> StringEscapeUtils.unescapeJava("\\u02-3")); @@ -187,6 +191,7 @@ public class StringEscapeUtilsTest { } catch (final IOException ex) { fail("Exception expected!"); } catch (final IllegalArgumentException ex) { + // expected } try { StringEscapeUtils.ESCAPE_ECMASCRIPT.translate("", null); @@ -194,6 +199,7 @@ public class StringEscapeUtilsTest { } catch (final IOException ex) { fail("Exception expected!"); } catch (final IllegalArgumentException ex) { + // expected } assertEquals("He didn\\'t say, \\\"stop!\\\"", StringEscapeUtils.escapeEcmaScript("He didn't say, \"stop!\"")); @@ -232,6 +238,7 @@ public class StringEscapeUtilsTest { try { StringEscapeUtils.ESCAPE_HTML3.translate(original, sw); } catch (final IOException e) { + // expected } final String actual = original == null ? null : sw.toString(); assertEquals(expected, actual, message); @@ -250,6 +257,7 @@ public class StringEscapeUtilsTest { try { StringEscapeUtils.UNESCAPE_HTML3.translate(original, sw); } catch (final IOException e) { + // expected } final String actual = original == null ? null : sw.toString(); assertEquals(expected, actual, message); @@ -276,6 +284,7 @@ public class StringEscapeUtilsTest { try { StringEscapeUtils.ESCAPE_HTML4.translate(original, sw); } catch (final IOException e) { + // expected } final String actual = original == null ? null : sw.toString(); assertEquals(expected, actual, message); @@ -294,6 +303,7 @@ public class StringEscapeUtilsTest { try { StringEscapeUtils.UNESCAPE_HTML4.translate(original, sw); } catch (final IOException e) { + // expected } final String actual = original == null ? null : sw.toString(); assertEquals(expected, actual, message); @@ -554,6 +564,7 @@ public class StringEscapeUtilsTest { } catch (final IOException ex) { fail("Exception expected!"); } catch (final IllegalArgumentException ex) { + // expected } try { StringEscapeUtils.ESCAPE_JSON.translate("", null); @@ -561,6 +572,7 @@ public class StringEscapeUtilsTest { } catch (final IOException ex) { fail("Exception expected!"); } catch (final IllegalArgumentException ex) { + // expected } assertEquals("He didn't say, \\\"stop!\\\"", StringEscapeUtils.escapeJson("He didn't say, \"stop!\"")); diff --git a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java index 8edcbd7..bb62a01 100644 --- a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java +++ b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java @@ -514,24 +514,28 @@ public class TextStringBuilderTest { sb.getChars(-1, 0, a, 0); fail("no exception"); } catch (final IndexOutOfBoundsException e) { + // expected } try { sb.getChars(0, -1, a, 0); fail("no exception"); } catch (final IndexOutOfBoundsException e) { + // expected } try { sb.getChars(0, 20, a, 0); fail("no exception"); } catch (final IndexOutOfBoundsException e) { + // expected } try { sb.getChars(4, 2, a, 0); fail("no exception"); } catch (final IndexOutOfBoundsException e) { + // expected } } @@ -701,6 +705,7 @@ public class TextStringBuilderTest { sb.replace(2, 1, "anything"); fail("Expected IndexOutOfBoundsException"); } catch (final IndexOutOfBoundsException e) { + // expected } sb = new TextStringBuilder(); @@ -708,11 +713,13 @@ public class TextStringBuilderTest { sb.replace(1, 2, "anything"); fail("Expected IndexOutOfBoundsException"); } catch (final IndexOutOfBoundsException e) { + // expected } try { sb.replace(-1, 1, "anything"); fail("Expected IndexOutOfBoundsException"); } catch (final IndexOutOfBoundsException e) { + // expected } } @@ -978,6 +985,7 @@ public class TextStringBuilderTest { sb.replace(StringMatcherFactory.INSTANCE.stringMatcher("aa"), "-", 11, sb.length(), -1); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } assertEquals("aaxaaaayaa", sb.toString()); @@ -986,6 +994,7 @@ public class TextStringBuilderTest { sb.replace(StringMatcherFactory.INSTANCE.stringMatcher("aa"), "-", -1, sb.length(), -1); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } assertEquals("aaxaaaayaa", sb.toString()); } @@ -1041,6 +1050,7 @@ public class TextStringBuilderTest { sb.replace(StringMatcherFactory.INSTANCE.stringMatcher("aa"), "-", 2, 1, -1); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } assertEquals("aaxaaaayaa", sb.toString()); } @@ -1666,26 +1676,31 @@ public class TextStringBuilderTest { reader.read(array, -1, 0); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } try { reader.read(array, 0, -1); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } try { reader.read(array, 100, 1); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } try { reader.read(array, 0, 100); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } try { reader.read(array, Integer.MAX_VALUE, Integer.MAX_VALUE); fail("Exception expected!"); } catch (final IndexOutOfBoundsException ex) { + // expected } assertEquals(0, reader.read(array, 0, 0));