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-text.git
The following commit(s) were added to refs/heads/master by this push:
new d649eebd Sort members
d649eebd is described below
commit d649eebdda6639b69e52975f9c3effc60ccb3a5d
Author: Gary Gregory <[email protected]>
AuthorDate: Tue Jun 2 06:49:10 2026 -0400
Sort members
---
.../commons/text/TextStringBuilderClearTest.java | 28 +++++++++++-----------
.../commons/text/lookup/FileStringLookupTest.java | 26 ++++++++++----------
2 files changed, 27 insertions(+), 27 deletions(-)
diff --git
a/src/test/java/org/apache/commons/text/TextStringBuilderClearTest.java
b/src/test/java/org/apache/commons/text/TextStringBuilderClearTest.java
index 7bf1b41a..403e19ff 100644
--- a/src/test/java/org/apache/commons/text/TextStringBuilderClearTest.java
+++ b/src/test/java/org/apache/commons/text/TextStringBuilderClearTest.java
@@ -56,20 +56,6 @@ public class TextStringBuilderClearTest {
return false;
}
- @Test
- public void testDeserializedBuilderHasNoStaleBufferContent() throws
Exception {
- final TextStringBuilder sb = new
TextStringBuilder("secret_password_xyzzy");
- sb.clear();
- sb.append("safe");
- final byte[] serialized = SerializationUtils.serialize(sb);
- final TextStringBuilder sb2;
- try (ObjectInputStream ois = new ObjectInputStream(new
ByteArrayInputStream(serialized))) {
- sb2 = (TextStringBuilder) ois.readObject();
- }
- final String bufContent = new String(sb2.getBuffer());
- assertFalse(bufContent.contains("secret_password"), "Deserialized
buffer must not contain stale chars: " + bufContent);
- }
-
@Test
void testDeleteShrinkLeavesNoResidue() {
final String string = "SECRET_PASSWORD_DATA";
@@ -85,6 +71,20 @@ public class TextStringBuilderClearTest {
}
}
+ @Test
+ public void testDeserializedBuilderHasNoStaleBufferContent() throws
Exception {
+ final TextStringBuilder sb = new
TextStringBuilder("secret_password_xyzzy");
+ sb.clear();
+ sb.append("safe");
+ final byte[] serialized = SerializationUtils.serialize(sb);
+ final TextStringBuilder sb2;
+ try (ObjectInputStream ois = new ObjectInputStream(new
ByteArrayInputStream(serialized))) {
+ sb2 = (TextStringBuilder) ois.readObject();
+ }
+ final String bufContent = new String(sb2.getBuffer());
+ assertFalse(bufContent.contains("secret_password"), "Deserialized
buffer must not contain stale chars: " + bufContent);
+ }
+
@Test
public void testReadFromReaderDoesNotExposeStaleInternalBuffer() throws
IOException {
final TextStringBuilder sb = new TextStringBuilder();
diff --git
a/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java
b/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java
index 301dd609..1f0f0a60 100644
--- a/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java
+++ b/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java
@@ -119,6 +119,19 @@ public class FileStringLookupTest {
testFence(expectedString, fileStringLookup);
}
+ @Test
+ void testFenceEmptyOne() throws Exception {
+ final String expectedString = readDocumentFixtureString();
+ assertEquals(expectedString, new
FileStringLookup().apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties"));
+ }
+
+ @Test
+ void testFenceNullOne() throws Exception {
+ final String expectedString = readDocumentFixtureString();
+ assertEquals(expectedString,
+ new FileStringLookup((Path[])
null).apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties"));
+ }
+
@Test
void testFenceRelativeParentTraversal(@TempDir final Path tempDir) throws
Exception {
// A real, readable file that lives outside the fence but is reachable
from the working
@@ -141,19 +154,6 @@ public class FileStringLookupTest {
assertEquals(expectedString,
fileStringLookup.apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties"));
}
- @Test
- void testFenceEmptyOne() throws Exception {
- final String expectedString = readDocumentFixtureString();
- assertEquals(expectedString, new
FileStringLookup().apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties"));
- }
-
- @Test
- void testFenceNullOne() throws Exception {
- final String expectedString = readDocumentFixtureString();
- assertEquals(expectedString,
- new FileStringLookup((Path[])
null).apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties"));
- }
-
@Test
void testInterpolatorReplace() throws IOException {
final StringSubstitutor stringSubstitutor =
StringSubstitutor.createInterpolator();