Skip to content

Add direct tests for setup action orchestration #1158

Description

@brunoborges

Summary

Add direct unit tests for the main orchestration in src/setup-java.ts. The distributor implementations have extensive coverage, but the action entrypoint itself currently runs on import and is not directly exercised by the test suite.

Proposed changes

  • Export run() and invoke it only when the module is the action entrypoint, following the pattern used by src/cleanup-java.ts.
  • Mock action inputs and collaborators to test orchestration without network access or JDK downloads.
  • Cover required-input validation for java-version, java-version-file, and distribution.
  • Cover version-file distribution inference.
  • Cover single- and multi-JDK installation order, Maven toolchain IDs, and final action outputs.
  • Cover sequencing of problem matcher, authentication, Maven arguments, and cache restoration.
  • Cover failure propagation through core.setFailed.

Acceptance criteria

  • Importing src/setup-java.ts in a test does not execute the action.
  • The action entrypoint has focused tests for the success and failure paths above.
  • Existing distributor and end-to-end behavior remains unchanged.
  • Coverage protects input parsing and collaborator sequencing from regressions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions