0

我正在尝试使用powermock来模拟javax.print.PrintServiceLookup但是以下测试无法启动。我可以使用此设置成功模拟其他静态类,但不能使用PrintServiceLookup

@RunWith( PowerMockRunner.class )
@SpringBootTest
@PowerMockRunnerDelegate(SpringRunner.class)
@TestPropertySource( "classpath:application-test.properties" )
@PrepareForTest( {PrintServiceLookup.class} )
public class PrinterUtilTest {

    @Autowired
    private PropertyUtil propertyUtil;

    @Autowired
    private PrinterUtil printerUtil;

//... other tests
}

因非法状态异常而失败。

"C:\Program Files\Java\jdk1.8.0_111\bin\java" -ea -Didea.launcher.port=7536 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3\plugins\junit\lib\junit-rt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\rt.jar;C:\DEV\freedom-print\target\test-classes;C:\DEV\freedom-print\target\classes;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter-web\1.5.2.RELEASE\spring-boot-starter-web-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter\1.5.2.RELEASE\spring-boot-starter-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter-logging\1.5.2.RELEASE\spring-boot-starter-logging-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;C:\Users\Bryce.Chernecki\.m2\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.24\jcl-over-slf4j-1.7.24.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\slf4j\jul-to-slf4j\1.7.24\jul-to-slf4j-1.7.24.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\slf4j\log4j-over-slf4j\1.7.24\log4j-over-slf4j-1.7.24.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\hibernate\hibernate-validator\5.3.4.Final\hibernate-validator-5.3.4.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\jboss\logging\jboss-logging\3.3.0.Final\jboss-logging-3.3.0.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\fasterxml\classmate\1.3.3\classmate-1.3.3.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.7\jackson-databind-2.8.7.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.7\jackson-core-2.8.7.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-web\4.3.7.RELEASE\spring-web-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-beans\4.3.7.RELEASE\spring-beans-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-context\4.3.7.RELEASE\spring-context-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-webmvc\4.3.7.RELEASE\spring-webmvc-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-expression\4.3.7.RELEASE\spring-expression-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter-undertow\1.5.2.RELEASE\spring-boot-starter-undertow-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\io\undertow\undertow-core\1.4.11.Final\undertow-core-1.4.11.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\jboss\xnio\xnio-api\3.3.6.Final\xnio-api-3.3.6.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\jboss\xnio\xnio-nio\3.3.6.Final\xnio-nio-3.3.6.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\io\undertow\undertow-servlet\1.4.11.Final\undertow-servlet-1.4.11.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\jboss\spec\javax\annotation\jboss-annotations-api_1.2_spec\1.0.0.Final\jboss-annotations-api_1.2_spec-1.0.0.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\io\undertow\undertow-websockets-jsr\1.4.11.Final\undertow-websockets-jsr-1.4.11.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\jboss\spec\javax\websocket\jboss-websocket-api_1.1_spec\1.1.0.Final\jboss-websocket-api_1.1_spec-1.1.0.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\glassfish\javax.el\3.0.0\javax.el-3.0.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter-test\1.5.2.RELEASE\spring-boot-starter-test-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-test\1.5.2.RELEASE\spring-boot-test-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-test-autoconfigure\1.5.2.RELEASE\spring-boot-test-autoconfigure-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\jayway\jsonpath\json-path\2.2.0\json-path-2.2.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;C:\Users\Bryce.Chernecki\.m2\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\slf4j\slf4j-api\1.7.24\slf4j-api-1.7.24.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\assertj\assertj-core\2.6.0\assertj-core-2.6.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\skyscreamer\jsonassert\1.4.0\jsonassert-1.4.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-core\4.3.7.RELEASE\spring-core-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-test\4.3.7.RELEASE\spring-test-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter-security\1.5.2.RELEASE\spring-boot-starter-security-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-aop\4.3.7.RELEASE\spring-aop-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\security\spring-security-config\4.2.2.RELEASE\spring-security-config-4.2.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\security\spring-security-core\4.2.2.RELEASE\spring-security-core-4.2.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\security\spring-security-web\4.2.2.RELEASE\spring-security-web-4.2.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-devtools\1.5.2.RELEASE\spring-boot-devtools-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot\1.5.2.RELEASE\spring-boot-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.2.RELEASE\spring-boot-autoconfigure-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\tanukisoftware\wrapper\3.5.27\wrapper-3.5.27.jar;C:\Users\Bryce.Chernecki\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\mockito\mockito-all\1.10.19\mockito-all-1.10.19.jar;C:\Users\Bryce.Chernecki\.m2\repository\commons-configuration\commons-configuration\1.10\commons-configuration-1.10.jar;C:\Users\Bryce.Chernecki\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\Bryce.Chernecki\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-module-junit4\1.7.0\powermock-module-junit4-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-module-junit4-common\1.7.0\powermock-module-junit4-common-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-reflect\1.7.0\powermock-reflect-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-core\1.7.0\powermock-core-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\javassist\javassist\3.21.0-GA\javassist-3.21.0-GA.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-api-mockito\1.7.0\powermock-api-mockito-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-api-mockito-common\1.7.0\powermock-api-mockito-common-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-api-support\1.7.0\powermock-api-support-1.7.0.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 com.qhrtech.freedom.util.PrinterUtilTest

