Excavator: Migrate Groovy nebula test CreateManifestTaskIntegrationSpec to the new Java Junit framework#1943
Open
svc-excavator-bot wants to merge 1 commit intodevelopfrom
Conversation
e563263 to
cbfa2ae
Compare
…pec` to the new Java Junit framework
cbfa2ae to
9182cdf
Compare
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.
excavator is a bot for automating changes across repositories.
Changes produced by the roomba/migrate-gradle-testing-junit-framework check.
A formatted diff between the old and new test has been generated at test-migration-notes/CreateManifestTaskIntegrationSpec.html)
To view the rendered diff, copy the branch name above, click here, and then replace the BRANCH_NAME part of the URL with the branch name.
🤖 🤖 This PR was created using Claude-code 🤖 🤖
Model:
opusClaude Execution Message
Claude finished running successfully.
The migration is complete. Here's a summary of what was done:
Migrated:
CreateManifestTaskIntegrationSpec.groovy->CreateManifestTaskIntegrationTest.javaAll 9 test methods migrated:
fails_if_lockfile_is_not_up_to_datefails_if_unexpected_lockfile_existsfails_if_lock_file_disappearsfails_if_lockfile_has_changed_contentsalways_write_project_version_as_minimum_version_in_product_dependency_that_is_published_by_this_repowrites_locks_when_write_locks_task_is_on_the_command_line(parameterized with@MethodSource)write_artifacts_to_manifestfails_if_invalidwrite_artifacts_to_manifest_from_task_outputcheck_depends_on_create_manifestPlus the
readArtifactsExtensionhelper method and@BeforeEach setup.Key migration decisions:
where:data tables withGradleTestVersions.GRADLE_VERSIONSremoved (framework handles multi-version automatically)writes_lockstest's cross-product of gradle versions + task names simplified to only parameterize by task name via@MethodSourcePDEPconstant kept as a class-levelprivate static final StringrootProject.subproject()since names contain hyphens (can't be Java parameter names).as()descriptions added to all assertions for better failure messagesClaude Code Metrics
Migration Notes
Test Migration Errors: CreateManifestTaskIntegrationSpec
Compilation Errors
1. Unreported exception JsonProcessingException in readArtifactsExtension
Error:
unreported exception JsonProcessingException; must be caught or declared to be thrownCause: The
ObjectMappers.jsonMapper.readValue()call throws a checkedJsonProcessingException(subclass ofIOException). The private helper methodreadArtifactsExtensionneeded to handle this.Fix: Wrapped the
readValuecall in a try-catch block catchingIOExceptionand rethrowing asUncheckedIOException.2. Error Prone: PreferUncheckedIoException
Error:
[PreferUncheckedIoException] Prefer UncheckedIOException or SafeUncheckedIoException when wrapping IOExceptionCause: Initially wrapped the IOException in
RuntimeExceptioninstead ofUncheckedIOException.Fix: Changed
throw new RuntimeException(e)tothrow new UncheckedIOException(e)and added the proper import.3. Error Prone: StringConcatToTextBlock
Error:
[StringConcatToTextBlock] This string literal can be written more clearly as a text blockCause: The lock file content for
barServer.file("product-dependencies.lock")was written as a string concatenation instead of a text block.Fix: Converted the string concatenation to a Java text block.
Second Pass Review Changes
4. Added
.as()descriptions to assertionsChange: Added
.as("description")calls to all assertions in "then" blocks that were missing them.Reason: The testing guide and migration instructions specify that
.as()should be used instead of code comments so that descriptions appear in assertion failure messages. Added descriptions to:fails_if_lockfile_is_not_up_to_date:.as("error message about out of date lock file")fails_if_invalid:.as("error message about invalid uri")writes_locks_when_write_locks_task_is_on_the_command_line:.as("createManifest was executed")on task assertionwrite_artifacts_to_manifest:.as("createManifest was executed")on task assertioncheck_depends_on_create_manifest:.as("check depends on createManifest")5. Cleaned up UncheckedIOException import
Change: Added
import java.io.UncheckedIOExceptionand replaced the fully-qualifiedjava.io.UncheckedIOExceptionreference.Reason: Better code style to use the import rather than fully-qualified class name.
No Additional Changes on Third Pass
The third review pass found no further issues. All best practices from the testing guide are followed.
To enable or disable this check, please contact the maintainers of Excavator.