[JAVA-134] Created a powermockito module that uses version 2.21.0 version of Mockito
This commit is contained in:
parent
1c50dedb91
commit
08e93e8da5
@ -44,19 +44,6 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- test scoped -->
|
<!-- test scoped -->
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.powermock</groupId>
|
|
||||||
<artifactId>powermock-module-junit4</artifactId>
|
|
||||||
<version>${powermock.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.powermock</groupId>
|
|
||||||
<artifactId>powermock-api-mockito2</artifactId>
|
|
||||||
<version>${powermock.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
<module>xmlunit-2</module>
|
<module>xmlunit-2</module>
|
||||||
<module>junit-4</module>
|
<module>junit-4</module>
|
||||||
<module>testing-libraries</module>
|
<module>testing-libraries</module>
|
||||||
|
<module>powermockito</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
33
testing-modules/powermockito/pom.xml
Normal file
33
testing-modules/powermockito/pom.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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">
|
||||||
|
<parent>
|
||||||
|
<artifactId>testing-modules</artifactId>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>powermockito</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.powermock</groupId>
|
||||||
|
<artifactId>powermock-module-junit4</artifactId>
|
||||||
|
<version>${powermock.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.powermock</groupId>
|
||||||
|
<artifactId>powermock-api-mockito2</artifactId>
|
||||||
|
<version>${powermock.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<mockito.version>2.21.0</mockito.version>
|
||||||
|
<powermock.version>2.0.2</powermock.version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
@ -68,7 +68,7 @@ public class PowerMockitoUnitTest {
|
|||||||
|
|
||||||
when(mock.finalMethod()).thenReturn("I am a final mock method.");
|
when(mock.finalMethod()).thenReturn("I am a final mock method.");
|
||||||
returnValue = mock.finalMethod();
|
returnValue = mock.finalMethod();
|
||||||
verify(mock,times(3)).finalMethod();
|
verify(mock).finalMethod();
|
||||||
assertEquals("I am a final mock method.", returnValue);
|
assertEquals("I am a final mock method.", returnValue);
|
||||||
|
|
||||||
when(mock, "privateMethod").thenReturn("I am a private mock method.");
|
when(mock, "privateMethod").thenReturn("I am a private mock method.");
|
Loading…
x
Reference in New Issue
Block a user