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-io.git
The following commit(s) were added to refs/heads/master by this push:
new 526b3154f Fix test fixture
526b3154f is described below
commit 526b3154f14c833b7254080eb7de2d3c348b6fae
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Feb 20 08:30:17 2025 -0500
Fix test fixture
---
.../java/org/apache/commons/io/FileUtilsTest.java | 36 +++++++++++-----------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/test/java/org/apache/commons/io/FileUtilsTest.java
b/src/test/java/org/apache/commons/io/FileUtilsTest.java
index 7551192b2..bd31ee2da 100644
--- a/src/test/java/org/apache/commons/io/FileUtilsTest.java
+++ b/src/test/java/org/apache/commons/io/FileUtilsTest.java
@@ -2815,7 +2815,7 @@ public void
testReadFileToString_IOExceptionOnPosixFileSystem() throws Exception
@Test
public void testReadFileToStringWithDefaultEncoding() throws Exception {
final File file = new File(tempDirFile, "read.obj");
- final String fixture = "Hello /u1234";
+ final String fixture = "Hello \u1234";
Files.write(file.toPath(), fixture.getBytes());
assertEquals(fixture, FileUtils.readFileToString(file));
@@ -2824,18 +2824,18 @@ public void testReadFileToStringWithDefaultEncoding()
throws Exception {
@Test
public void testReadFileToStringWithEncoding() throws Exception {
final File file = new File(tempDirFile, "read.obj");
- final byte[] text = "Hello /u1234".getBytes(StandardCharsets.UTF_8);
+ final byte[] text = "Hello \u1234".getBytes(StandardCharsets.UTF_8);
Files.write(file.toPath(), text);
final String data = FileUtils.readFileToString(file, "UTF8");
- assertEquals("Hello /u1234", data);
+ assertEquals("Hello \u1234", data);
}
@Test
public void testReadLines() throws Exception {
final File file = TestUtils.newFile(tempDirFile, "lines.txt");
try {
- final String[] data = {"hello", "/u1234", "", "this is", "some
text"};
+ final String[] data = {"hello", "\u1234", "", "this is", "some
text"};
TestUtils.createLineFileUtf8(file, data);
final List<String> lines = FileUtils.readLines(file, UTF_8);
@@ -3270,16 +3270,16 @@ public void
testWriteByteArrayToFile_WithOffsetAndLength_WithAppendOptionTrue_Sh
@Test
public void testWriteCharSequence1() throws Exception {
final File file = new File(tempDirFile, "write.txt");
- FileUtils.write(file, "Hello /u1234", "UTF8");
- final byte[] text = "Hello /u1234".getBytes(StandardCharsets.UTF_8);
+ FileUtils.write(file, "Hello \u1234", "UTF8");
+ final byte[] text = "Hello \u1234".getBytes(StandardCharsets.UTF_8);
TestUtils.assertEqualContent(text, file);
}
@Test
public void testWriteCharSequence2() throws Exception {
final File file = new File(tempDirFile, "write.txt");
- FileUtils.write(file, "Hello /u1234", (String) null);
- final byte[] text = "Hello /u1234".getBytes();
+ FileUtils.write(file, "Hello \u1234", (String) null);
+ final byte[] text = "Hello \u1234".getBytes();
TestUtils.assertEqualContent(text, file);
}
@@ -3489,8 +3489,8 @@ public void
testWriteStringToFile_WithAppendOptionTrue_ShouldNotDeletePreviousFi
@Test
public void testWriteStringToFileIntoNonExistentSubdir() throws Exception {
final File file = new File(tempDirFile, "subdir/write.txt");
- FileUtils.writeStringToFile(file, "Hello /u1234", (Charset) null);
- final byte[] text = "Hello /u1234".getBytes();
+ FileUtils.writeStringToFile(file, "Hello \u1234", (Charset) null);
+ final byte[] text = "Hello \u1234".getBytes();
TestUtils.assertEqualContent(text, file);
}
@@ -3505,16 +3505,16 @@ public void
testWriteStringToFileIntoNonExistentSubdir() throws Exception {
public void testWriteStringToFileIntoSymlinkedDir() throws Exception {
final Path symlinkDir =
createTempSymbolicLinkedRelativeDir().getLeft();
final File file = symlinkDir.resolve("file").toFile();
- FileUtils.writeStringToFile(file, "Hello /u1234",
StandardCharsets.UTF_8);
- final byte[] text = "Hello /u1234".getBytes();
+ FileUtils.writeStringToFile(file, "Hello \u1234",
StandardCharsets.UTF_8);
+ final byte[] text = "Hello \u1234".getBytes();
TestUtils.assertEqualContent(text, file);
}
@Test
public void testWriteStringToFileWithCharset() throws Exception {
final File file = new File(tempDirFile, "write.txt");
- FileUtils.writeStringToFile(file, "Hello /u1234", "UTF8");
- final byte[] text = "Hello /u1234".getBytes(StandardCharsets.UTF_8);
+ FileUtils.writeStringToFile(file, "Hello \u1234", "UTF8");
+ final byte[] text = "Hello \u1234".getBytes(StandardCharsets.UTF_8);
TestUtils.assertEqualContent(text, file);
}
@@ -3546,16 +3546,16 @@ public void
testWriteStringToFileWithEncoding_WithAppendOptionTrue_ShouldNotDele
@Test
public void testWriteStringToFileWithNullCharset() throws Exception {
final File file = new File(tempDirFile, "write.txt");
- FileUtils.writeStringToFile(file, "Hello /u1234", (Charset) null);
- final byte[] text = "Hello /u1234".getBytes();
+ FileUtils.writeStringToFile(file, "Hello \u1234", (Charset) null);
+ final byte[] text = "Hello \u1234".getBytes();
TestUtils.assertEqualContent(text, file);
}
@Test
public void testWriteStringToFileWithNullStringCharset() throws Exception {
final File file = new File(tempDirFile, "write.txt");
- FileUtils.writeStringToFile(file, "Hello /u1234", (String) null);
- final byte[] text = "Hello /u1234".getBytes();
+ FileUtils.writeStringToFile(file, "Hello \u1234", (String) null);
+ final byte[] text = "Hello \u1234".getBytes();
TestUtils.assertEqualContent(text, file);
}