Skip to content

[Java] Tool-as-lambda 4.4: Add unit tests for API behavior and validation #1842

Description

@edburns

Base branch: Create your PR targeting upstream/edburns/1810-java-tool-ergonomics-tool-as-lambda (not main).

Requirement: When you open the PR, the very first thing you put in the description must be Fixes #1842 where the issue number is this issue for which the PR aims to implement the work.


Requirement: When you open the PR, the very first thing you put in the description must be Fixes #1842 where the issue number is this issue for which the PR aims to implement the work.

Overview

Implement Phase 4.4 of #1810: add focused unit tests for lambda tool API behavior, options propagation, and validation paths.

Before coding

  • Do not start any implementation work until this issue is explicitly assigned to the coding agent.
  • Base branch for this work:
    edburns/1810-java-tool-ergonomics-tool-as-lambda.
  • Read this plan file on the branch before coding:
    1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/1810-ignorance-reduction-for-implementation-plan.md

Ordering rule (important)

This issue starts only after 4.3 is merged; all Phase 4 issues are completed in listed order.

Relevant Phase 3 resolutions to apply

  • 3.1 / 3.2: assert resolved overload families and lambda call-site behavior.
  • 3.3: test Param<T> validation semantics and required/default interactions.
  • 3.5: verify coercion behavior is consistent with existing ObjectMapper policy.
  • 3.6: verify fluent option modifiers (overridesBuiltInTool, skipPermission, defer) propagate correctly.
  • 3.7: verify construction-time validation failures and message quality.

Scope / deliverables

Add deterministic tests under java/src/test/java/com/github/copilot/tool/ and/or closely-related existing test packages covering:

  1. Successful inline definitions across supported arities.
  2. Sync and async handlers.
  3. Option flag propagation.
  4. Required/default semantics.
  5. Error/validation paths.

Gating criteria

  • Tests cover both success and failure paths and are deterministic.
  • Coverage is sufficient to protect the 4.2/4.3 contract.

Constraints

IMPORTANT: you must run mvn spotless:apply in the java directory before every commit.

  • Keep tests focused on API behavior and validation for lambda tools.
  • Avoid unrelated test churn.

Completion bookkeeping

When complete, update the checkbox for Phase 4.4 in:
1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/1810-ignorance-reduction-for-implementation-plan.md

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions