我正在试图模拟测试方法中的内部方法调用
我的类如下所示
public class App {
public Student getStudent() {
MyDAO dao = new MyDAO();
return dao.getStudentDetails();//getStudentDetails is a public
//non-static method in the DAO class
}
当我为方法getStudent()编写junit时,PowerMock中是否有一种方法可以模拟该行?
dao.getStudentDetails();
或者在junit执行期间,使App类使用模拟dao对象而不是实际的dao调用连接到DB?