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 @QuarkusTesttools
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