@@ -269,9 +269,8 @@ private String getName() {
269269
270270 private void iterateFilesAndDirs (final File dir , final IOFileFilter fileFilter ,
271271 final IOFileFilter dirFilter , final Collection <File > expectedFilesAndDirs ) {
272- final Iterator <File > iterator ;
272+ final Iterator <File > iterator = FileUtils . iterateFilesAndDirs ( dir , fileFilter , dirFilter ) ;
273273 int filesCount = 0 ;
274- iterator = FileUtils .iterateFilesAndDirs (dir , fileFilter , dirFilter );
275274 try {
276275 final List <File > actualFiles = new ArrayList <>();
277276 while (iterator .hasNext ()) {
@@ -288,7 +287,7 @@ private void iterateFilesAndDirs(final File dir, final IOFileFilter fileFilter,
288287 }
289288 }
290289
291- void openOutputStream_noParent (final boolean createFile ) throws Exception {
290+ private void openOutputStream_noParent (final boolean createFile ) throws Exception {
292291 final File file = new File ("test.txt" );
293292 assertNull (file .getParentFile ());
294293 try {
@@ -308,12 +307,6 @@ void openOutputStream_noParent(final boolean createFile) throws Exception {
308307
309308 private boolean setLastModifiedMillis (final File testFile , final long millis ) {
310309 return testFile .setLastModified (millis );
311- // try {
312- // Files.setLastModifiedTime(testFile.toPath(), FileTime.fromMillis(millis));
313- // } catch (IOException e) {
314- // return false;
315- // }
316- // return true;
317310 }
318311
319312 @ BeforeEach
@@ -1210,17 +1203,14 @@ public void testCopyFileLarge() throws Exception {
12101203 final File largeFile = new File (tempDirFile , "large.txt" );
12111204 final File destination = new File (tempDirFile , "copylarge.txt" );
12121205
1213- System .out .println ("START: " + new java .util .Date ());
12141206 if (!largeFile .getParentFile ().exists ()) {
12151207 fail ("Cannot create file " + largeFile
12161208 + " as the parent directory does not exist" );
12171209 }
12181210 try (final OutputStream output = new BufferedOutputStream (Files .newOutputStream (largeFile .toPath ()))) {
12191211 TestUtils .generateTestData (output , FileUtils .ONE_GB );
12201212 }
1221- System .out .println ("CREATED: " + new java .util .Date ());
12221213 FileUtils .copyFile (largeFile , destination );
1223- System .out .println ("COPIED: " + new java .util .Date ());
12241214
12251215 assertTrue (destination .exists (), "Check Exist" );
12261216 assertEquals (largeFile .length (), destination .length (), "Check Full copy" );
@@ -1367,7 +1357,6 @@ public void testCopyURLToFileWithTimeout() throws Exception {
13671357 InputStream resStream = getClass ().getResourceAsStream (resourceName );) {
13681358 assertTrue (IOUtils .contentEquals (resStream , fis ), "Content is not equal." );
13691359 }
1370- //TODO Maybe test copy to itself like for copyFile()
13711360 }
13721361
13731362 /**
@@ -3023,7 +3012,7 @@ public void testWriteLines_3arg_nullSeparator() throws Exception {
30233012 @ Test
30243013 public void testWriteLines_3argsWithAppendOptionFalse_ShouldDeletePreviousFileLines () throws Exception {
30253014 final File file = TestUtils .newFile (tempDirFile , "lines.txt" );
3026- FileUtils .writeStringToFile (file , "This line was there before you..." );
3015+ FileUtils .writeStringToFile (file , "This line was there before you..." , StandardCharsets . UTF_8 );
30273016
30283017 final List <String > linesToAppend = Arrays .asList ("my first line" , "The second Line" );
30293018 FileUtils .writeLines (file , linesToAppend , false );
@@ -3038,7 +3027,7 @@ public void testWriteLines_3argsWithAppendOptionFalse_ShouldDeletePreviousFileLi
30383027 @ Test
30393028 public void testWriteLines_3argsWithAppendOptionTrue_ShouldNotDeletePreviousFileLines () throws Exception {
30403029 final File file = TestUtils .newFile (tempDirFile , "lines.txt" );
3041- FileUtils .writeStringToFile (file , "This line was there before you..." );
3030+ FileUtils .writeStringToFile (file , "This line was there before you..." , StandardCharsets . UTF_8 );
30423031
30433032 final List <String > linesToAppend = Arrays .asList ("my first line" , "The second Line" );
30443033 FileUtils .writeLines (file , linesToAppend , true );
@@ -3285,7 +3274,7 @@ public void testWriteStringToFileWithNullStringCharset() throws Exception {
32853274 @ Test
32863275 public void testWriteWithEncoding_WithAppendOptionFalse_ShouldDeletePreviousFileLines () throws Exception {
32873276 final File file = TestUtils .newFile (tempDirFile , "lines.txt" );
3288- FileUtils .writeStringToFile (file , "This line was there before you..." );
3277+ FileUtils .writeStringToFile (file , "This line was there before you..." , StandardCharsets . UTF_8 );
32893278
32903279 FileUtils .write (file , "this is brand new data" , (String ) null , false );
32913280
@@ -3297,7 +3286,7 @@ public void testWriteWithEncoding_WithAppendOptionFalse_ShouldDeletePreviousFile
32973286 @ Test
32983287 public void testWriteWithEncoding_WithAppendOptionTrue_ShouldNotDeletePreviousFileLines () throws Exception {
32993288 final File file = TestUtils .newFile (tempDirFile , "lines.txt" );
3300- FileUtils .writeStringToFile (file , "This line was there before you..." );
3289+ FileUtils .writeStringToFile (file , "This line was there before you..." , StandardCharsets . UTF_8 );
33013290
33023291 FileUtils .write (file , "this is brand new data" , (String ) null , true );
33033292
0 commit comments