我已经设置了JMockit,以便与一些JUnit测试一起使用,也使用Robolectric,但是我会遇到错误。我主要是使用maven来运行测试。当我使用mvn测试和配置为指定的javaagent运行测试时,就会得到通常的异常:
我已经验证了JMockit在JUnit之前的类路径上,使用和mvn test --debug。图书馆
问题是,我试图从另一个线程释放锁(因为恢复是由另一个后台服务执行的),这会抛出一个IllegalMonitorStateException。unlock方法上的注释验证了此行为。If the current thread is * IllegalMonitorStateException*
* @throws IllegalMonitorStateException if the current thread