PowerMock 环境设置

x33g5p2x  于2021-12-28 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(379)

– Start
在开始学习 PowerMock 之前,你需要先创建一个 Maven 项目,然后添加下面的依赖。
很遗憾,到目前为止,PowerMock 还不支持 JUnit 5

  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  2. <modelVersion>4.0.0</modelVersion>
  3. <groupId>shangbo</groupId>
  4. <artifactId>powerMock</artifactId>
  5. <version>0.0.1-SNAPSHOT</version>
  6. <dependencies>
  7. <dependency>
  8. <groupId>junit</groupId>
  9. <artifactId>junit</artifactId>
  10. <version>4.12</version>
  11. <scope>test</scope>
  12. </dependency>
  13. <dependency>
  14. <groupId>org.mockito</groupId>
  15. <artifactId>mockito-core</artifactId>
  16. <version>3.0.0</version>
  17. <scope>test</scope>
  18. </dependency>
  19. <dependency>
  20. <groupId>org.powermock</groupId>
  21. <artifactId>powermock-module-junit4</artifactId>
  22. <version>2.0.2</version>
  23. <scope>test</scope>
  24. </dependency>
  25. <dependency>
  26. <groupId>org.powermock</groupId>
  27. <artifactId>powermock-api-mockito2</artifactId>
  28. <version>2.0.2</version>
  29. <scope>test</scope>
  30. </dependency>
  31. </dependencies>
  32. </project>

– 更多参见:PowerMock 精萃
– 声 明:转载请注明出处
– Last Updated on 2019-08-16
– Written by ShangBo on 2019-08-16
– End

相关文章