How can I test database access methods in Java?
- by javaStudent
I want to write a test for a method that accesses a database such as following.
public class MyClass{
public String getAddress(Int id){
String query = "Select * from Address where id="+id;
//some additional statements
resultSet = statement.executeQuery();
return result.getString(ADDRESS);
}
}
How can I test this method? I am using Java.