Add unit tests for ToolInvocation to achieve 100% coverage#122
Merged
brunoborges merged 6 commits intomainfrom Feb 11, 2026
Merged
Add unit tests for ToolInvocation to achieve 100% coverage#122brunoborges merged 6 commits intomainfrom
brunoborges merged 6 commits intomainfrom
Conversation
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve coverage for ToolInvocation in JaCoCo report
Add unit tests for ToolInvocation to achieve 100% coverage
Feb 11, 2026
brunoborges
approved these changes
Feb 11, 2026
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
…dk-tests-workflow Fix Spotless formatting violations in ToolInvocationTest
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.
ToolInvocation class had 61% instruction coverage with untested getter methods and the
getArgumentsAs()type-safe deserialization path.Changes
Created
ToolInvocationTest.javawith unit tests covering:getSessionId,getToolCallId,getToolName)getArguments()null branch handlinggetArgumentsAs(Class<T>)type-safe deserialization with records and POJOsResult
Coverage improved to 100% instruction and branch coverage (68/68 instructions, 2/2 branches).
Example
The tests exercise type-safe argument deserialization patterns:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
checkstyle.org/opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/copilot-sdk-java/.codeql-scratch/dbs/java/working/files-to-index7452523704395560700.list --sourceArchiveDir=/home/REDACTED/work/copilot-sdk-java/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/copilot-sdk-java/.codeql-scratch/dbs/java/trap/java which n-Hotspot_jdk/17.0.18-8/x64/bin/git DROP which de/node/bin/git which git b/copilot/sdk/ToolInvocationTest.java git which --show-toplevel urin-17-jdk-amd6show 4/lib/jspawnhelp6a68d9fde75e0670d1e2892ef9a287aa1ea71f41:src/test/java/com/github/copilot/sdk/ToolInvocationTest.java node(dns block)https://api.github.com/copilot_internal/user/home/REDACTED/work/copilot-sdk-java/copilot-sdk-java/target/copilot-sdk/test/harness/node_modules/@github/copilot-linux-x64/copilot /home/REDACTED/work/copilot-sdk-java/copilot-sdk-java/target/copilot-sdk/test/harness/node_modules/@github/copilot-linux-x64/copilot --server --no-auto-update --log-level info --stdio --auth-token-env COPILOT_SDK_AUTH_TOKEN --no-auto-login(http block)/home/REDACTED/work/copilot-sdk-java/copilot-sdk-java/target/copilot-sdk/test/harness/node_modules/@github/copilot-linux-x64/copilot /home/REDACTED/work/copilot-sdk-java/copilot-sdk-java/target/copilot-sdk/test/harness/node_modules/@github/copilot-linux-x64/copilot --server --no-auto-update --log-level info --stdio --auth-token-env COPILOT_SDK_AUTH_TOKEN --no-auto-login apache-maven-3.9rev-parse ory=/home/REDACTED--show-toplevel launcher.Launcher va/c��(http block)/home/REDACTED/work/copilot-sdk-java/copilot-sdk-java/target/copilot-sdk/test/harness/node_modules/@github/copilot-linux-x64/copilot /home/REDACTED/work/copilot-sdk-java/copilot-sdk-java/target/copilot-sdk/test/harness/node_modules/@github/copilot-linux-x64/copilot --server --no-auto-update --log-level info --stdio --auth-token-env COPILOT_SDK_AUTH_TOKEN --no-auto-login ame e/git sh -c tsx server.ts e/git de/node/bin/which(http block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.