• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Original Void Method is called when using Mockito.doNothing

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic