river-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Hobbs" <tom.ho...@sucfin.com>
Subject RE: Mock Libs...
Date Thu, 30 Apr 2009 13:04:24 GMT
As far as I'm concerned, the reason is the standard one for using mocks.

There was code that needed to be tested that can only be created/used
when it has access to other objects which are not the current test

To isolate the code under test, I created an instance and instead of
passing in real objects to its constructor, I passed in mocks.  This has
the effect of ensuring that no other business code gets executed during
the test run apart from the code currently under test.  

Also, with the mocks, we can supply known and predictable behaviour to
its method calls which the code under test might be reasonably expected
to use.  Obviously, this has the added benefit of preventing any bugs in
the supporting code (which is not being tested) from manifesting
themselves as bugs in the code under test.

Sorry for labouring the point, I'm using this email to answer Peter's
"Whats a mocking Tool?" question as well.

In my experience of writing unit tests for services, there are so many
dependencies that the only way to isolate the code is to make extensive
use of mock objects.

Hopefully that makes sense.


-----Original Message-----
From: Jonathan Costers [mailto:jonathan.costers@googlemail.com] 
Sent: 30 April 2009 13:45
To: river-dev@incubator.apache.org
Subject: Re: Mock Libs...

Would you be able to explain why we need a Mock objects framework for


2009/4/30 Patrick Wright <pdoubleya@gmail.com>

> > Yes I am (was?) using EasyMock, simply because that's what I'm
> > with.  I have never heard of Mockito before, but if you say it is
> > then again, I'm happy to move over to that.
> >
> > Does anyone else have any preferences?
> At our workplace, we've been using JMock for quite some time and are
> very happy with it. We haven't tested the alternatives, not in the
> recent past, at least.
> Regards,
> Patrick


Sucden Financial Limited, Plantation Place South, 60 Great Tower Street, London EC3R 5AZ
Telephone +44 203 207 5000

Registered in England no. 1095841
VAT registration no. GB 446 9061 33

Authorised and Regulated by the Financial Services Authority (FSA) and entered in the FSA
register under no. 114239

This email, including any files transmitted with it, is confidential and may be privileged.
It may be read, copied and used only by the intended recipient. If you are not the intended
recipient of this message, please notify postmaster@sucfin.com immediately and delete it from
your computer system.

We believe, but do not warrant, that this email and its attachments are virus-free, but you
should check.

Sucden Financial Limited may monitor traffic data of both business and personal emails. By
replying to this email, you consent to Sucden Financial 's monitoring the content of any emails
you send to or receive from Sucden Financial . Sucden Financial is not liable for any opinions
expressed by the sender where this is a non-business email.

The contents of this e-mail do not constitute advice and should not be regarded as a recommendation
to buy, sell or otherwise deal with any particular investment.

This message has been scanned for viruses by Mimecast.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message