java.lang.IllegalStateException: Failed to transform class with name javax.print.PrintServiceLookup. Reason: null

    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:296)
    at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:204)
    at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass1(DeferSupportingClassLoader.java:89)
    at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:79)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
    at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:439)
    at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:420)
    at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
    at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
    at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
    at java.lang.Class.createAnnotationData(Class.java:3521)
    at java.lang.Class.annotationData(Class.java:3510)
    at java.lang.Class.getAnnotation(Class.java:3415)
    at java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:258)
    at java.lang.Class.isAnnotationPresent(Class.java:3425)
    at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$1.call(DelegatingPowerMockRunner.java:102)
    at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$1.call(DelegatingPowerMockRunner.java:97)
    at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.withContextClassLoader(DelegatingPowerMockRunner.java:132)
    at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.createDelegate(DelegatingPowerMockRunner.java:96)
    at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.<init>(DelegatingPowerMockRunner.java:64)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:172)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:48)
    at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:108)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:71)
    at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:36)
    at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:34)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.NullPointerException
    at javassist.bytecode.stackmap.TypeData$ClassName.getArrayType(TypeData.java:814)
    at javassist.bytecode.stackmap.TypeData$TypeVar.fixTypes1(TypeData.java:400)
    at javassist.bytecode.stackmap.TypeData$TypeVar.fixTypes(TypeData.java:392)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:338)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
    at javassist.bytecode.stackmap.MapMaker.fixTypes(MapMaker.java:390)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:167)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:108)
    at javassist.bytecode.MethodInfo.rebuildStackMap(MethodInfo.java:456)
    at javassist.bytecode.MethodInfo.rebuildStackMapIf6(MethodInfo.java:438)
    at javassist.expr.ExprEditor.doit(ExprEditor.java:113)
    at javassist.CtClassType.instrument(CtClassType.java:1465)
    at org.powermock.core.transformers.impl.ClassMockTransformer.transformMockClass(ClassMockTransformer.java:65)
    at org.powermock.core.transformers.impl.AbstractMainMockTransformer.transform(AbstractMainMockTransformer.java:62)
    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:277)
    ... 56 more


Process finished with exit code -1

我对这个错误的研究带来了各种建议,即我的项目可能具有与 Powermock 冲突的org.javassist依赖项。我认为情况并非如此,因为PrepareForTest中的其他静态类不会破坏测试。(特别是如果该类不是javax.print包的一部分)下面是我的mvn 依赖项:tree命令

