mardi 9 juin 2015

How to write unit test (JUnit) for databse call?

For example, if I have something like this:

try {
 // db call
} catch ( Exception e ) {
 return false
}

I want to write a unit test to test this method. How should I write that? Or to say it differently, what will be an example of code that will cause SQLException or any other exception to be thrown?

Aucun commentaire:

Enregistrer un commentaire