aspose file tools
The moose likes Testing and the fly likes JUnit Test Query Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Reply Bookmark "JUnit Test Query" Watch "JUnit Test Query" New topic
Author

JUnit Test Query

Karthik Sanghvi
Greenhorn

Joined: Nov 06, 2006
Posts: 9
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

Joined: Sep 29, 2008
Posts: 12617

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.)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: JUnit Test Query
 
Similar Threads
JUnit Testing Problem
JUnit Testing Problem
Objects and Classes
Hey Can anyone help me with this
Basic Query in Spring