PowerMock 环境设置

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

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

<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">
  <modelVersion>4.0.0</modelVersion>
  <groupId>shangbo</groupId>
  <artifactId>powerMock</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  <dependencies>
	<dependency>
	    <groupId>junit</groupId>
	    <artifactId>junit</artifactId>
	    <version>4.12</version>
	    <scope>test</scope>
	</dependency>
	
	<dependency>
	  <groupId>org.mockito</groupId>
	  <artifactId>mockito-core</artifactId>
	  <version>3.0.0</version>
	  <scope>test</scope>
	</dependency>
	
	<dependency>
	  <groupId>org.powermock</groupId>
	  <artifactId>powermock-module-junit4</artifactId>
	  <version>2.0.2</version>
	  <scope>test</scope>
	</dependency>
	<dependency>
	  <groupId>org.powermock</groupId>
	  <artifactId>powermock-api-mockito2</artifactId>
	  <version>2.0.2</version>
	  <scope>test</scope>
	</dependency>
		
  </dependencies>
  
</project>

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

相关文章