Hi

Looking at unit-tests all over the places we've got *tons* of this API
call, like:

   assertTrue("File should not have been deleted", new
File("target/files/report.txt").getAbsoluteFile().exists());

Which could simply be modified to

   assertTrue("File should not have been deleted", new
File("target/files/report.txt").exists());


The only benefit I see is that using this API you would see the absolute
file/directory path at the stacktraces when the asserts would fail, like:


   File file = new File("target/issue/test.txt").getAbsoluteFile()

   assertTrue("File " + file + " should exist", file.exists());

Note that by the example above we instantiate 2 file handles, one of which
we don't reference at all, which's the "new File("target/issue/test.txt")"
object.

If there's no other advantages I'm missing here I would suggest to remove
all such these calls, as it consumes both the CPU-time as well makes I/O,
not sure though how expensive really these (native OS) calls would be, but
for sure they're not for free.

Thoughts?

Babak




Reply via email to