【发布时间】:2014-01-03 15:30:39
【问题描述】:
当我尝试运行具有覆盖率的 JUnit 测试时,我收到以下错误
FATAL ERROR in native method: processing of -javaagent failed
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:397)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.coverage.main.CoveragePremain.premain(CoveragePremain.java:50)
... 6 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at com.intellij.rt.coverage.instrumentation.Instrumentator.premain(Instrumentator.java:40)
... 11 more
Exception in thread "main"
Process finished with exit code 1
有人可以帮忙解决吗?
【问题讨论】:
-
这是特定于特定测试代码的吗?您的测试是否在未启用代码覆盖的情况下工作?
-
我用不同的代码和不同的 Intellij 版本检查了它。我总是收到相同的结果。是的,测试在没有覆盖的情况下工作。
-
您是否尝试过更改代码覆盖率运行程序?你能在这里发布代码覆盖率配置吗?
-
Anatoly,你能解决这个问题吗?我在使用 JaCoCo 进行 android 代码覆盖时遇到了同样的问题?
标签: java junit intellij-idea code-coverage