Skip to content

Increase JaCoCo coverage from 78.7% to 85.2%#55

Merged
brunoborges merged 2 commits intomainfrom
copilot/maint-increase-jacoco-coverage
Apr 6, 2026
Merged

Increase JaCoCo coverage from 78.7% to 85.2%#55
brunoborges merged 2 commits intomainfrom
copilot/maint-increase-jacoco-coverage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

Resolves #54


Before the change?

  • JaCoCo line coverage sat at 78.7% after PR Update JaCoCo coverage badge #53 merged new features (commands, elicitation, capabilities, agent APIs) with no corresponding unit tests.

After the change?

New test files

  • TelemetryConfigTest — all getters/setters for TelemetryConfig
  • AgentInfoTest — all getters/setters for AgentInfo
  • ModelInfoTestModelInfo reasoning effort fields, ModelSupports.isReasoningEffort(), SessionMetadata getters
  • DataObjectCoverageTest — records (GetForegroundSessionResponse, SetForegroundSessionResponse, PostToolUseHookOutput, ToolBinaryResult), PreToolUseHookOutput factory 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, SubagentDeselectedEvent
  • ConfigCloneTestCopilotClientOptions edge cases (deprecated autoRestart/githubToken, setCliArgs(null) clear, setEnvironment(null) clear, setTelemetry, setUseLoggedInUser(null)→FALSE); all 9 previously untested ResumeSessionConfig setters
  • CommandsTestCommandWireDefinition fluent setter chains
  • CliServerManagerTest — telemetry env-var injection path (COPILOT_OTEL_*) including getCaptureContent() == false branch
  • RpcHandlerDispatcherTestsystemMessage.transform handler: unknown session, null session ID, and known session with passthrough sections
  • SessionRequestBuilderTestconfigureSession null-config early return; command/elicitation/onEvent registration branches for both SessionConfig and ResumeSessionConfig

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • mvn spotless:apply has been run to format the code
  • mvn clean verify passes locally

Does this introduce a breaking change?

  • Yes
  • No

Copilot AI linked an issue Apr 6, 2026 that may be closed by this pull request
1 task
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
Copilot AI requested a review from edburns April 6, 2026 21:52
@brunoborges brunoborges marked this pull request as ready for review April 6, 2026 22:32
Copilot AI review requested due to automatic review settings April 6, 2026 22:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));
}
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Collaborator

@brunoborges brunoborges left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@brunoborges brunoborges merged commit 8a2cfd7 into main Apr 6, 2026
12 of 13 checks passed
Copilot stopped work on behalf of brunoborges due to an error April 6, 2026 22:46
Copilot AI requested a review from brunoborges April 6, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MAINT]: Increase JaCoCo numbers

4 participants