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 2026/07/03 19:01:34 UTC
(commons-lang) branch master updated: Sort members.
This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new 02cc21baf Sort members.
02cc21baf is described below
commit 02cc21baf6dc8d5c4536ef3929c9394a0a144e1c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jul 3 19:01:28 2026 +0000
Sort members.
---
.../lang3/text/ExtendedMessageFormatTest.java | 30 +++++++++++-----------
.../text/translate/NumericEntityUnescaperTest.java | 18 ++++++-------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
index 6ea31dcce..630f7e326 100644
--- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
@@ -294,21 +294,6 @@ void testArgumentIndexTrailingWhitespaceAtEnd() {
assertThrowsExactly(IllegalArgumentException.class, () -> new ExtendedMessageFormat("{0 ", new HashMap<>()));
}
- @Test
- void testTruncatedFormatElementWithRegistry() {
- // Sanity check to match JRE
- assertThrowsExactly(IllegalArgumentException.class, () -> new MessageFormat("{"));
- assertThrowsExactly(IllegalArgumentException.class, () -> new MessageFormat("{0,"));
- assertThrowsExactly(IllegalArgumentException.class, () -> new MessageFormat("{0}extra{"));
- // A format element left unterminated at the end of the pattern used to make the
- // registry-based constructor seek one past the buffer and throw
- // ArrayIndexOutOfBoundsException; it should report the documented
- // IllegalArgumentException, as the plain constructor already does.
- assertThrowsExactly(IllegalArgumentException.class, () -> new ExtendedMessageFormat("{", new HashMap<>()));
- assertThrowsExactly(IllegalArgumentException.class, () -> new ExtendedMessageFormat("{0,", new HashMap<>()));
- assertThrowsExactly(IllegalArgumentException.class, () -> new ExtendedMessageFormat("{0}extra{", new HashMap<>()));
- }
-
/**
* Test the built-in choice format.
*/
@@ -533,4 +518,19 @@ void testOverriddenBuiltinFormat2(final Locale locale) {
assertEquals(pattern, dateShort.toPattern(), "overridden date,short pattern");
}
+ @Test
+ void testTruncatedFormatElementWithRegistry() {
+ // Sanity check to match JRE
+ assertThrowsExactly(IllegalArgumentException.class, () -> new MessageFormat("{"));
+ assertThrowsExactly(IllegalArgumentException.class, () -> new MessageFormat("{0,"));
+ assertThrowsExactly(IllegalArgumentException.class, () -> new MessageFormat("{0}extra{"));
+ // A format element left unterminated at the end of the pattern used to make the
+ // registry-based constructor seek one past the buffer and throw
+ // ArrayIndexOutOfBoundsException; it should report the documented
+ // IllegalArgumentException, as the plain constructor already does.
+ assertThrowsExactly(IllegalArgumentException.class, () -> new ExtendedMessageFormat("{", new HashMap<>()));
+ assertThrowsExactly(IllegalArgumentException.class, () -> new ExtendedMessageFormat("{0,", new HashMap<>()));
+ assertThrowsExactly(IllegalArgumentException.class, () -> new ExtendedMessageFormat("{0}extra{", new HashMap<>()));
+ }
+
}
diff --git a/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java b/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java
index 1029e53c2..4142d4997 100644
--- a/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java
@@ -29,6 +29,15 @@
@Deprecated
class NumericEntityUnescaperTest extends AbstractLangTest {
+ @Test
+ void testDecimalEntityFollowedByHexLetter() {
+ // A decimal entity ends at the first non-decimal character, so a following a-f letter is text, not part of the number.
+ final NumericEntityUnescaper neu = new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.semiColonOptional);
+ assertEquals("0abc", neu.translate("0abc"), "Failed to stop a decimal entity at a trailing hex letter");
+ assertEquals("Test 0 not test", neu.translate("Test 0 not test"), "Failed on a decimal entity terminated by a space");
+ assertEquals("0xyz", neu.translate("0xyz"), "Failed on a decimal entity terminated by a non-hex letter");
+ }
+
@Test
void testOutOfBounds() {
final NumericEntityUnescaper neu = new NumericEntityUnescaper();
@@ -55,15 +64,6 @@ void testSupplementaryUnescaping() {
assertEquals(expected, result, "Failed to unescape numeric entities supplementary characters");
}
- @Test
- void testDecimalEntityFollowedByHexLetter() {
- // A decimal entity ends at the first non-decimal character, so a following a-f letter is text, not part of the number.
- final NumericEntityUnescaper neu = new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.semiColonOptional);
- assertEquals("0abc", neu.translate("0abc"), "Failed to stop a decimal entity at a trailing hex letter");
- assertEquals("Test 0 not test", neu.translate("Test 0 not test"), "Failed on a decimal entity terminated by a space");
- assertEquals("0xyz", neu.translate("0xyz"), "Failed on a decimal entity terminated by a non-hex letter");
- }
-
@Test
void testUnfinishedEntity() {
// parse it