Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Newbie question on JMock  RSS feed

 
Neha Gap
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36406
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neha,
Can you introduce an interface to de-couple them?

if not, can you provide an example of how they are tightly coupled?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!