Skip to content

Commit 013b67a

Browse files
author
Gary Gregory
committed
Sort test members
1 parent 10079fd commit 013b67a

5 files changed

Lines changed: 41 additions & 41 deletions

File tree

src/test/java/org/apache/commons/io/FileUtilsDeleteDirectoryBaseTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public abstract class FileUtilsDeleteDirectoryBaseTest {
3737

3838
protected abstract boolean setupSymlink(final File res, final File link) throws Exception;
3939

40+
@Test
41+
public void testDeleteDirectoryNullArgument() {
42+
assertThrows(NullPointerException.class, () -> FileUtils.deleteDirectory(null));
43+
}
44+
4045
@Test
4146
public void testDeleteDirWithASymlinkDir() throws Exception {
4247

@@ -250,9 +255,4 @@ public void testDeletesRegular() throws Exception {
250255
assertEquals(0, top.list().length);
251256
}
252257

253-
@Test
254-
public void testDeleteDirectoryNullArgument() {
255-
assertThrows(NullPointerException.class, () -> FileUtils.deleteDirectory(null));
256-
}
257-
258258
}

src/test/java/org/apache/commons/io/FileUtilsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@
8989
@SuppressWarnings({"deprecation", "ResultOfMethodCallIgnored"}) // unit tests include tests of many deprecated methods
9090
public class FileUtilsTest extends AbstractTempDirTest {
9191

92-
private static final String UTF_8 = StandardCharsets.UTF_8.name();
93-
9492
/**
9593
* DirectoryWalker implementation that recursively lists all files and directories.
9694
*/
@@ -133,6 +131,8 @@ public long length() {
133131
}
134132
}
135133

134+
private static final String UTF_8 = StandardCharsets.UTF_8.name();
135+
136136
/** Test data. */
137137
private static final long DATE3 = 1000000002000L;
138138

src/test/java/org/apache/commons/io/IOUtilsTest.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -624,25 +624,6 @@ public void testContentEqualsIgnoreEOL() throws Exception {
624624
testSingleEOL("1235", "1234", false);
625625
}
626626

627-
public void testSingleEOL(final String s1, final String s2, final boolean ifEquals) throws IOException {
628-
assertEquals(ifEquals, IOUtils.contentEqualsIgnoreEOL(
629-
new CharArrayReader(s1.toCharArray()),
630-
new CharArrayReader(s2.toCharArray())
631-
), "failed at :{" + s1 + "," + s2 + "}");
632-
assertEquals(ifEquals, IOUtils.contentEqualsIgnoreEOL(
633-
new CharArrayReader(s2.toCharArray()),
634-
new CharArrayReader(s1.toCharArray())
635-
), "failed at :{" + s2 + "," + s1 + "}");
636-
assertTrue(IOUtils.contentEqualsIgnoreEOL(
637-
new CharArrayReader(s1.toCharArray()),
638-
new CharArrayReader(s1.toCharArray())
639-
),"failed at :{" + s1 + "," + s1 + "}");
640-
assertTrue(IOUtils.contentEqualsIgnoreEOL(
641-
new CharArrayReader(s2.toCharArray()),
642-
new CharArrayReader(s2.toCharArray())
643-
), "failed at :{" + s2 + "," + s2 + "}");
644-
}
645-
646627
@Test
647628
public void testCopy_ByteArray_OutputStream() throws Exception {
648629
final File destination = TestUtils.newFile(temporaryFolder, "copy8.txt");
@@ -1160,8 +1141,6 @@ public void testResourceToString_ExistingResourceAtSubPackage() throws Exception
11601141
assertEquals(fileSize, content.getBytes().length);
11611142
}
11621143

1163-
// Tests from IO-305
1164-
11651144
@Test
11661145
public void testResourceToString_ExistingResourceAtSubPackage_WithClassLoader() throws Exception {
11671146
final long fileSize = TestResources.getFile("FileUtilsTestDataCR.dat").length();
@@ -1172,6 +1151,8 @@ public void testResourceToString_ExistingResourceAtSubPackage_WithClassLoader()
11721151
assertEquals(fileSize, content.getBytes().length);
11731152
}
11741153

1154+
// Tests from IO-305
1155+
11751156
@Test
11761157
public void testResourceToString_NonExistingResource() {
11771158
assertThrows(IOException.class,
@@ -1259,6 +1240,25 @@ public void testResourceToURL_Null_WithClassLoader() {
12591240
assertThrows(NullPointerException.class, () -> IOUtils.resourceToURL(null, ClassLoader.getSystemClassLoader()));
12601241
}
12611242

1243+
public void testSingleEOL(final String s1, final String s2, final boolean ifEquals) throws IOException {
1244+
assertEquals(ifEquals, IOUtils.contentEqualsIgnoreEOL(
1245+
new CharArrayReader(s1.toCharArray()),
1246+
new CharArrayReader(s2.toCharArray())
1247+
), "failed at :{" + s1 + "," + s2 + "}");
1248+
assertEquals(ifEquals, IOUtils.contentEqualsIgnoreEOL(
1249+
new CharArrayReader(s2.toCharArray()),
1250+
new CharArrayReader(s1.toCharArray())
1251+
), "failed at :{" + s2 + "," + s1 + "}");
1252+
assertTrue(IOUtils.contentEqualsIgnoreEOL(
1253+
new CharArrayReader(s1.toCharArray()),
1254+
new CharArrayReader(s1.toCharArray())
1255+
),"failed at :{" + s1 + "," + s1 + "}");
1256+
assertTrue(IOUtils.contentEqualsIgnoreEOL(
1257+
new CharArrayReader(s2.toCharArray()),
1258+
new CharArrayReader(s2.toCharArray())
1259+
), "failed at :{" + s2 + "," + s2 + "}");
1260+
}
1261+
12621262
@Test
12631263
public void testSkip_FileReader() throws Exception {
12641264
try (Reader in = Files.newBufferedReader(testFilePath)) {

src/test/java/org/apache/commons/io/function/IOPredicateTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ public void testAsPredicate() throws IOException {
9191
assertFalse(IS_HIDDEN.test(PATH_FIXTURE));
9292
}
9393

94+
@Test
95+
public void testFalse() throws IOException {
96+
assertFalse(Constants.IO_PREDICATE_FALSE.test("A"));
97+
// Make sure we keep the argument type
98+
final IOPredicate<String> alwaysFalse = IOPredicate.alwaysFalse();
99+
assertFalse(alwaysFalse.test("A"));
100+
}
101+
94102
@Test
95103
public void testIsEqualChecked() throws IOException {
96104
assertThrowsChecked(() -> IOPredicate.isEqual(THROWING_EQUALS).test("B"));
@@ -147,14 +155,6 @@ public void testTestUnchecked() {
147155
assertTrue(Constants.IO_PREDICATE_TRUE.asPredicate().test("A"));
148156
}
149157

150-
@Test
151-
public void testFalse() throws IOException {
152-
assertFalse(Constants.IO_PREDICATE_FALSE.test("A"));
153-
// Make sure we keep the argument type
154-
final IOPredicate<String> alwaysFalse = IOPredicate.alwaysFalse();
155-
assertFalse(alwaysFalse.test("A"));
156-
}
157-
158158
@Test
159159
public void testTrue() throws IOException {
160160
assertTrue(Constants.IO_PREDICATE_TRUE.test("A"));

src/test/java/org/apache/commons/io/output/WriterOutputStreamTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public void testLargeUTF8WithSingleByteWrite() throws IOException {
7979
testWithSingleByteWrite(LARGE_TEST_STRING, UTF_8);
8080
}
8181

82+
@Test
83+
public void testNullCharsetDecoderWithSingleByteWrite() throws IOException {
84+
testWithSingleByteWrite(TEST_STRING, (CharsetDecoder) null);
85+
}
86+
8287
@Test
8388
public void testNullCharsetNameWithSingleByteWrite() throws IOException {
8489
testWithSingleByteWrite(TEST_STRING, (String) null);
@@ -89,11 +94,6 @@ public void testNullCharsetWithSingleByteWrite() throws IOException {
8994
testWithSingleByteWrite(TEST_STRING, (Charset) null);
9095
}
9196

92-
@Test
93-
public void testNullCharsetDecoderWithSingleByteWrite() throws IOException {
94-
testWithSingleByteWrite(TEST_STRING, (CharsetDecoder) null);
95-
}
96-
9797
@Test
9898
public void testUTF16BEWithBufferedWrite() throws IOException {
9999
testWithBufferedWrite(TEST_STRING, UTF_16BE);

0 commit comments

Comments
 (0)