@@ -229,20 +229,18 @@ public void testFileModified() throws Exception {
229229
230230 @ Test
231231 public void testFileMonitorRestarted () throws Exception {
232- try (FileObject fileObject = fileSystemManager .resolveFile (testFile .toURI ().toString ())) {
233- final DefaultFileMonitor monitor = new DefaultFileMonitor (new TestFileListener ());
232+ try (FileObject fileObject = fileSystemManager .resolveFile (testFile .toURI ().toString ());
233+ DefaultFileMonitor monitor = new DefaultFileMonitor (new TestFileListener ())) {
234234 try {
235235 // TestFileListener manipulates status
236236 monitor .setDelay (DELAY_MILLIS );
237237 monitor .addFile (fileObject );
238-
239238 monitor .start ();
240239 writeToFile (testFile );
241240 Thread .sleep (DELAY_MILLIS * 5 );
242241 } finally {
243242 monitor .stop ();
244243 }
245-
246244 monitor .start ();
247245 try {
248246 testFile .delete ();
@@ -255,23 +253,22 @@ public void testFileMonitorRestarted() throws Exception {
255253
256254 @ Test
257255 public void testFileRecreated () throws Exception {
258- try (FileObject fileObject = fileSystemManager .resolveFile (testFile .toURI ())) {
259- try (DefaultFileMonitor monitor = new DefaultFileMonitor (new TestFileListener ())) {
260- // TestFileListener manipulates status
261- monitor .setDelay (DELAY_MILLIS );
262- monitor .addFile (fileObject );
263- monitor .start ();
264- writeToFile (testFile );
265- waitFor (Status .CREATED , DELAY_MILLIS * 10 , PeekLocation .LAST );
266- resetStatus ();
267- testFile .delete ();
268- waitFor (Status .DELETED , DELAY_MILLIS * 10 , PeekLocation .LAST );
269- resetStatus ();
270- Thread .sleep (DELAY_MILLIS * 5 );
271- monitor .addFile (fileObject );
272- writeToFile (testFile );
273- waitFor (Status .CREATED , DELAY_MILLIS * 10 , PeekLocation .LAST );
274- }
256+ try (FileObject fileObject = fileSystemManager .resolveFile (testFile .toURI ());
257+ DefaultFileMonitor monitor = new DefaultFileMonitor (new TestFileListener ())) {
258+ // TestFileListener manipulates status
259+ monitor .setDelay (DELAY_MILLIS );
260+ monitor .addFile (fileObject );
261+ monitor .start ();
262+ writeToFile (testFile );
263+ waitFor (Status .CREATED , DELAY_MILLIS * 10 , PeekLocation .LAST );
264+ resetStatus ();
265+ testFile .delete ();
266+ waitFor (Status .DELETED , DELAY_MILLIS * 10 , PeekLocation .LAST );
267+ resetStatus ();
268+ Thread .sleep (DELAY_MILLIS * 5 );
269+ monitor .addFile (fileObject );
270+ writeToFile (testFile );
271+ waitFor (Status .CREATED , DELAY_MILLIS * 10 , PeekLocation .LAST );
275272 }
276273 }
277274
0 commit comments