Couldn't you write your unit tests so that they create a directory structure
in some temp directory in your setUp() method and then test your file
globbing logic on that directory structure? You could delete the root
directory in your tearDown() method.
-----Original Message-----
From: Brian Bonner [mailto:brian.bonner@xxxxxxxxxxxx]
Sent: Thursday, November 17, 2005 9:30 AM
To: James Carman
Subject: Re: [cinjug-users] File Mocks
Ed, you could use jmock w/ cglib to mock a class.
But as James said, depending upon what you're doing, it might be a lot
of work.
Brian
James Carman wrote:
> Mark,
>
> The problem with using EasyMock is that the java.io.File class is exactly
> that, a class (not an interface). So, it's difficult at best to mock it.
> You would have to come up with a subclass that mocked up the
implementation.
> You'd probably have to do a LOT of work to get the mock to work correctly
> without actually going to the filesystem underneath.
>
> Jim
>
> -----Original Message-----
> From: Mark Windholtz [mailto:windholtz@xxxxxxxxx]
> Sent: Thursday, November 17, 2005 7:41 AM
> To: CinJug
> Subject: Re: [cinjug-users] File Mocks
>
> Edward,
>
> There was an effort a while back to provide Mocks for all standard
> Java APIs,
> but if I'm remembering right, it was stopped shortly after when
> easymock.org was released.
> I couldn't find links to it though.
>
> Could you use EasyMock ?
>
> - Mark
>
>
> On Nov 16, 2005, at 09:17 PM, Edward Sumerfield wrote:
>
>
>> I am writing some file manipulation programs and am having problems
>> with testing them. Anyone know if there are some ways to mock my
>> Files?
>>
>> Ed
>>
>>
>
>
> Regards,
> - Mark Windholtz
> (513) 226-8259
>
> railsstudio.com
>
>
>
> ---------
> You may unsubscribe from this mailing list
> by sending a blank email addressed to:
> users-unsubscribe@xxxxxxxxxx
>
> --
> Find additional help by sending a blank email
> addressed to:
> users-help@xxxxxxxxxx
>
>
>
> ---------
> You may unsubscribe from this mailing list
> by sending a blank email addressed to:
> users-unsubscribe@xxxxxxxxxx
>
> --
> Find additional help by sending a blank email
> addressed to:
> users-help@xxxxxxxxxx
>
>
|