jmocket之WARNING: JMockit was initialized on demand, which may cause certain test

WARNING: JMockit was initialized on demand, which may cause certain tests to fail; please check the documentation for better ways to get it initialized.

调整jmockit和junit在classpath中的顺序

        <!-- JMockit must be before JUnit in the classpath -->
        <dependency>
            <groupId> com.googlecode.jmockit</groupId >
            <artifactId> jmockit</artifactId >
            <version>1.0</version>
            <scope> test</scope >
        </dependency>
        <!-- Junit -->
        <dependency>
            <groupId> junit</groupId >
            <artifactId> junit</artifactId >
            <version>4.10</version>
            <scope> test</scope >
        </dependency>
        <dependency>
            <groupId> org.hamcrest</groupId >
            <artifactId> hamcrest-all </artifactId>
            <version> 1.1</version >
            <scope> test</scope >
        </dependency>

new MockUp<Class>(){
   @Mock
     method(){}
}


jmocket官方地址
https://code.google.com/p/jmockit/

参考文章
http://www.haogongju.net/art/1763416
http://wenku.baidu.com/view/d0c866de6f1aff00bed51eda.html

猜你喜欢

转载自phl.iteye.com/blog/1991018