This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Testing and the fly likes Original Void Method is called when using Mockito.doNothing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Original Void Method is called when using Mockito.doNothing " Watch "Original Void Method is called when using Mockito.doNothing " New topic
Author

Original Void Method is called when using Mockito.doNothing

gayathri murugesan
Ranch Hand

Joined: Dec 21, 2009
Posts: 32
Hi,

I am new to JUnit Testing.I have a void DB call which i need to mock.

In the method i need to test,

I have


DBTester db = new DBTester();
db.method();



DBTester mockobj = Mockito.mock(DBTester.class);
Mockito.doNothing().when(mockObj).method((BigInteger)Mockito.anyObject(), (BigInteger)Mockito.anyObject(), (obj)Mockito.anyObject());

In have added in the annotation

@PrepareForTest({DBTester.class})

But it hits the original DB Call.Can someone please throw light on where i am going wrong

Thanks in advance

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Original Void Method is called when using Mockito.doNothing
 
Similar Threads
BigInteger and multiplying
Help! Question on converting String to BigInteger
Need help with RSA Encryption
DBTester and DBTestRunner in Max's book
BigInteger Operations