有些对象需要mock的对象是由工厂方法产生出来的,而工厂方法一般是静态方法,这时候就需要同时mock工厂方法及对象 被测方法: public class EmployeeServiceFactory { public void saveEmployee(Employee employee){ EmployeeDaoFactory dao = EmployeeDaoFactory.newInstance(); method("powermock"); dao.addEmployee(em…
There are many kinds of testing which really made me confused. To be honest, I've never heard of something like Mock testing, stub testing. I had to learn a lot before I can know little about testing. Whenever I saw something which was written by som…
本文主要参考了Spring官方文档第10章以及第11章和第40章的部分内容.如果要我总结Spring AOP的作用,不妨借鉴文档里的一段话:One of the key components of Spring is the AOP framework. While the Spring IoC container does not depend on AOP, meaning you do not need to use AOP if you don’t want to, AOP comple…