经常看见这俩和 RunWith 用 譬如
@RunWith(SpringRunner.class)
1
kaktos 2017-05-03 07:27:08 +08:00 via iPhone
一样的 没区别
|
2
yangguangxia 2017-07-12 10:28:41 +08:00
可以参考 spring 官方文档:
https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/test/context/junit4/SpringJUnit4ClassRunner.html https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/test/context/junit4/SpringRunner.html 第二链接里面说了“ SpringRunner is an alias for the SpringJUnit4ClassRunner.” 所以 @kaktos 说的对。 |
3
yangguangxia 2017-07-12 10:45:03 +08:00
从代码中也可以看出来:
···java public final class SpringRunner extends SpringJUnit4ClassRunner { public SpringRunner(Class<?> clazz) throws InitializationError { super(clazz); } } ··· |