Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-858

FileUtilsWaitForTest does not test anything useful

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      AFAICT, FileUtilsWaitForTest [1] does not do anything useful currently.

       

      Of the 3 tests, 2 don't check the return status, nor do they appear to be trying to test for Exceptions.

      The 3rd test - testWaitForInterrupted - appears to be testing the response of FileUtils.waitFor() to an interruption. However it does not do so, as the waitFor() target is FileUtils.current() which is  certain to exist. As it stands, AFAICT the test checks if the main thread can interrupt the test thread before it sets the wasInterrupted flag. This currently relies on relative thread timings, so it is not surprising that the test is flaky.

      There should ideally be a test for IO-488, as well as tests for targets that are present or missing or which appear during a wait.

       

      [1] https://github.com/apache/commons-io/blob/master/src/test/java/org/apache/commons/io/FileUtilsWaitForTest.java

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: