log4j:ERROR A “org.apache.log4j.ConsoleAppender” object is not assignable to a “org.apache.log4j.Appender” variable

拈花ヽ惹草 提交于 2019-12-04 01:36:01

Adding this annotation works for me.

@PowerMockIgnore("org.apache.log4j.*") 

Your classpath contains 2 copies of log4j library. Exclude one and try again.

There is a Clear answer here. :D

When we have a final method and slf4j loggers in our classes. We have to use powermock in our test class. Because of this we have to use @MockPolicy(Slf4jMockPolicy.class) with particuler imports at the test class which we used Powermock.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!