IMO, there is no need for this additional API call.
+1 for removing it.

Best,
Christian

Sent from a mobile device
Am 20.11.2012 19:57 schrieb "Babak Vahdat" <babak.vah...@swissonline.ch>:

>
>
> Am 20.11.12 11:08 schrieb "Babak Vahdat" unter
> <babak.vah...@swissonline.ch>:
>
> >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());
>
> And here one concrete example of this:
>
> https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/a
> pache/camel/builder/xml/XsltBuilderTest.java
>
> There're totally 8 calls to this method! Of course removing all of those
> calls has no effect on the test results, as they all would still pass.
>
> Babak
>
> >
> >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