Java 类org.springframework.test.context.junit4.rules.SpringClassRule 实例源码
项目:spring4-understanding
文件:SpringJUnit4ClassRunner.java
private static void ensureSpringRulesAreNotPresent(Class<?> testClass) {
for (Field field : testClass.getFields()) {
if (SpringClassRule.class.isAssignableFrom(field.getType())) {
throw new IllegalStateException(String.format("Detected SpringClassRule field in test class [%s], " +
"but SpringClassRule cannot be used with the SpringJUnit4ClassRunner.", testClass.getName()));
}
if (SpringMethodRule.class.isAssignableFrom(field.getType())) {
throw new IllegalStateException(String.format("Detected SpringMethodRule field in test class [%s], " +
"but SpringMethodRule cannot be used with the SpringJUnit4ClassRunner.", testClass.getName()));
}
}
}