camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Babak Vahdat <>
Subject Any good reason why make use of the API inside the unit-tests
Date Tue, 20 Nov 2012 10:08:08 GMT

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

Which could simply be modified to

   assertTrue("File should not have been deleted", new

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")"

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.



View raw message