Java Mailing List Archive

http://www.gg3721.com/

Home » user.jmock »

Re: [jmock-user] Newbie question

Steve Freeman

2008-04-22

Replies: Find Java Web Hosting

Author LoginPost Reply
Funny you should mention that, we've been working with Smack which has
the same issues.

The short answer is that we tend not to mock external objects
directly, but wrap them in objects that represent our domain -- which
we do mock. We test external types with a real implementation. In the
case of Jabber it's pretty easy to set up a little local server and
run acceptance tests.

In your case, perhaps the JabberAccountManager should implement an
interface (AccountManager?) which is mocked in the tests for its
clients.

S.

On 22 Apr 2008, at 12:08, NehaP wrote:

>
> Hi,
>
> I have just come across JMock and haven't quite got the hang of it
> yet.
> I have a class called JabberAccountManager. It has a few methods that
> perform account management operations. Every method internally
> creates an
> object of type XMPPConnection (which is a part of an XMPP library)
>
> Now, I want to mock the Jabber server so I need to create a mock
> XMPPConnection object, but my problem is that the class I need to
> test and
> the class I need to mock are tightly coupled. I cannot de-couple
> these since
> there are a lot of issues involved.
>
> Could someone please explain to me how to go about using JMock in a
> case
> like this?
>
> Thanks,
> Neha.
> --
> View this message in context: http://www.nabble.com/Newbie-question-tp16823794p16823794.html
> Sent from the jMock - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>

Steve Freeman
Winner of the Agile Alliance Gordon Pask award 2006

http://www.m3p.co.uk

M3P Limited.
Registered office. 2 Church Street, Burnham, Bucks, SL1 7HZ.
Company registered in England & Wales. Number 03689627



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.