Commit 6a2bc45
refactor: Add fail-fast validation for BeanContainer in StaticAuthApplier
Add notNull validation at constructor entry point and simplify createAuthorizationFromAnnotation
by removing redundant null check, following the fail-fast principle.
**Changes:**
- Add `notNull(beanContainer, "The bean container cannot be null.")` in constructor
- Remove redundant null check in createAuthorizationFromAnnotation method
- BeanContainer is guaranteed non-null by AnnotationParser, validate early at entry point
**Benefits:**
- ✅ Fail-fast: Errors detected immediately at construction time
- ✅ Clearer contract: BeanContainer is required, not optional
- ✅ Simplified logic: No need for null check in private method
- ✅ Consistent validation: Follows same pattern as AnnotationParser
**Testing:**
✅ AuthFieldMapperTest: 8/8 tests pass
✅ No behavioral changes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 570595e commit 6a2bc45
1 file changed
Lines changed: 4 additions & 6 deletions
File tree
- framework/fit/java/fit-builtin/services/fit-http-classic/definition/src/main/java/modelengine/fit/http/client/proxy/support/applier
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 51 | | |
54 | 52 | | |
55 | 53 | | |
| |||
0 commit comments