Increase JaCoCo coverage from 78.7% to 85.2%#55
Merged
brunoborges merged 2 commits intomainfrom Apr 6, 2026
Merged
Conversation
1 task
Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/ee2608f6-2d6c-477e-9f79-a2968dec2436 Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Increase JaCoCo numbers to regain coverage above 85%
Increase JaCoCo coverage from 78.7% to 85.2%
Apr 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR increases the repository’s JaCoCo line coverage back above the 85% target by adding and extending unit tests around DTOs, event parsing, and previously untested branching/edge-path logic introduced in the recent upstream sync work.
Changes:
- Add new unit test classes to cover DTO getters/setters, record constructors, and factory methods that previously had no coverage.
- Extend existing tests to cover additional branches in session request building/configuration, CLI server telemetry env-var injection, RPC handler dispatching, and event parse/round-trip behavior.
- Expand parser tests to include newly added session event types.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/github/copilot/sdk/TelemetryConfigTest.java | Adds coverage for TelemetryConfig getters/setters and fluent chaining. |
| src/test/java/com/github/copilot/sdk/AgentInfoTest.java | Adds coverage for AgentInfo getters/setters and fluent chaining. |
| src/test/java/com/github/copilot/sdk/ModelInfoTest.java | Adds coverage for ModelInfo reasoning-effort fields, ModelSupports flag, and SessionMetadata basics. |
| src/test/java/com/github/copilot/sdk/DataObjectCoverageTest.java | Adds coverage for several DTO/record types and hook output factory methods. |
| src/test/java/com/github/copilot/sdk/SessionEventParserTest.java | Extends parser coverage to include newly added event types plus setData “round-trip” paths. |
| src/test/java/com/github/copilot/sdk/ConfigCloneTest.java | Extends coverage for CopilotClientOptions edge cases and ResumeSessionConfig setters. |
| src/test/java/com/github/copilot/sdk/CommandsTest.java | Adds coverage for CommandWireDefinition setter behavior (including chaining). |
| src/test/java/com/github/copilot/sdk/CliServerManagerTest.java | Extends coverage for telemetry env-var injection branches during CLI startup. |
| src/test/java/com/github/copilot/sdk/RpcHandlerDispatcherTest.java | Adds tests for systemMessage.transform error paths and passthrough behavior. |
| src/test/java/com/github/copilot/sdk/SessionRequestBuilderTest.java | Adds tests covering configureSession branches and deprecated create-request overload behavior. |
Copilot's findings
- Files reviewed: 10/10 changed files
- Comments generated: 1
Comment on lines
+324
to
+330
| @Test | ||
| void configureSessionWithNullConfig_returnsEarly() { | ||
| // configureSession with null config should return without error | ||
| CopilotSession session = new CopilotSession("session-1", null); | ||
| // Covers the null config early-return branch (L219-220) | ||
| assertDoesNotThrow(() -> SessionRequestBuilder.configureSession(session, (SessionConfig) null)); | ||
| } |
There was a problem hiding this comment.
Avoid embedding source line numbers in test comments (e.g., "(L219-220)"); these become stale as SessionRequestBuilder evolves and add maintenance noise. Prefer describing the behavior/branch being exercised without referencing specific line numbers.
Copilot stopped work on behalf of
brunoborges due to an error
April 6, 2026 22:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #54
Before the change?
After the change?
New test files
TelemetryConfigTest— all getters/setters forTelemetryConfigAgentInfoTest— all getters/setters forAgentInfoModelInfoTest—ModelInforeasoning effort fields,ModelSupports.isReasoningEffort(),SessionMetadatagettersDataObjectCoverageTest— records (GetForegroundSessionResponse,SetForegroundSessionResponse,PostToolUseHookOutput,ToolBinaryResult),PreToolUseHookOutputfactory methods (deny(String),ask(),withModifiedArgs()),ToolResultObject.error(String, String),PermissionRequest.setExtensionData(),SectionOverride.setContent(), hook input getters,PermissionRequestResult.setRules()Extended existing test files
SessionEventParserTest— parse + round-trip for all 6 new event types:CapabilitiesChangedEvent,CommandExecuteEvent,ElicitationRequestedEvent,SessionContextChangedEvent,SessionTaskCompleteEvent,SubagentDeselectedEventConfigCloneTest—CopilotClientOptionsedge cases (deprecatedautoRestart/githubToken,setCliArgs(null)clear,setEnvironment(null)clear,setTelemetry,setUseLoggedInUser(null)→FALSE); all 9 previously untestedResumeSessionConfigsettersCommandsTest—CommandWireDefinitionfluent setter chainsCliServerManagerTest— telemetry env-var injection path (COPILOT_OTEL_*) includinggetCaptureContent() == falsebranchRpcHandlerDispatcherTest—systemMessage.transformhandler: unknown session, null session ID, and known session with passthrough sectionsSessionRequestBuilderTest—configureSessionnull-config early return; command/elicitation/onEvent registration branches for bothSessionConfigandResumeSessionConfigPull request checklist
mvn spotless:applyhas been run to format the codemvn clean verifypasses locallyDoes this introduce a breaking change?