commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [math] stupid question about test input files
Date Thu, 15 May 2003 10:08:15 GMT
IMHO it's often better to support the standard streams and then include 
the test data in the test case as a string. this keeps the data close to 
where it's used.

- robert

On Thursday, May 15, 2003, at 01:13 AM, Phil Steitz wrote:

>
>>
>> If you *really* need disk files, I'd suggest using a
>> relative path from
>> the default directory.  For example, if you had a
>> "src/test/resources"
>> directory in the repository, with a "foo.txt" file
>> in it, the relative
>> path would be:
>>
>>   src/test/resources/foo.txt
>>
>> and this would work no matter where the developer
>> actually had the
>> repository in their own workspace -- and also works
>> portably across
>> platforms courtesy of Java's handling of slashes for
>> you.
>>
>> If you need absolute paths, you can still get one of
>> those as well:
>>
>>   File dir = new File(".");
>>   File file = new File(dir,
>> "src/test/resources/foo.txt");
>>   String path = file.getAbsolutePath();
>>
>> without having to hard code anything.
>>
>>> Phil
>>
>> Craig
>>
>
> OK. I get it now.  Given that the
> ClassLoader.getResourceAsStream() method is simpler,
> and I see no harm in adding APIs to work with Files, I
> think that I will do that.
>
> Thanks for your help.
>
> Phil
>
>
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message