Excavator: Migrate Groovy nebula test CircleCiArtifactsTest to the new Java Junit framework
#525
+3,500
−137
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/CircleCiArtifactsTest.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 🤖 🤖
Claude Execution Message
Claude finished running successfully.
Perfect! The migration is complete. Let me provide you with a summary:
Migration Complete! ✅
I have successfully migrated the
CircleCiArtifactsTestclass from the Nebula/Groovy testing framework to the new Java-based testing framework. Here's what was accomplished:Files Created/Modified:
Original Groovy Test (
circleci-artifacts/src/test/groovy/com/palantir/gradle/utils/circleciartifacts/CircleCiArtifactsTest.groovy)New Java Test (
circleci-artifacts/src/test/java/com/palantir/gradle/utils/circleciartifacts/CircleCiArtifactsTest.java)Migration Log (
test-migration-errors.md)Key Migrations Made:
Test Structure
extends IntegrationSpecto@GradlePluginTestsvoid setup()to@BeforeEach void setup(RootProject project)Build File Setup
standardBuildFile()helper method (replaces Groovy variable)project.buildGradle().overwrite()with text blocksFile Operations
file('gradle.properties') <<toproject.gradlePropertiesFile().appendProperty()directory()returning Path to usingDirectoryinterface with.path()methodprojectDir.relativePath()toproject.path().relativize()Gradle Execution
runTasksSuccessfully()togradle.withArgs().buildsSuccessfully()Assertions
result.standardOutput.findtoassertThat(result).output().containsPattern()result.standardOutput.containstoassertThat(result).output().contains()assertThat()as per testing guideTest Compilation Status:
✅ BUILD SUCCESSFUL - All tests compile without errors
All delineator comments have been preserved in both the original Groovy file and the new Java file to assist human reviewers in comparing the two versions.
Claude Code Metrics
Migration Notes
Test Migration Errors and Findings
Initial Migration Errors
Error 1: Type Mismatch with Directory
Error:
incompatible types: Directory cannot be converted to PathLocation: Lines 66 and 110
Fix: Changed from
Path fakeCircleArtifactstoDirectory fakeCircleArtifacts. ThecreateDirectories()method returns aDirectoryinterface, not aPath. To get the actual path, usefakeCircleArtifacts.path().Error 2: Missing Method projectDir()
Error:
cannot find symbol: method projectDir()Location: Lines 72 and 116
Fix: The
RootProjectclass is a record with apath()method, not aprojectDir()method. Changedproject.projectDir()toproject.path().Review Against Testing Guide - First Pass
Looking at the testing guide instructions:
GradleInvokerandRootProjectcorrectlyproject.gradlePropertiesFile().appendProperty()as per guidestandardBuildFile()helper method that returnsGradleFileproject.directory().createDirectories()correctlyGradlePluginTestAssertions.assertThat()Areas that need improvement:
assertThat()instead of fully qualifying it.Second Pass Changes
Change 1: Add static import for assertThat
Changed from
GradlePluginTestAssertions.assertThat(result)to justassertThat(result)by adding a static import:This follows the testing guide's recommendation to use static imports for assertion methods.
Change 2: Add newline after text block
Added a blank line after the text block in
standardBuildFile()method for better readability per the instructions.Change 3: Simplified assertion chains
Made assertion chains more compact where appropriate, especially for the simple test
empty_property_if_were_not_in_circle.Third Pass Review
Looking at the migrated test one more time:
Directorytype and.path()method correctlyappendProperty()method correctlyNo additional changes needed. The migration is complete and follows all best practices from the testing guide.
To enable or disable this check, please contact the maintainers of Excavator.