Skip to content

Commit b778794

Browse files
committed
Document AnonymousApplicationBuilder testing pattern in CLAUDE.md
1 parent 80b7d3d commit b778794

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ When creating or modifying MCP tools:
133133
- AssertJ fluent: `assertThat(x).isEqualTo(y)` not `assertEquals(y, x)`
134134
- Naming: `methodName_should_expectedBehavior_when_condition()`
135135
- Example: `getVulnerability_should_return_data_when_valid_id()`
136+
- **Anonymous builders**: Use `AnonymousXxxBuilder` pattern for complex mocks (see `AnonymousApplicationBuilder.java`)
137+
- Provides valid defaults for all fields with lenient stubbing
138+
- Tests only specify fields they care about: `AnonymousApplicationBuilder.validApp().withName("MyApp").build()`
139+
- Avoids over-mocking anti-pattern and UnnecessaryStubbingException
136140

137141
### Security Considerations
138142

0 commit comments

Comments
 (0)