This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Testing the action is trivial; use a mock DAO to provide the response you want.
How to test the DAO depends on what you actually want to test.
Joined: Nov 21, 2007
Thanks David Newton for your quick reply.
But still i am having one question..
I want to test username & password from DAO class(validate method)
I am having those values in login table database.
should I check those values in Test class by taking expected data as "hard coded" values? OR how?
Again--it depends on what you're trying to test. If you're trying to test the DAO's interaction with the database, that's a completely different issue (and not really a unit test, at least by my definition--that'd be an integration test). If you want to test your action, you don't *need* to go to the database--and for a unit test, I try to avoid database access because of the additional time overhead it would add.