This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JUnit Test Query

 
Karthik Sanghvi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I have a Implementation Class AccountServiceImpl.java



that implements accountService interface.






I want to write a JUnit test to test the credit limit at the time of withdrawal for any account.


Please help
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's stopping you? What do you have so far?

Because you've coded to an implementation, the DAO isn't injectable. If you want to make the service testable, the DAO should be mockable such that you can test *just* the logic in the withdraw() method.

(I know it's just an example, or at least I assume it is, but the credit limit logic is (a) hardcoded, and (b) likely in the wrong place.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic