Commit a633693
fix: resolve unit test performance issue and update documentation
## Critical Fixes
### Unit Test Performance (src/main/kotlin/it/saabel/kotlinnotionclient/NotionClient.kt)
- Fixed critical bug where unit tests timed out (2+ minutes → 400ms)
- Root cause: `createWithClient()` used reflection and created real HTTP client before replacing with mock
- Solution: Refactored to use constructor-based dependency injection
- Removed reflection hack, now uses clean `@JvmOverloads` constructor pattern
- Tests now complete in ~400ms as expected for mocked tests
### Client Instantiation Pattern
- Made primary constructor public with optional HttpClient parameter
- Supports both patterns:
- `NotionClient(apiToken)` - Direct constructor (idiomatic Kotlin)
- `NotionClient.create(apiToken)` - Factory method (also supported)
- No deprecation - both are first-class citizens
## Documentation Updates
### Updated All Documentation to Constructor Pattern
- README.md: Added client initialization section, shows both patterns
- QUICKSTART.md: Updated examples, fixed old package name (no.saabelit → it.saabel)
- docs/*.md: Updated 6 API doc files (blocks, error-handling, notebooks, search, testing, users)
- All examples now use `NotionClient(token)` as primary pattern
- Clearly documents that both patterns are fully supported
### Integration Tests
- Updated 13 integration test files to use constructor pattern
- Files: All pagination tests, DataSourcesIntegrationTest, DatabaseQueryIntegrationTest,
EnhancedFileUploadIntegrationTest, NotionClientIntegrationTest, RateLimitVerificationTest
- Pattern: `NotionClient.create(NotionConfig(...))` → `NotionClient(NotionConfig(...))`
## Developer Experience Improvements
- Added journal entry documenting DX exploration session findings
- Removed obsolete phase completion files (PHASE1_COMPLETE.md, PRE_PUBLICATION_SECURITY_REVIEW.md, README-DRAFT.md)
- Added docs/notebooks.md for Jupyter notebook integration examples
## Verification
- ✅ All unit tests pass (~400ms execution time)
- ✅ Build succeeds
- ✅ Documentation consistent across all files
- ✅ Both instantiation patterns work correctly
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 3229147 commit a633693
File tree
40 files changed
+1021
-863
lines changed- docs
- journal
- src
- main/kotlin/it/saabel/kotlinnotionclient
- test/kotlin/integration
- dsl
- pagination
40 files changed
+1021
-863
lines changedThis file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
42 | 62 | | |
43 | 63 | | |
44 | 64 | | |
| |||
226 | 246 | | |
227 | 247 | | |
228 | 248 | | |
229 | | - | |
| 249 | + | |
230 | 250 | | |
231 | 251 | | |
232 | 252 | | |
0 commit comments