Merge pull request #8801 from dupirefr/team/JAVA-134-mockito_version_update
[JAVA-134] Mockito version update
This commit is contained in:
commit
d014d81476
9
pom.xml
9
pom.xml
|
@ -69,6 +69,12 @@
|
||||||
<version>${hamcrest-all.version}</version>
|
<version>${hamcrest-all.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.bytebuddy</groupId>
|
||||||
|
<artifactId>byte-buddy</artifactId>
|
||||||
|
<version>${byte-buddy.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
|
@ -1330,7 +1336,8 @@
|
||||||
<junit.version>4.12</junit.version>
|
<junit.version>4.12</junit.version>
|
||||||
<hamcrest.version>2.2</hamcrest.version>
|
<hamcrest.version>2.2</hamcrest.version>
|
||||||
<hamcrest-all.version>1.3</hamcrest-all.version>
|
<hamcrest-all.version>1.3</hamcrest-all.version>
|
||||||
<mockito.version>2.21.0</mockito.version>
|
<mockito.version>3.3.0</mockito.version>
|
||||||
|
<byte-buddy.version>1.10.5</byte-buddy.version>
|
||||||
|
|
||||||
<!-- logging -->
|
<!-- logging -->
|
||||||
<org.slf4j.version>1.7.30</org.slf4j.version>
|
<org.slf4j.version>1.7.30</org.slf4j.version>
|
||||||
|
|
|
@ -121,6 +121,8 @@
|
||||||
<springframework.version>5.2.3.RELEASE</springframework.version>
|
<springframework.version>5.2.3.RELEASE</springframework.version>
|
||||||
<activemq.broker.version>5.10.2</activemq.broker.version>
|
<activemq.broker.version>5.10.2</activemq.broker.version>
|
||||||
<activemq.junit.version>5.13.1</activemq.junit.version>
|
<activemq.junit.version>5.13.1</activemq.junit.version>
|
||||||
|
<mockito.version>2.21.0</mockito.version>
|
||||||
|
<byte-buddy.version>1.8.5</byte-buddy.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
- [Mockito When/Then Cookbook](https://www.baeldung.com/mockito-behavior)
|
- [Mockito When/Then Cookbook](https://www.baeldung.com/mockito-behavior)
|
||||||
- [Getting Started with Mockito @Mock, @Spy, @Captor and @InjectMocks](https://www.baeldung.com/mockito-annotations)
|
- [Getting Started with Mockito @Mock, @Spy, @Captor and @InjectMocks](https://www.baeldung.com/mockito-annotations)
|
||||||
- [Mockito’s Mock Methods](https://www.baeldung.com/mockito-mock-methods)
|
- [Mockito’s Mock Methods](https://www.baeldung.com/mockito-mock-methods)
|
||||||
- [Introduction to PowerMock](https://www.baeldung.com/intro-to-powermock)
|
|
||||||
- [Mocking of Private Methods Using PowerMock](https://www.baeldung.com/powermock-private-method)
|
|
||||||
- [Mocking Exception Throwing using Mockito](https://www.baeldung.com/mockito-exceptions)
|
- [Mocking Exception Throwing using Mockito](https://www.baeldung.com/mockito-exceptions)
|
||||||
- [Mocking Void Methods with Mockito](https://www.baeldung.com/mockito-void-methods)
|
- [Mocking Void Methods with Mockito](https://www.baeldung.com/mockito-void-methods)
|
||||||
- [Mock Final Classes and Methods with Mockito](https://www.baeldung.com/mockito-final)
|
- [Mock Final Classes and Methods with Mockito](https://www.baeldung.com/mockito-final)
|
||||||
|
|
|
@ -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>powermock</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
### Relevant Articles:
|
||||||
|
- [Introduction to PowerMock](https://www.baeldung.com/intro-to-powermock)
|
||||||
|
- [Mocking of Private Methods Using PowerMock](https://www.baeldung.com/powermock-private-method)
|
|
@ -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>powermock</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…
Reference in New Issue