• 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

Error in executing TestCase

 
Ranch Hand
Posts: 157
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to execute test case using mokito framework, but stuck with few error. Below is my code :



Even I tried use of service instance which giving me NPE. Can anyone tell whats wrong in that.

Thanks
 
Sheriff
Posts: 17652
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your test construction does not look right -- a mock object should simulate what a real collaborator would do. You don't test mock objects, you use them to help you test the behavior of something else. I see nothing in your code that establishes a collaborative relationship between the mock object and the class under test, which I assume is the SalesForceLeadSearch1 implementation, which BTW is a horrible name. In fact, your mock object is the same type as the class under test. That does not look right at all to me. What exactly is the behavior you want to test and why do you think you need a mock?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic