JAVA-32410: Update mockito-core to version 5.11.0 (#16199)
* JAVA-32410: Update mockito-core to version 5.11.0 * Fix rollback mockito upgrade. * wip * WIP: Update jee-7 wildfly versions * WIP: Fix jersey tests * WIP: rollback powermock module * wip: fix test in spring-data-dynamodb * wip: fix test in spring-security-legacy-oidc * wip: rollback quarkus * wip: fix greeter-spring-boot-autoconfigure * JAVA-33535: Fix spring-core module integration test JAVA-33535: rollback junit-5 module mockito version. * Fix byte-buddy * Fix log4j dependency in apache-poi
This commit is contained in:
parent
f1af9d5e55
commit
4394e828c1
|
@ -40,6 +40,16 @@
|
||||||
<artifactId>fastexcel-reader</artifactId>
|
<artifactId>fastexcel-reader</artifactId>
|
||||||
<version>${fastexcel.version}</version>
|
<version>${fastexcel.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-api</artifactId>
|
||||||
|
<version>${log4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-core</artifactId>
|
||||||
|
<version>${log4j.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -64,6 +74,7 @@
|
||||||
<jexcel.version>1.0.9</jexcel.version>
|
<jexcel.version>1.0.9</jexcel.version>
|
||||||
<fastexcel.version>0.17.0</fastexcel.version>
|
<fastexcel.version>0.17.0</fastexcel.version>
|
||||||
<maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
|
<maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
|
||||||
|
<log4j.version>2.23.1</log4j.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -71,7 +71,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>${mockito-core.version}</version>
|
<version>${mockito.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -112,7 +112,6 @@
|
||||||
<feign-core.version>11.2</feign-core.version>
|
<feign-core.version>11.2</feign-core.version>
|
||||||
<guice.version>5.1.0</guice.version>
|
<guice.version>5.1.0</guice.version>
|
||||||
<system-stubs-junit4.version>2.0.2</system-stubs-junit4.version>
|
<system-stubs-junit4.version>2.0.2</system-stubs-junit4.version>
|
||||||
<mockito-core.version>4.1.0</mockito-core.version>
|
|
||||||
<assertj-core.version>3.19.0</assertj-core.version>
|
<assertj-core.version>3.19.0</assertj-core.version>
|
||||||
<junit-jupiter.version>5.8.1</junit-jupiter.version>
|
<junit-jupiter.version>5.8.1</junit-jupiter.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
|
@ -260,7 +260,6 @@
|
||||||
<!-- util -->
|
<!-- util -->
|
||||||
<unix4j.version>0.4</unix4j.version>
|
<unix4j.version>0.4</unix4j.version>
|
||||||
<grep4j.version>1.8.7</grep4j.version>
|
<grep4j.version>1.8.7</grep4j.version>
|
||||||
<mockito.version>4.6.1</mockito.version>
|
|
||||||
<!-- maven plugins -->
|
<!-- maven plugins -->
|
||||||
<javamoney.moneta.version>1.1</javamoney.moneta.version>
|
<javamoney.moneta.version>1.1</javamoney.moneta.version>
|
||||||
<maven-javadoc-plugin.version>3.6.2</maven-javadoc-plugin.version>
|
<maven-javadoc-plugin.version>3.6.2</maven-javadoc-plugin.version>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<!-- Boot version compatible with spqr-boot-starter -->
|
<!-- Boot version compatible with spqr-boot-starter -->
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
<version>2.6.4</version>
|
<version>2.6.15</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -34,4 +34,9 @@
|
||||||
<module>graphql-spqr-boot-starter</module>
|
<module>graphql-spqr-boot-starter</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<!-- Can't update to the recent mockito version, without updating the spring boot version-->
|
||||||
|
<mockito.version>4.4.0</mockito.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -85,7 +85,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-inline</artifactId>
|
<artifactId>mockito-inline</artifactId>
|
||||||
<version>${mockito.version}</version>
|
<version>${mockito-inline.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -120,6 +120,7 @@
|
||||||
<reactive.stream.version>1.0.3</reactive.stream.version>
|
<reactive.stream.version>1.0.3</reactive.stream.version>
|
||||||
<reactor.version>3.6.0</reactor.version>
|
<reactor.version>3.6.0</reactor.version>
|
||||||
<jmockit.version>1.49</jmockit.version>
|
<jmockit.version>1.49</jmockit.version>
|
||||||
|
<mockito-inline.version>5.2.0</mockito-inline.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -44,7 +44,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>${mockito-core.version}</version>
|
<version>${mockito.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -83,7 +83,6 @@
|
||||||
<activemq.version>5.14.1</activemq.version>
|
<activemq.version>5.14.1</activemq.version>
|
||||||
<spring-boot-test.version>1.5.10.RELEASE</spring-boot-test.version>
|
<spring-boot-test.version>1.5.10.RELEASE</spring-boot-test.version>
|
||||||
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
|
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
|
||||||
<mockito-core.version>4.6.1</mockito-core.version>
|
|
||||||
<activemq-junit.version>5.16.5</activemq-junit.version>
|
<activemq-junit.version>5.16.5</activemq-junit.version>
|
||||||
<testcontainers.version>1.17.3</testcontainers.version>
|
<testcontainers.version>1.17.3</testcontainers.version>
|
||||||
<junit-jupiter.version>5.10.1</junit-jupiter.version>
|
<junit-jupiter.version>5.10.1</junit-jupiter.version>
|
||||||
|
|
|
@ -16,9 +16,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-inline</artifactId>
|
<artifactId>mockito-inline</artifactId>
|
||||||
<version>${mockito.version}</version>
|
<version>${mockito-inline.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<mockito-inline.version>5.2.0</mockito-inline.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -70,7 +70,6 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<mockito.version>2.23.0</mockito.version>
|
|
||||||
<validation-api.version>2.0.1.Final</validation-api.version>
|
<validation-api.version>2.0.1.Final</validation-api.version>
|
||||||
<mysql-connector-java.version>8.2.0</mysql-connector-java.version>
|
<mysql-connector-java.version>8.2.0</mysql-connector-java.version>
|
||||||
<start-class>com.baeldung.boot.Application</start-class>
|
<start-class>com.baeldung.boot.Application</start-class>
|
||||||
|
|
|
@ -136,6 +136,12 @@
|
||||||
<type>so</type>
|
<type>so</type>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.bytebuddy</groupId>
|
||||||
|
<artifactId>byte-buddy</artifactId>
|
||||||
|
<version>1.14.13</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -5,8 +5,6 @@ import org.junit.runner.RunWith;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import com.baeldung.Application;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = Application.class)
|
@SpringBootTest(classes = Application.class)
|
||||||
public class SpringContextTest {
|
public class SpringContextTest {
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -1149,7 +1149,7 @@
|
||||||
<assertj.version>3.21.0</assertj.version>
|
<assertj.version>3.21.0</assertj.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>4.4.0</mockito.version>
|
<mockito.version>5.11.0</mockito.version>
|
||||||
<byte-buddy.version>1.14.11</byte-buddy.version>
|
<byte-buddy.version>1.14.11</byte-buddy.version>
|
||||||
|
|
||||||
<!-- logging -->
|
<!-- logging -->
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
<surefire-plugin.version>3.0.0</surefire-plugin.version>
|
<surefire-plugin.version>3.0.0</surefire-plugin.version>
|
||||||
<loom-unit.version>0.3.0</loom-unit.version>
|
<loom-unit.version>0.3.0</loom-unit.version>
|
||||||
<panache-common-deployment.version>3.6.0</panache-common-deployment.version>
|
<panache-common-deployment.version>3.6.0</panache-common-deployment.version>
|
||||||
<mockito-core.version>3.11.2</mockito-core.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -92,7 +91,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>${mockito-core.version}</version>
|
<version>${mockito.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -180,7 +180,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<quarkus.version>2.16.3.Final</quarkus.version>
|
<quarkus.version>2.16.3.Final</quarkus.version>
|
||||||
<mockito.version>3.3.0</mockito.version>
|
<mockito.version>4.4.0</mockito.version> <!-- Current quarkus doesn't support latest version. If Upgrading to a new quarkus remove this. -->
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -45,6 +45,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
|
<version>${mockito.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -42,6 +42,12 @@
|
||||||
<version>${spring-boot.version}</version>
|
<version>${spring-boot.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>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -61,6 +67,7 @@
|
||||||
<properties>
|
<properties>
|
||||||
<spring-boot.version>2.2.6.RELEASE</spring-boot.version>
|
<spring-boot.version>2.2.6.RELEASE</spring-boot.version>
|
||||||
<greeter.version>0.0.1-SNAPSHOT</greeter.version>
|
<greeter.version>0.0.1-SNAPSHOT</greeter.version>
|
||||||
|
<byte-buddy.version>1.14.13</byte-buddy.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -49,7 +49,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-test</artifactId>
|
<artifactId>spring-boot-test</artifactId>
|
||||||
<version>${mockito.spring.boot.version}</version>
|
<version>${spring-boot.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -78,10 +78,8 @@
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<mockito.spring.boot.version>1.4.4.RELEASE</mockito.spring.boot.version>
|
|
||||||
<javax.inject.version>1</javax.inject.version>
|
<javax.inject.version>1</javax.inject.version>
|
||||||
<spring-boot.version>1.5.2.RELEASE</spring-boot.version>
|
<spring-boot.version>1.5.2.RELEASE</spring-boot.version>
|
||||||
<mockito.version>1.10.19</mockito.version>
|
|
||||||
<annotation-api.version>1.3.2</annotation-api.version>
|
<annotation-api.version>1.3.2</annotation-api.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,6 @@
|
||||||
<springframework.version>5.2.3.RELEASE</springframework.version>
|
<springframework.version>5.2.3.RELEASE</springframework.version>
|
||||||
<activemq-broker.version>5.16.3</activemq-broker.version>
|
<activemq-broker.version>5.16.3</activemq-broker.version>
|
||||||
<activemq-junit.version>5.16.3</activemq-junit.version>
|
<activemq-junit.version>5.16.3</activemq-junit.version>
|
||||||
<mockito.version>2.21.0</mockito.version>
|
|
||||||
<maven-dependency-plugin.version>2.8</maven-dependency-plugin.version>
|
<maven-dependency-plugin.version>2.8</maven-dependency-plugin.version>
|
||||||
<wildfly-ejb.version>8.2.1.Final</wildfly-ejb.version>
|
<wildfly-ejb.version>8.2.1.Final</wildfly-ejb.version>
|
||||||
<joda-time.version>2.12.5</joda-time.version>
|
<joda-time.version>2.12.5</joda-time.version>
|
||||||
|
|
|
@ -42,6 +42,12 @@
|
||||||
<artifactId>jwks-rsa</artifactId>
|
<artifactId>jwks-rsa</artifactId>
|
||||||
<version>${jwks-rsa.version}</version>
|
<version>${jwks-rsa.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.bytebuddy</groupId>
|
||||||
|
<artifactId>byte-buddy</artifactId>
|
||||||
|
<version>1.14.13</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -77,7 +77,6 @@
|
||||||
<downloadSources>true</downloadSources>
|
<downloadSources>true</downloadSources>
|
||||||
<downloadJavadocs>true</downloadJavadocs>
|
<downloadJavadocs>true</downloadJavadocs>
|
||||||
<junit.jupiter.engine.version>5.9.3</junit.jupiter.engine.version>
|
<junit.jupiter.engine.version>5.9.3</junit.jupiter.engine.version>
|
||||||
<mockito.version>5.3.1</mockito.version>
|
|
||||||
<thymeleaf.spring6.version>3.1.1.RELEASE</thymeleaf.spring6.version>
|
<thymeleaf.spring6.version>3.1.1.RELEASE</thymeleaf.spring6.version>
|
||||||
<spring.boot.starter.thymeleaf>3.1.1</spring.boot.starter.thymeleaf>
|
<spring.boot.starter.thymeleaf>3.1.1</spring.boot.starter.thymeleaf>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>${mockito-core.version}</version>
|
<version>${mockito.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -42,7 +42,6 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<junit-jupiter-api.version>5.10.0</junit-jupiter-api.version>
|
<junit-jupiter-api.version>5.10.0</junit-jupiter-api.version>
|
||||||
<mockito-core.version>5.5.0</mockito-core.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -89,11 +89,6 @@
|
||||||
<version>${powermock.version}</version>
|
<version>${powermock.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.mockito</groupId>
|
|
||||||
<artifactId>mockito-core</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -135,7 +130,7 @@
|
||||||
<log4j2.version>2.17.1</log4j2.version>
|
<log4j2.version>2.17.1</log4j2.version>
|
||||||
<powermock.version>2.0.9</powermock.version>
|
<powermock.version>2.0.9</powermock.version>
|
||||||
<spring.version>5.0.1.RELEASE</spring.version>
|
<spring.version>5.0.1.RELEASE</spring.version>
|
||||||
<mockito.version>3.3.0</mockito.version>
|
<mockito.version>3.3.0</mockito.version> <!-- Cannot Upgrade to recent versions. Powermock doesn't support it -->
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -34,8 +34,8 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<mockito-inline.version>4.8.1</mockito-inline.version>
|
<mockito-inline.version>4.8.1</mockito-inline.version>
|
||||||
<mockito.version>5.10.0</mockito.version>
|
|
||||||
<lombok.version>1.18.30</lombok.version>
|
<lombok.version>1.18.30</lombok.version>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -60,7 +60,6 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-framework.version>6.0.8</spring-framework.version>
|
<spring-framework.version>6.0.8</spring-framework.version>
|
||||||
<mockito.version>5.3.1</mockito.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -41,7 +41,7 @@
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<mockito.version>2.21.0</mockito.version>
|
<mockito.version>2.21.0</mockito.version> <!--Cannot upgrade to the latest version as powermock doesn't support that-->
|
||||||
<powermock.version>2.0.9</powermock.version>
|
<powermock.version>2.0.9</powermock.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-all</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>${mockito.version}</version>
|
<version>${mockito.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -100,11 +100,10 @@
|
||||||
<jakartaee-api.version>9.0.0</jakartaee-api.version>
|
<jakartaee-api.version>9.0.0</jakartaee-api.version>
|
||||||
<krazo.version>2.0.0</krazo.version>
|
<krazo.version>2.0.0</krazo.version>
|
||||||
<jakarta.mvc-api.version>2.0.0</jakarta.mvc-api.version>
|
<jakarta.mvc-api.version>2.0.0</jakarta.mvc-api.version>
|
||||||
<junit.jupiter.version>5.8.2</junit.jupiter.version>
|
<junit.jupiter.version>5.10.2</junit.jupiter.version>
|
||||||
<local.glassfish.home>C:/glassfish6</local.glassfish.home>
|
<local.glassfish.home>C:/glassfish6</local.glassfish.home>
|
||||||
<local.glassfish.user>admin</local.glassfish.user>
|
<local.glassfish.user>admin</local.glassfish.user>
|
||||||
<local.glassfish.domain>mvn-domain</local.glassfish.domain>
|
<local.glassfish.domain>mvn-domain</local.glassfish.domain>
|
||||||
<mockito.version>1.10.19</mockito.version>
|
|
||||||
<local.glassfish.passfile>
|
<local.glassfish.passfile>
|
||||||
${local.glassfish.home}\\domains\\${local.glassfish.domain}\\config\\domain-passwords
|
${local.glassfish.home}\\domains\\${local.glassfish.domain}\\config\\domain-passwords
|
||||||
</local.glassfish.passfile>
|
</local.glassfish.passfile>
|
||||||
|
|
|
@ -1,25 +1,23 @@
|
||||||
package com.baeldung.eclipse.krazo;
|
package com.baeldung.eclipse.krazo;
|
||||||
|
|
||||||
import com.baeldung.eclipse.krazo.User;
|
|
||||||
import com.baeldung.eclipse.krazo.UserController;
|
|
||||||
import jakarta.mvc.Models;
|
|
||||||
import jakarta.mvc.binding.BindingResult;
|
|
||||||
import org.eclipse.krazo.core.ModelsImpl;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.DisplayName;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import org.mockito.InjectMocks;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.MockitoAnnotations;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.Matchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import org.eclipse.krazo.core.ModelsImpl;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
|
import jakarta.mvc.Models;
|
||||||
|
import jakarta.mvc.binding.BindingResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class contains unit tests. We do only unit tests. Most of the classes are mocked
|
* The class contains unit tests. We do only unit tests. Most of the classes are mocked
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -112,7 +112,6 @@
|
||||||
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
|
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
|
||||||
<jetty-maven-plugin.version>10.0.4</jetty-maven-plugin.version>
|
<jetty-maven-plugin.version>10.0.4</jetty-maven-plugin.version>
|
||||||
<commons-text.version>1.10.0</commons-text.version>
|
<commons-text.version>1.10.0</commons-text.version>
|
||||||
<mockito.version>5.6.0</mockito.version>
|
|
||||||
<uap.version>1.5.4</uap.version>
|
<uap.version>1.5.4</uap.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wildfly</groupId>
|
<groupId>org.wildfly.arquillian</groupId>
|
||||||
<artifactId>wildfly-arquillian-container-managed</artifactId>
|
<artifactId>wildfly-arquillian-container-managed</artifactId>
|
||||||
<version>${wildfly.version}</version>
|
<version>${wildfly.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
@ -345,7 +345,7 @@
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>org.wildfly</groupId>
|
<groupId>org.wildfly</groupId>
|
||||||
<artifactId>wildfly-dist</artifactId>
|
<artifactId>wildfly-dist</artifactId>
|
||||||
<version>${wildfly.version}</version>
|
<version>${wildfly-dist.version}</version>
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
<overWrite>false</overWrite>
|
<overWrite>false</overWrite>
|
||||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||||
|
@ -395,7 +395,7 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wildfly</groupId>
|
<groupId>org.wildfly.arquillian</groupId>
|
||||||
<artifactId>wildfly-arquillian-container-remote</artifactId>
|
<artifactId>wildfly-arquillian-container-remote</artifactId>
|
||||||
<version>${wildfly.version}</version>
|
<version>${wildfly.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
@ -520,7 +520,8 @@
|
||||||
<maven.min.version>3.0.0</maven.min.version>
|
<maven.min.version>3.0.0</maven.min.version>
|
||||||
<javaee_api.version>7.0</javaee_api.version>
|
<javaee_api.version>7.0</javaee_api.version>
|
||||||
<arquillian_core.version>1.1.11.Final</arquillian_core.version>
|
<arquillian_core.version>1.1.11.Final</arquillian_core.version>
|
||||||
<wildfly.version>8.2.1.Final</wildfly.version>
|
<wildfly-dist.version>31.0.1.Final</wildfly-dist.version>
|
||||||
|
<wildfly.version>5.0.1.Final</wildfly.version>
|
||||||
<awaitility.version>1.7.0</awaitility.version>
|
<awaitility.version>1.7.0</awaitility.version>
|
||||||
<undertow-websockets-jsr.version>1.4.6.Final</undertow-websockets-jsr.version>
|
<undertow-websockets-jsr.version>1.4.6.Final</undertow-websockets-jsr.version>
|
||||||
<resteasy.version>3.0.19.Final</resteasy.version>
|
<resteasy.version>3.0.19.Final</resteasy.version>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.baeldung.jersey.server.config.HelloBinding;
|
||||||
import jakarta.ws.rs.GET;
|
import jakarta.ws.rs.GET;
|
||||||
import jakarta.ws.rs.POST;
|
import jakarta.ws.rs.POST;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.Produces;
|
||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
@Path("/greetings")
|
@Path("/greetings")
|
||||||
|
@ -17,6 +18,7 @@ public class Greetings {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
|
@Produces("text/html")
|
||||||
@Path("/hi")
|
@Path("/hi")
|
||||||
public String getHiGreeting() {
|
public String getHiGreeting() {
|
||||||
return "hi";
|
return "hi";
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
package com.baeldung.jersey.server;
|
package com.baeldung.jersey.server;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.glassfish.jersey.server.ResourceConfig;
|
import org.glassfish.jersey.server.ResourceConfig;
|
||||||
import org.glassfish.jersey.test.JerseyTest;
|
import org.glassfish.jersey.test.JerseyTest;
|
||||||
import org.glassfish.jersey.test.TestProperties;
|
import org.glassfish.jersey.test.TestProperties;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import jakarta.ws.rs.core.Application;
|
import jakarta.ws.rs.core.Application;
|
||||||
import jakarta.ws.rs.core.HttpHeaders;
|
import jakarta.ws.rs.core.HttpHeaders;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
public class GreetingsResourceIntegrationTest extends JerseyTest {
|
class GreetingsResourceIntegrationTest extends JerseyTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Application configure() {
|
protected Application configure() {
|
||||||
|
@ -21,14 +21,14 @@ public class GreetingsResourceIntegrationTest extends JerseyTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenGetHiGreeting_whenCorrectRequest_thenResponseIsOkAndContainsHi() {
|
void givenGetHiGreeting_whenCorrectRequest_thenResponseIsOkAndContainsHi() {
|
||||||
Response response = target("/greetings/hi").request()
|
Response response = target("/greetings/hi").request()
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertEquals("Http Response should be 200: ", Response.Status.OK.getStatusCode(), response.getStatus());
|
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
|
||||||
assertEquals("Http Content-Type should be: ", MediaType.TEXT_HTML, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
|
assertEquals(MediaType.TEXT_HTML, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
|
||||||
|
|
||||||
String content = response.readEntity(String.class);
|
String content = response.readEntity(String.class);
|
||||||
assertEquals("Content of ressponse is: ", "hi", content);
|
assertEquals("hi", content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ package com.baeldung.jersey.server.rest;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.allOf;
|
import static org.hamcrest.CoreMatchers.allOf;
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.glassfish.jersey.test.JerseyTest;
|
import org.glassfish.jersey.test.JerseyTest;
|
||||||
import org.glassfish.jersey.test.TestProperties;
|
import org.glassfish.jersey.test.TestProperties;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.baeldung.jersey.server.config.ViewApplicationConfig;
|
import com.baeldung.jersey.server.config.ViewApplicationConfig;
|
||||||
import com.baeldung.jersey.server.model.Fruit;
|
import com.baeldung.jersey.server.model.Fruit;
|
||||||
|
@ -19,7 +19,7 @@ import jakarta.ws.rs.core.Form;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
public class FruitResourceIntegrationTest extends JerseyTest {
|
class FruitResourceIntegrationTest extends JerseyTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Application configure() {
|
protected Application configure() {
|
||||||
|
@ -33,80 +33,80 @@ public class FruitResourceIntegrationTest extends JerseyTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenGetAllFruit_whenCorrectRequest_thenAllTemplateInvoked() {
|
void givenGetAllFruit_whenCorrectRequest_thenAllTemplateInvoked() {
|
||||||
final String response = target("/fruit/all").request()
|
final String response = target("/fruit/all").request()
|
||||||
.get(String.class);
|
.get(String.class);
|
||||||
assertThat(response, allOf(containsString("banana"), containsString("apple"), containsString("kiwi")));
|
assertThat(response, allOf(containsString("banana"), containsString("apple"), containsString("kiwi")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenGetFruit_whenCorrectRequest_thenIndexTemplateInvoked() {
|
void givenGetFruit_whenCorrectRequest_thenIndexTemplateInvoked() {
|
||||||
final String response = target("/fruit").request()
|
final String response = target("/fruit").request()
|
||||||
.get(String.class);
|
.get(String.class);
|
||||||
assertThat(response, containsString("Welcome Fruit Index Page!"));
|
assertThat(response, containsString("Welcome Fruit Index Page!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenGetFruitByName_whenFruitUnknown_thenErrorTemplateInvoked() {
|
void givenGetFruitByName_whenFruitUnknown_thenErrorTemplateInvoked() {
|
||||||
final String response = target("/fruit/orange").request()
|
final String response = target("/fruit/orange").request()
|
||||||
.get(String.class);
|
.get(String.class);
|
||||||
assertThat(response, containsString("Error - Fruit not found: orange!"));
|
assertThat(response, containsString("Error - Fruit not found: orange!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenCreateFruit_whenFormContainsNullParam_thenResponseCodeIsBadRequest() {
|
void givenCreateFruit_whenFormContainsNullParam_thenResponseCodeIsBadRequest() {
|
||||||
Form form = new Form();
|
Form form = new Form();
|
||||||
form.param("name", "apple");
|
form.param("name", "apple");
|
||||||
form.param("colour", null);
|
form.param("colour", null);
|
||||||
Response response = target("fruit/create").request(MediaType.APPLICATION_FORM_URLENCODED)
|
Response response = target("fruit/create").request(MediaType.APPLICATION_FORM_URLENCODED)
|
||||||
.post(Entity.form(form));
|
.post(Entity.form(form));
|
||||||
|
|
||||||
assertEquals("Http Response should be 400 ", 400, response.getStatus());
|
assertEquals(400, response.getStatus());
|
||||||
assertThat(response.readEntity(String.class), containsString("Fruit colour must not be null"));
|
assertThat(response.readEntity(String.class), containsString("Fruit colour must not be null"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenCreateFruit_whenJsonIsCorrect_thenResponseCodeIsCreated() {
|
void givenCreateFruit_whenJsonIsCorrect_thenResponseCodeIsCreated() {
|
||||||
Response response = target("fruit/created").request()
|
Response response = target("fruit/created").request()
|
||||||
.post(Entity.json("{\"name\":\"strawberry\",\"weight\":20}"));
|
.post(Entity.json("{\"name\":\"strawberry\",\"weight\":20}"));
|
||||||
|
|
||||||
assertEquals("Http Response should be 201 ", Response.Status.CREATED.getStatusCode(), response.getStatus());
|
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
|
||||||
assertThat(response.readEntity(String.class), containsString("Fruit saved : Fruit [name: strawberry colour: null]"));
|
assertThat(response.readEntity(String.class), containsString("Fruit saved : Fruit [name: strawberry colour: null]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenUpdateFruit_whenFormContainsBadSerialParam_thenResponseCodeIsBadRequest() {
|
void givenUpdateFruit_whenFormContainsBadSerialParam_thenResponseCodeIsBadRequest() {
|
||||||
Form form = new Form();
|
Form form = new Form();
|
||||||
form.param("serial", "2345-2345");
|
form.param("serial", "2345-2345");
|
||||||
|
|
||||||
Response response = target("fruit/update").request(MediaType.APPLICATION_FORM_URLENCODED)
|
Response response = target("fruit/update").request(MediaType.APPLICATION_FORM_URLENCODED)
|
||||||
.put(Entity.form(form));
|
.put(Entity.form(form));
|
||||||
|
|
||||||
assertEquals("Http Response should be 400 ", 400, response.getStatus());
|
assertEquals(400, response.getStatus());
|
||||||
assertThat(response.readEntity(String.class), containsString("Fruit serial number is not valid"));
|
assertThat(response.readEntity(String.class), containsString("Fruit serial number is not valid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenCreateFruit_whenFruitIsInvalid_thenResponseCodeIsBadRequest() {
|
void givenCreateFruit_whenFruitIsInvalid_thenResponseCodeIsBadRequest() {
|
||||||
Fruit fruit = new Fruit("Blueberry", "purple");
|
Fruit fruit = new Fruit("Blueberry", "purple");
|
||||||
fruit.setWeight(1);
|
fruit.setWeight(1);
|
||||||
|
|
||||||
Response response = target("fruit/create").request(MediaType.APPLICATION_JSON_TYPE)
|
Response response = target("fruit/create").request(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.post(Entity.entity(fruit, MediaType.APPLICATION_JSON_TYPE));
|
.post(Entity.entity(fruit, MediaType.APPLICATION_JSON_TYPE));
|
||||||
|
|
||||||
assertEquals("Http Response should be 400 ", 400, response.getStatus());
|
assertEquals(400, response.getStatus());
|
||||||
assertThat(response.readEntity(String.class), containsString("Fruit weight must be 10 or greater"));
|
assertThat(response.readEntity(String.class), containsString("Fruit weight must be 10 or greater"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenFruitExists_whenSearching_thenResponseContainsFruit() {
|
void givenFruitExists_whenSearching_thenResponseContainsFruit() {
|
||||||
Fruit fruit = new Fruit();
|
Fruit fruit = new Fruit();
|
||||||
fruit.setName("strawberry");
|
fruit.setName("strawberry");
|
||||||
fruit.setWeight(20);
|
fruit.setWeight(20);
|
||||||
Response response = target("fruit/create").request(MediaType.APPLICATION_JSON_TYPE)
|
Response response = target("fruit/create").request(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.post(Entity.entity(fruit, MediaType.APPLICATION_JSON_TYPE));
|
.post(Entity.entity(fruit, MediaType.APPLICATION_JSON_TYPE));
|
||||||
|
|
||||||
assertEquals("Http Response should be 204 ", 204, response.getStatus());
|
assertEquals(204, response.getStatus());
|
||||||
|
|
||||||
final String json = target("fruit/search/strawberry").request()
|
final String json = target("fruit/search/strawberry").request()
|
||||||
.get(String.class);
|
.get(String.class);
|
||||||
|
@ -114,28 +114,28 @@ public class FruitResourceIntegrationTest extends JerseyTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenFruitExists_whenSearching_thenResponseContainsFruitEntity() {
|
void givenFruitExists_whenSearching_thenResponseContainsFruitEntity() {
|
||||||
Fruit fruit = new Fruit();
|
Fruit fruit = new Fruit();
|
||||||
fruit.setName("strawberry");
|
fruit.setName("strawberry");
|
||||||
fruit.setWeight(20);
|
fruit.setWeight(20);
|
||||||
Response response = target("fruit/create").request(MediaType.APPLICATION_JSON_TYPE)
|
Response response = target("fruit/create").request(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.post(Entity.entity(fruit, MediaType.APPLICATION_JSON_TYPE));
|
.post(Entity.entity(fruit, MediaType.APPLICATION_JSON_TYPE));
|
||||||
|
|
||||||
assertEquals("Http Response should be 204 ", 204, response.getStatus());
|
assertEquals(204, response.getStatus());
|
||||||
|
|
||||||
final Fruit entity = target("fruit/search/strawberry").request()
|
final Fruit entity = target("fruit/search/strawberry").request()
|
||||||
.get(Fruit.class);
|
.get(Fruit.class);
|
||||||
|
|
||||||
assertEquals("Fruit name: ", "strawberry", entity.getName());
|
assertEquals("strawberry", entity.getName());
|
||||||
assertEquals("Fruit weight: ", Integer.valueOf(20), entity.getWeight());
|
assertEquals(Integer.valueOf(20), entity.getWeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenFruit_whenFruitIsInvalid_thenReponseContainsCustomExceptions() {
|
void givenFruit_whenFruitIsInvalid_thenReponseContainsCustomExceptions() {
|
||||||
final Response response = target("fruit/exception").request()
|
final Response response = target("fruit/exception").request()
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertEquals("Http Response should be 400 ", 400, response.getStatus());
|
assertEquals(400, response.getStatus());
|
||||||
String responseString = response.readEntity(String.class);
|
String responseString = response.readEntity(String.class);
|
||||||
assertThat(responseString, containsString("exception.<return value>.colour size must be between 5 and 200"));
|
assertThat(responseString, containsString("exception.<return value>.colour size must be between 5 and 200"));
|
||||||
assertThat(responseString, containsString("exception.<return value>.name size must be between 5 and 200"));
|
assertThat(responseString, containsString("exception.<return value>.name size must be between 5 and 200"));
|
||||||
|
|
Loading…
Reference in New Issue