aspose file tools*
The moose likes Testing and the fly likes JUnit Test Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Testing
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://aspose.com/file-tools
 
subject: JUnit Test Query
 
Similar Threads
Basic Query in Spring
Objects and Classes
Hey Can anyone help me with this
JUnit Testing Problem
JUnit Testing Problem