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 0ACD1D4A7 for ; Wed, 21 Nov 2012 01:08:03 +0000 (UTC) Received: (qmail 47854 invoked by uid 500); 21 Nov 2012 01:08:02 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 47801 invoked by uid 500); 21 Nov 2012 01:08:02 -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 47792 invoked by uid 99); 21 Nov 2012 01:08:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Nov 2012 01:08:02 +0000 X-ASF-Spam-Status: No, hits=2.8 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URIBL_BLACK X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of willem.jiang@gmail.com designates 209.85.220.45 as permitted sender) Received: from [209.85.220.45] (HELO mail-pa0-f45.google.com) (209.85.220.45) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Nov 2012 01:07:56 +0000 Received: by mail-pa0-f45.google.com with SMTP id bg2so2204029pad.32 for ; Tue, 20 Nov 2012 17:07:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:x-mailer :mime-version:content-type:content-transfer-encoding :content-disposition; bh=ZPHN7IihePOTAreRiM5sU589YIrMzEktDOCxHuZO+/Q=; b=spkX1okNu4jLSW4wFaHpZdtGlxpjcaQiocSLNn84+glIHcE46rw6UOpKOUuK4NSoHy p4NeMjpaNKG2RqFjs/8MKLDc28Fo4Tw2Edumd/kY9DM3GHuUWC8acnHk4jS943t8x+Lu 00uxlXFFv0K+MyAou/gnStYfe37p4ODsVaAs+G91xaEs1bDDGNC6N3mdd055Cyqu4BTY L2jNHjZw9ydPkcvIuer0Ir/QD7OYf2hDykImtl3FNkAX86XJLhURqifRog68CiXEyMvC 88G+C3xM/8y3J5eE71ff5SBcv84hfpZQYXa/zvEmgZNbREGhz3IdEqsP+PhpRJpXGcUg X7SQ== Received: by 10.66.87.202 with SMTP id ba10mr13009206pab.72.1353460055002; Tue, 20 Nov 2012 17:07:35 -0800 (PST) Received: from [192.168.1.135] ([123.116.34.159]) by mx.google.com with ESMTPS id ok3sm8914029pbb.11.2012.11.20.17.07.32 (version=SSLv3 cipher=OTHER); Tue, 20 Nov 2012 17:07:34 -0800 (PST) Date: Wed, 21 Nov 2012 09:07:26 +0800 From: Willem jiang To: dev@camel.apache.org Message-ID: In-Reply-To: References: Subject: Re: Any good reason why make use of the java.io.File.getAbsoluteFile() API inside the unit-tests X-Mailer: sparrow 1.6.4 (build 1176) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org +1 to remove that to save us some testing time :) -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: willemjiang On Tuesday, November 20, 2012 at 6:08 PM, Babak Vahdat wrote: > 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