marketplace/bundles/pm-dev-java/skills/junit-integration/SKILL.md
Maven integration testing with Failsafe plugin, IT naming conventions, and profile configuration
npx skillsauth add cuioss/plan-marshall junit-integrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
REFERENCE MODE: This skill provides reference material. Load specific standards on-demand based on current task.
Integration testing standards for Maven projects using the Failsafe plugin. This skill covers test separation, naming conventions, and profile configuration.
This skill applies to Maven projects:
maven-surefire-plugin (unit tests)maven-failsafe-plugin (integration tests)Integration tests should be completely separated from unit tests to ensure:
test phaseintegration-test and verify phasesIntegration tests must follow Maven's standard naming conventions:
**/*IT.java - Integration Test classes**/*ITCase.java - Alternative integration test naming// Preferred: Correct naming
public class TokenKeycloakIT extends KeycloakITBase {
// Integration test implementation
}
// Avoid: Incorrect naming (would be treated as unit test)
public class TokenKeycloakITTest extends KeycloakITBase {
// This follows unit test naming convention
}
Configure surefire plugin to exclude integration tests from normal builds:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*IT.java</exclude>
<exclude>**/*ITCase.java</exclude>
</excludes>
</configuration>
</plugin>
Create a dedicated profile for integration tests:
<profile>
<id>integration-tests</id>
<build>
<plugins>
<!-- Skip Surefire Plugin (unit tests) when running integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- Maven Failsafe Plugin for Integration Tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Problem: Without explicit unit test skipping, the integration-tests profile would run:
Solution: Configure surefire to skip tests when the integration-tests profile is active.
Both goals are required for proper integration test execution:
integration-test: Runs the integration testsverify: Checks the results and fails the build if tests failedBuild commands are resolved via the architecture API — never hardcode build tool invocations.
architecture resolve --command module-testsarchitecture resolve --command verifyarchitecture resolve --command integration-testsEnsure both scenarios work correctly:
Integration tests can use JUnit 5 nested test classes. The naming convention applies to the outer class:
public class TokenKeycloakIT {
@Nested
class AccessTokenTests {
@Test
void shouldValidateAccessToken() {
// Test implementation
}
}
@Nested
class IdTokenTests {
@Test
void shouldValidateIdToken() {
// Test implementation
}
}
}
External Integration Testing (load for Docker-based IT):
Read: standards/external-integration-testing.md
Use when: Implementing external API integration tests with Docker containers, REST Assured over HTTPS, script-based lifecycle management, and management interface testing.
// Wrong - will be treated as unit test
public class TokenKeycloakITTest { }
Without <skipTests>true</skipTests> in the integration-tests profile, both unit and integration tests will run.
Integration tests require the verify goal (runs failsafe). The test goal only runs surefire (unit tests) — it will not execute *IT.java files even with the integration-tests profile active.
Without proper <executions> configuration, failsafe tests might not run or results might not be verified.
*IT.java)pm-dev-java:junit-core - JUnit 5 core patternspm-dev-java:java-cdi - CDI patterns and container configurationtools
Plan-marshall-domain implementor of the ext-self-review-{domain} extension point. Surfaces deterministic candidates (regexes, user-facing strings, markdown sections, symmetric-pair functions, flag-guard pairs, contract sources, schema-bearing files) for pre-submission structural self-review.
development
The single shared contract every untrusted-external-content ingestion surface loads — reader/orchestrator/writer isolation, the deterministic validator script as the containment boundary, and the output-schema discipline for candidate structs parsed from web pages, GitHub issue/PR/comment bodies, and Sonar issue messages
development
Domain-invariant recipe for deliberate wide-scope simplification campaigns across a scope x thoroughness cell, with a T4+ relation-graph pre-deliverable
testing
A test skill for README generation