web:jar:1.5.2.RELEASE:compile
    [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.5.2.RELEASE:compile
    [INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.2.RELEASE:compile
    [INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.11:compile
    [INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.11:compile
    [INFO] |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.24:compile
    [INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.24:compile
    [INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.24:compile
    [INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
    [INFO] |  +- org.hibernate:hibernate-validator:jar:5.3.4.Final:compile
    [INFO] |  |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
    [INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
    [INFO] |  |  \- com.fasterxml:classmate:jar:1.3.3:compile
    [INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.7:compile
    [INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
    [INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.7:compile
    [INFO] |  +- org.springframework:spring-web:jar:4.3.7.RELEASE:compile
    [INFO] |  |  +- org.springframework:spring-beans:jar:4.3.7.RELEASE:compile
    [INFO] |  |  \- org.springframework:spring-context:jar:4.3.7.RELEASE:compile
    [INFO] |  \- org.springframework:spring-webmvc:jar:4.3.7.RELEASE:compile
    [INFO] |     \- org.springframework:spring-expression:jar:4.3.7.RELEASE:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-undertow:jar:1.5.2.RELEASE:compile
    [INFO] |  +- io.undertow:undertow-core:jar:1.4.11.Final:compile
    [INFO] |  |  +- org.jboss.xnio:xnio-api:jar:3.3.6.Final:compile
    [INFO] |  |  \- org.jboss.xnio:xnio-nio:jar:3.3.6.Final:runtime
    [INFO] |  +- io.undertow:undertow-servlet:jar:1.4.11.Final:compile
    [INFO] |  |  \- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final:compile
    [INFO] |  +- io.undertow:undertow-websockets-jsr:jar:1.4.11.Final:compile
    [INFO] |  |  \- org.jboss.spec.javax.websocket:jboss-websocket-api_1.1_spec:jar:1.1.0.Final:compile
    [INFO] |  +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
    [INFO] |  \- org.glassfish:javax.el:jar:3.0.0:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.2.RELEASE:test
    [INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.5.2.RELEASE:test
    [INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.2.RELEASE:test
    [INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:test
    [INFO] |  |  +- net.minidev:json-smart:jar:2.2.1:test
    [INFO] |  |  |  \- net.minidev:accessors-smart:jar:1.1:test
    [INFO] |  |  |     \- org.ow2.asm:asm:jar:5.0.3:test
    [INFO] |  |  \- org.slf4j:slf4j-api:jar:1.7.24:compile
    [INFO] |  +- org.assertj:assertj-core:jar:2.6.0:test
    [INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
    [INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test
    [INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
    [INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
    [INFO] |  +- org.skyscreamer:jsonassert:jar:1.4.0:test
    [INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
    [INFO] |  +- org.springframework:spring-core:jar:4.3.7.RELEASE:compile
    [INFO] |  \- org.springframework:spring-test:jar:4.3.7.RELEASE:test
    [INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.5.2.RELEASE:compile
    [INFO] |  +- org.springframework:spring-aop:jar:4.3.7.RELEASE:compile
    [INFO] |  +- org.springframework.security:spring-security-config:jar:4.2.2.RELEASE:compile
    [INFO] |  |  \- org.springframework.security:spring-security-core:jar:4.2.2.RELEASE:compile
    [INFO] |  \- org.springframework.security:spring-security-web:jar:4.2.2.RELEASE:compile
    [INFO] +- org.springframework.boot:spring-boot-devtools:jar:1.5.2.RELEASE:compile
    [INFO] |  +- org.springframework.boot:spring-boot:jar:1.5.2.RELEASE:compile
    [INFO] |  \- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.2.RELEASE:compile
    [INFO] +- tanukisoftware:wrapper:jar:3.5.27:compile
    [INFO] +- tanukisoftware:wrapper:dll:3.5.27:compile
    [INFO] +- junit:junit:jar:4.12:test
    [INFO] +- org.mockito:mockito-all:jar:1.10.19:test
    [INFO] +- commons-configuration:commons-configuration:jar:1.10:compile
    [INFO] |  +- commons-lang:commons-lang:jar:2.6:compile
    [INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
    [INFO] +- org.powermock:powermock-module-junit4:jar:1.7.0:test
    [INFO] |  \- org.powermock:powermock-module-junit4-common:jar:1.7.0:test
    [INFO] |     +- org.powermock:powermock-reflect:jar:1.7.0:test
    [INFO] |     \- org.powermock:powermock-core:jar:1.7.0:test
    [INFO] |        \- org.javassist:javassist:jar:3.21.0-GA:test
    [INFO] \- org.powermock:powermock-api-mockito:jar:1.7.0:test
    [INFO]    \- org.powermock:powermock-api-mockito-common:jar:1.7.0:test
    [INFO]       \- org.powermock:powermock-api-support:jar:1.7.0:test
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.044s
    [INFO] Finished at: Tue Aug 01 11:57:22 MDT 2017
    [INFO] Final Memory: 18M/304M
    [INFO] ------------------------------------------------------------------------
4

1 回答 1

0

尝试让你的测试类扩展PowerMockTestCase

于 2017-08-28T17:49:38.453 回答