Add testing-no-containers module: WireMock, MockWebServer, @MockitoBean/@MockitoSpyBean (post #43)
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>4.1.1</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<groupId>com.ankurm</groupId>
|
||||
<artifactId>testing-no-containers</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>testing-no-containers</name>
|
||||
<description>Testing Spring Boot 4 without containers: @MockitoBean/@MockitoSpyBean, WireMock fault injection, MockWebServer for RestClient, and context-cache behavior</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>25</java.version>
|
||||
<!-- org.wiremock:wiremock's 4.0.0 line is beta-only as of this writing (4.0.0-beta.1
|
||||
through 4.0.0-beta.40 on Maven Central): 3.13.2 is the real latest GA; see the post. -->
|
||||
<wiremock.version>3.13.2</wiremock.version>
|
||||
<mockwebserver.version>5.5.0</mockwebserver.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-restclient</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- WireMock: standalone HTTP server with fault injection, not managed by
|
||||
spring-boot-dependencies; pin it explicitly. The bare "wiremock" artifact no longer
|
||||
bundles a server in the 3.x line (FatalStartupException: "Jetty 11 is not present and
|
||||
no suitable HttpServerFactory extension was found"), and adding wiremock-jetty12 on top
|
||||
of it is worse, not better: wiremock's own transitive deps still drag in real Jetty 11
|
||||
modules (jetty-servlet, jetty-servlets, jetty-webapp, http2-server at 11.0.26) alongside
|
||||
wiremock-jetty12's Jetty 12 ones, Maven's dependency mediation then picks one jetty-io
|
||||
version for everyone, and the mismatched pair throws NoClassDefFoundError at server
|
||||
startup for a class as basic as org.eclipse.jetty.io.WriteFlusher$Listener. The fix is
|
||||
wiremock-standalone: a single shaded jar with its own relocated copy of Jetty
|
||||
(wiremock.org.eclipse.jetty.*), so nothing on your own classpath can clash with it;
|
||||
see the post. -->
|
||||
<dependency>
|
||||
<groupId>org.wiremock</groupId>
|
||||
<artifactId>wiremock-standalone</artifactId>
|
||||
<version>${wiremock.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- MockWebServer: OkHttp's own stub server, JUnit 5 extension flavor. Also not
|
||||
managed by spring-boot-dependencies. -->
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>mockwebserver3-junit5</artifactId>
|
||||
<version>${mockwebserver.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>testing-no-containers</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user