Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-205

Unit tests can fail when path to project is non-trivial (fix in description)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.5
    • 1.5
    • None
    • None

    Description

      return factory.createCompressorInputStream(new BufferedInputStream(new FileInputStream(new File(rsc.getFile()))));

      can fail to find the files for testing e.g. /root/.jenkins/jobs/Commons%20Compress/workspace/target/test-classes/test.txt (No such file or directory)

      This can be fixed by simply opening the stream from the URL:

      private CompressorInputStream getStreamFor(String resource)
      throws CompressorException, IOException

      { final URL rsc = classLoader.getResource(resource); assertNotNull("Could not find resource "+resource,rsc); return factory.createCompressorInputStream( new BufferedInputStream(rsc.openStream())); }

      Attachments

        1. COMPRESS-205.patch
          4 kB
          Daniel Lowe

        Activity

          People

            Unassigned Unassigned
            dan2097 Daniel Lowe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: