我正在使用 Jmockit 在 Eclipse 中联合我的代码和 Eclemma 插件以进行代码覆盖。出于某种原因,我无法获得报道。使用 PowerMock 的其他项目,Eclemma 显示代码覆盖率很好。但是使用 Jmockit 似乎存在一些问题。
以下是例外情况:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:348)
Caused by: java.lang.UnsupportedOperationException: class redefinition failed: attempted to change the schema (add/remove fields)
at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
at sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:150)
at mockit.internal.RedefinitionEngine.redefineMethods(RedefinitionEngine.java:245)
at mockit.internal.RedefinitionEngine.redefineMethods(RedefinitionEngine.java:239)
at mockit.internal.RedefinitionEngine.redefineMethods(RedefinitionEngine.java:166)
at mockit.internal.RedefinitionEngine.setUpStartupMock(RedefinitionEngine.java:132)
at mockit.internal.startup.JMockitInitialization.setUpInternalStartupMock(JMockitInitialization.java:55)
at mockit.internal.startup.JMockitInitialization.loadInternalStartupMocksForJUnitIntegration(JMockitInitialization.java:38)
at mockit.internal.startup.JMockitInitialization.initialize(JMockitInitialization.java:25)
at mockit.internal.startup.Startup.initialize(Startup.java:68)
at mockit.internal.startup.Startup.agentmain(Startup.java:62)
... 6 more
5 Dec, 2014 6:40:44 PM com.nn.ood.common.props.PropertyReader
WARNING: No configuration file(s) found for application ca and layer be.
Agent failed to start!
Exception in thread "Attach Listener"