marketplace/bundles/pm-dev-java/skills/junit-weld-testing/SKILL.md
Weld Testing standards for CDI unit testing with @EnableAutoWeld, @AddBeanClasses, and auto-discovery patterns
npx skillsauth add cuioss/plan-marshall junit-weld-testingInstall 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.
Standards for CDI unit testing using weld-testing. This skill covers auto-weld configuration, bean class management, and CDI test patterns using JUnit 5.
This skill applies to Java projects using Weld Testing with JUnit 5:
org.jboss.weld:weld-junit5 (Weld JUnit 5 extension)org.jboss.weld:weld-junit-parent (parent module)<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-junit5</artifactId>
<scope>test</scope>
</dependency>
Important: Load this standard for any CDI unit testing work with Weld.
Read: standards/weld-testing-autowired.md
This provides rules for:
@EnableAutoWeld annotation and auto-discovery@AddBeanClasses / @AddPackages for explicit bean registration@ActivateScopes for scope management in tests@ExcludeBeanClasses for swapping implementations with test doubles@EnableWeld with WeldInitiator for manual control| Scenario | Annotation | Example |
|----------|-----------|---------|
| Simple service test | @EnableAutoWeld | Auto-discovers injected beans |
| Need producers/interceptors | + @AddBeanClasses | Beans not directly injected |
| Many beans from one package | + @AddPackages | Package-level registration |
| Replace with test double | + @ExcludeBeanClasses + @AddBeanClasses | Swap real for mock |
| Scoped beans (Request, Session) | + @ActivateScopes | Scope not active by default |
| Full manual control | @EnableWeld + @WeldSetup | WeldInitiator configuration |
| Error | Cause | Fix |
|-------|-------|-----|
| UnsatisfiedResolutionException | Bean not discovered | Add via @AddBeanClasses |
| ContextNotActiveException | Missing scope activation | Add @ActivateScopes |
| AmbiguousResolutionException | Multiple implementations | Use @ExcludeBeanClasses |
| Test passes alone, fails in suite | Shared static state | Ensure proper scoping |
CDI test class — starting point for new Weld-based test classes:
Read: templates/cdi-test-class.java.tmpl
Replace ${PACKAGE}, ${CLASS_UNDER_TEST}, ${METHOD_1}, and placeholder comments. Uncomment @AddBeanClasses or @ActivateScopes as needed.
pm-dev-java:java-cdi - CDI patterns (injection, scopes, producers, events)pm-dev-java:junit-core - JUnit 5 core testing patternspm-dev-java:java-quarkus - Quarkus-specific testing with @QuarkusTestdevelopment
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