我getAllCustomers在CustomerService课堂上有方法。在这个方法中,我从CustomerDao类中调用另一个静态方法。现在,当我getAllCustomers在customerService类中为方法编写 junit 时,我想在其中模拟对CustomerDaoie的静态方法的调用getAllCustomers。getAllCustomers这是类内部
方法的简短代码片段CustomerService。是否可以使用 unitils 模拟静态方法调用?
Public static List<CustomerDate> getAllCustomers()
{
//some operations
List<CustomerDate> customers=CustomerDao.getAllCustomers();// static method inside CustomerDao
//some operations
}
上面的代码只是我试图提出的一个例子。请避免讨论为什么这些方法被设计为静态方法。那是一个单独的故事。)