spring-test-slices: Spring Boot 4.1.2 test slices lab (@WebMvcTest, @JsonTest, @RestClientTest, @DataJpaTest vs @SpringBootTest)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7Jbw5CxUQ13D7gn25
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# Which Boot test jars does spring-boot-starter-test alone bring in?
|
||||
# Resolves a throwaway project with the three production starters and ONLY spring-boot-starter-test,
|
||||
# then lists every spring-boot jar with "test" in its name. Writes output/12-starter-test-only-jars.txt.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
BOOT="$(sed -n '/<artifactId>spring-boot-starter-parent<\/artifactId>/{n;s/.*<version>\(.*\)<\/version>.*/\1/p}' pom.xml)"
|
||||
TMP=target/starter-test-only
|
||||
rm -rf "$TMP" && mkdir -p "$TMP"
|
||||
cat > "$TMP/pom.xml" <<POM
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"><modelVersion>4.0.0</modelVersion>
|
||||
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>${BOOT}</version><relativePath/></parent>
|
||||
<groupId>probe</groupId><artifactId>starter-test-only</artifactId><version>1</version>
|
||||
<dependencies>
|
||||
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-webmvc</artifactId></dependency>
|
||||
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</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>
|
||||
</dependencies>
|
||||
</project>
|
||||
POM
|
||||
mvn -B -q -f "$TMP/pom.xml" dependency:build-classpath -Dmdep.outputFile=cp.txt > /dev/null 2>&1
|
||||
{
|
||||
echo "Spring Boot ${BOOT}: webmvc + data-jpa + restclient starters, and only spring-boot-starter-test for tests"
|
||||
echo "spring-boot jars with 'test' in the name on that classpath:"
|
||||
tr ':' '\n' < "$TMP/cp.txt" | sed 's#.*/##' | grep -E '^spring-boot.*test' | sed 's/^/ /'
|
||||
} > output/12-starter-test-only-jars.txt
|
||||
Reference in New Issue
Block a user