users
[Top] [All Lists]

RE: [cinjug-users] File Mocks

To: "'CinJug'" <users@xxxxxxxxxx>
Subject: RE: [cinjug-users] File Mocks
From: "Scott T Weaver" <sweaver@xxxxxxxxxxxxxxx>
Date: Thu, 17 Nov 2005 12:51:16 -0500
Delivered-to: mailing list users@cinjug.org
In-reply-to: <E086EA31-A3F3-401B-BA40-213C0A05B976@gmail.com>
Mailing-list: contact users-help@cinjug.org; run by ezmlm
Thread-index: AcXrnxtIVWGFZHJDS9WI7ku6tnvXuQAADcUA
Honestly, I prefer JMock to EasyMock.  Also JMock supports class mocking via
CGLIB.  This might be something worth checking out:
http://jmock.org/cglib.html.

Hth,
-Scott

> -----Original Message-----
> From: Mark Windholtz [mailto:windholtz@xxxxxxxxx]
> Sent: Thursday, November 17, 2005 12:48 PM
> To: CinJug
> Subject: Re: [cinjug-users] File Mocks
> 
> 
> On Nov 17, 2005, at 07:57 AM, James Carman wrote:
> > You'd probably have to do a LOT of work to get the mock to work
> > correctly
> >
> 
> Yup, I know.
> But hey, programmers are used to working hard. :-)
> 
> When your dealing with an API without interfaces you just /have/
> to work hard to break dependencies.
> 
> Luckily, File and it's methods are not 'final'.
> So another possibility is to subclass File and over-ride the methods
> you are
> interested in on a test-by-test basis.   (this technique is often
> called a "shunt").
> Inner classes can be used for creating the shunt.
> 
> If your only using a few File methods over-riding is a good enough
> option.
> But then you still have to build an injection mechanizum to get the
> shunted File
> from the test into the target.
> 
> >
> > -----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
> >
> >
> 
> 
> 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



<Prev in Thread] Current Thread [Next in Thread>