Skip to content

Commit dcf6e82

Browse files
committed
Test if arrays are sorted
1 parent b014a06 commit dcf6e82

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,21 @@
1717

1818
package org.apache.commons.io;
1919

20-
import java.util.Arrays;
21-
2220
import org.junit.Assert;
2321
import org.junit.Test;
2422

2523
public class FileSystemTestCase {
2624

25+
@Test
26+
public void testSorted() {
27+
for (FileSystem fs : FileSystem.values()) {
28+
char[] chars=fs.getIllegalFileNameChars();
29+
for (int i=0; i < chars.length - 1; i++) {
30+
Assert.assertTrue(fs.name(), chars[i] < chars[i+1]);
31+
}
32+
}
33+
}
34+
2735
@Test
2836
public void testToLegalFileNameWindows() {
2937
FileSystem fs = FileSystem.WINDOWS;
@@ -32,8 +40,6 @@ public void testToLegalFileNameWindows() {
3240
Assert.assertEquals(replacement, fs.toLegalFileName(String.valueOf(i), replacement).charAt(0));
3341
}
3442
char[] illegal = new char[] { '<', '>', ':', '"', '/', '\\', '|', '?', '*' };
35-
Arrays.sort(illegal);
36-
System.out.println(Arrays.toString(illegal));
3743
for (char i = 0; i < illegal.length; i++) {
3844
Assert.assertEquals(replacement, fs.toLegalFileName(String.valueOf(i), replacement).charAt(0));
3945
}

0 commit comments

Comments
 (0)