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 configurationdevelopment
Domain-owned OpenRewrite log-line finding parser for the java-cui domain — parses the
development
Domain-owned OpenRewrite marker detection for the java-cui domain — scans Java/Kotlin sources for cui-rewrite TODO markers, categorizes them by recipe, and fails the gate on any detected marker
development
Operator control surface for the marshalld build server — enrol/drop a project in the machine-global registry (the opt-in enable signal and anti-laundering wall), manage the daemon lifecycle (start, stop, drain, status, install, upgrade) version-pinned to the verified bundle copy, and inspect the daemon's per-project interaction-audit log (read-only)
tools
The tiny build-consumption client for the marshalld build server — submit a build job, bounded long-poll for its result, ping the daemon identity, and preflight registry-plus-liveness in one call; consumption only, never provisioning or enrolment