Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 89B43EE09 for ; Tue, 20 Nov 2012 10:08:56 +0000 (UTC) Received: (qmail 61217 invoked by uid 500); 20 Nov 2012 10:08:55 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 60773 invoked by uid 500); 20 Nov 2012 10:08:55 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 60096 invoked by uid 99); 20 Nov 2012 10:08:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Nov 2012 10:08:53 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [62.179.121.31] (HELO fep11.mx.upcmail.net) (62.179.121.31) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Nov 2012 10:08:44 +0000 Received: from edge04.upcmail.net ([192.168.13.239]) by viefep11-int.chello.at (InterMail vM.8.01.05.05 201-2260-151-110-20120111) with ESMTP id <20121120100820.NRHB2060.viefep11-int.chello.at@edge04.upcmail.net> for ; Tue, 20 Nov 2012 11:08:20 +0100 Received: from [10.0.0.7] ([46.126.159.149]) by edge04.upcmail.net with edge id Rm881k01U3DhZoW04m8LTl; Tue, 20 Nov 2012 11:08:20 +0100 X-SourceIP: 46.126.159.149 X-Authenticated-Sender: babak.vahdat@swissonline.ch User-Agent: Microsoft-MacOutlook/14.14.0.111121 Date: Tue, 20 Nov 2012 11:08:08 +0100 Subject: Any good reason why make use of the java.io.File.getAbsoluteFile() API inside the unit-tests From: Babak Vahdat To: "dev@camel.apache.org" Message-ID: Thread-Topic: Any good reason why make use of the java.io.File.getAbsoluteFile() API inside the unit-tests Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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