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.
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
run()and invoke it only when the module is the action entrypoint, following the pattern used bysrc/cleanup-java.ts.java-version,java-version-file, anddistribution.core.setFailed.Acceptance criteria
src/setup-java.tsin a test does not execute the action.