【发布时间】:2016-09-30 08:47:24
【问题描述】:
在我模拟时获取 java.lang.NoClassDefFoundError: org/apache/commons/logging/Log。参考代码
@Mock
private RestTemplate restTemplate;
我们包含的依赖项
testCompile "org.apache.logging.log4j:log4j-slf4j-impl:2.5"
testCompile "org.apache.logging.log4j:log4j-core:2.5"
testCompile "org.slf4j:jcl-over-slf4j:1.7.21"
testCompile "commons-logging:commons-logging:1.1.1"
注意:我们使用的是 slf4j 日志记录。 对于实际应用,这些依赖关系由 tomcat 服务器解决。
【问题讨论】:
标签: spring unit-testing junit mockito