You are an expert Java developer tasked with analyzing test coverage for this Java SDK. Your goal is to produce a comprehensive report of what is tested and what gaps exist.
Analyze the test coverage of the SDK by examining:
- Event types - All session events defined in
SessionEventParser - Hook types - All hooks defined in
SessionHooks - Core functionality - Session management, tools, permissions, etc.
First, examine the source code to identify all components that should be tested:
# List all event classes
ls src/main/java/com/github/copilot/sdk/events/
# Check the event type mapping in SessionEventParser
grep -n "TYPE_MAP.put" src/main/java/com/github/copilot/sdk/events/SessionEventParser.javaExtract the list of all registered event types from SessionEventParser.java.
Check SessionHooks.java for all available hook handlers:
grep -E "private.*Handler" src/main/java/com/github/copilot/sdk/json/SessionHooks.javaExamine the test files to understand current coverage:
# List all test files
ls src/test/java/com/github/copilot/sdk/
# Check for event-related tests
grep -r "import.*events\." src/test/java/com/github/copilot/sdk/ | grep -v "\.class"
# Check for hook tests
grep -l "SessionHooks\|Hook" src/test/java/com/github/copilot/sdk/*.javaFor each component, determine:
- Unit Test Coverage: Tests that verify JSON parsing/serialization without E2E flow
- E2E Test Coverage: Tests that verify the component works in a real session flow
Generate a comprehensive report in the following format:
| Event Type | Event Class | Unit Test | E2E Test | Notes |
|---|---|---|---|---|
session.start |
SessionStartEvent |
✅/❌ | ✅/❌ | Any notes |
| ... | ... | ... | ... | ... |
| Hook Type | Handler Interface | Unit Test | E2E Test | Notes |
|---|---|---|---|---|
preToolUse |
PreToolUseHandler |
✅/❌ | ✅/❌ | Any notes |
| ... | ... | ... | ... | ... |
| Category | Total | Unit Tested | E2E Tested | Coverage % |
|---|---|---|---|---|
| Events | X | X | X | X% |
| Hooks | X | X | X | X% |
List components that lack tests:
- Missing Unit Tests: Components without JSON parsing tests
- Missing E2E Tests: Components not exercised in integration tests
- Partially Tested: Components with incomplete test coverage
Prioritized list of tests to add:
- High priority: Critical paths without coverage
- Medium priority: Common use cases without coverage
- Low priority: Edge cases and rare events
src/main/java/com/github/copilot/sdk/events/SessionEventParser.java- Event type registrysrc/main/java/com/github/copilot/sdk/json/SessionHooks.java- Hook definitionssrc/main/java/com/github/copilot/sdk/CopilotSession.java- Hook handling logicsrc/test/java/com/github/copilot/sdk/SessionEventParserTest.java- Event parsing testssrc/test/java/com/github/copilot/sdk/SessionEventsE2ETest.java- Event E2E testssrc/test/java/com/github/copilot/sdk/HooksTest.java- Hook testssrc/test/java/com/github/copilot/sdk/SessionEventHandlingTest.java- Event handling tests
After producing the report, verify by running:
# Count total tests
mvn test 2>&1 | grep "Tests run:"
# Run specific test categories
mvn test -Dtest=SessionEventParserTest
mvn test -Dtest=SessionEventsE2ETest
mvn test -Dtest=HooksTestProvide:
- The complete coverage report in markdown table format
- A prioritized list of recommended improvements
- Optionally: Skeleton test code for missing high-priority tests