Extract the creation code into a factory method, override this factory method in a test subclass, and then make the overridden method return a mock object instead.

 
  • 将创建代码抽取到工厂方法,在测试子类中覆盖该工厂方法,然后使被覆盖的方法返回模仿对象。
今日热词
目录 附录 查词历史