Skip to content

Test update-file-header on the former IT fixtures without a forked build - #830

Merged
slachiewicz merged 2 commits into
masterfrom
agent/license-header-unit
Nov 22, 2026
Merged

slachiewicz merged 2 commits into
masterfrom
agent/license-header-unit

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Stacked on #829, which lets unit tests load the license store on Java 9 and later. UpdateFileHeaderMojoTest replaces nine ITs (ISSUE-7, ISSUE-22, ISSUE-38, ISSUE-166, ISSUE-347, MLICENSE-3, MLICENSE-27, MLICENSE-30, MLICENSE-44) with all their assertions. MojoTestSupport configures the mojo from the generated plugin descriptor, so the @Parameter defaults and property expressions apply as in a build, and the tests run from the IDE after process-classes.

A second commit fixes a leak the Windows build exposed: LicenseRepository.checkExists left the file open after reading its content length, so the license files of a project could not be deleted afterwards.

Not moved: the ITs that bind the goal next to build-helper and resources (ISSUE-135, the two copyright-format ITs), update-file-header-test-mojo (file-type matrix) and the three update-project-license ITs.

Verified: mvn verify on JDK 17 → 243 tests, 0 failures; each moved behavior fails when its production line is broken.

@slachiewicz slachiewicz added the maintenance Cleanup, refactoring or other internal change label Nov 22, 2026
Base automatically changed from agent/license-store-own-repository to master November 22, 2026 17:16
@slachiewicz
slachiewicz force-pushed the agent/license-header-unit branch from a243b31 to 17c30c5 Compare November 22, 2026 18:26
@slachiewicz
slachiewicz marked this pull request as ready for review November 22, 2026 19:41

@slachiewicz slachiewicz left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Needs a fix: the MLICENSE-44 IT asserted the header of File4.java as well as File1–3, and File4.java is carried into the new test resources, but mlicense44UsesALicenseAndTemplateFromTheProject loops over File1–3 only. Add File4 to the loop or document why it is excluded. The other eight ITs' assertions map one-for-one and the checkExists stream close is sound.

@slachiewicz
slachiewicz force-pushed the agent/license-header-unit branch from 17c30c5 to 6dd3cf6 Compare November 22, 2026 20:30
UpdateFileHeaderMojoTest replaces nine ITs (ISSUE-7, ISSUE-22, ISSUE-38, ISSUE-166, ISSUE-347, MLICENSE-3, -27, -30, -44) and keeps every assertion. The mojo is configured from the generated plugin descriptor, so the @parameter defaults still apply. The ITs that need a real build (lifecycle bindings with other plugins, the broad file-type matrix) stay.
LicenseRepository.checkExists left the file open after reading its length, so on Windows a project's license directory could not be deleted afterwards, which failed UpdateFileHeaderMojoTest.mlicense44 in the JUnit temp directory clean-up.
@slachiewicz
slachiewicz force-pushed the agent/license-header-unit branch from 6dd3cf6 to 9a4acb8 Compare November 22, 2026 20:30
@slachiewicz
slachiewicz merged commit 63825f2 into master Nov 22, 2026
13 checks passed
@slachiewicz
slachiewicz deleted the agent/license-header-unit branch November 22, 2026 20:55
@github-actions github-actions Bot added this to the 2.9.1 milestone Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Cleanup, refactoring or other internal change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant