Excavator: Migrate Groovy nebula test EnvironmentVariablesTest to the new Java Junit framework
#524
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/EnvironmentVariablesTest.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 a summary:
Migration Complete ✓
I have successfully migrated the
EnvironmentVariablesTestfrom the Nebula/Groovy framework to the new Java-based testing framework. Here's what was done:Summary of Changes:
/repo/environment-variables/src/test/java/com/palantir/gradle/utils/environmentvariables/EnvironmentVariablesTest.javaKey Migration Points:
extends IntegrationSpecto@GradlePluginTestsannotation@BeforeEachwithRootProjectparameter injectionrunTasksSuccessfully()togradle.withArgs(...).buildsSuccessfully()assertThat(result).output().contains(...)setupBuildFile()that returnsGradleFilefor potential chainingFiles Created/Modified:
/repo/environment-variables/src/test/groovy/com/palantir/gradle/utils/environmentvariables/EnvironmentVariablesTest.groovy- Added delineator comments/repo/environment-variables/src/test/java/com/palantir/gradle/utils/environmentvariables/EnvironmentVariablesTest.java- New migrated test/repo/test-migration-errors.md- Documentation of the migration process and learningsThe test compiled successfully on the first attempt and follows all best practices from the testing guide!
Claude Code Metrics
Migration Notes
Test Migration Notes - EnvironmentVariablesTest
Migration Summary
Successfully migrated
EnvironmentVariablesTest.groovyto Java-based testing framework.First Pass - Initial Migration
Changes Made:
extends IntegrationSpecto@GradlePluginTestsannotation'can get testing variables'→can_get_testing_variables'isCircleNode0OrLocal returns true on circle node 0'→isCircleNode0OrLocal_returns_true_on_circle_node_0def setup()to Java@BeforeEach void setup(RootProject project)setupBuildFile()that returnsGradleFile(following guide pattern for reusable build file configurations)runTasksSuccessfully('help')togradle.withArgs("help").buildsSuccessfully()InvocationResulttypestdout.contains("Variable: test")→assertThat(result).output().contains("Variable: test")"""...""") for multi-line Gradle script contentGradleInvoker gradleparameter to each test methodIssues Found: None
The test compiled successfully on the first attempt. The migration was straightforward because:
Second Pass - Best Practices Review
Review Against Testing Guide:
✅ Using
@GradlePluginTestsannotation correctly✅ Parameter injection (GradleInvoker, RootProject) used appropriately
✅
.buildsSuccessfully()method used instead of old.build()method✅ Fluent assertions with
assertThat(result).output().contains(...)pattern✅ Test names in snake_case format
✅ Delineator comments preserved for review
✅ Text blocks used for Gradle script content
✅ Helper method returns
GradleFilefor potential chaining (following guide pattern)No Changes Needed
The test already follows all best practices from the testing guide. The helper method pattern matches the example in the guide where build file setup methods return
GradleFilefor potential further configuration.Third Pass - Final Review
No additional issues found. The test is ready for use.
Key Learnings:
setupBuildFile()helper method pattern is useful when the same build file content is used across multiple testsGradleFilefrom helper methods enables fluent API chaining even if not used in this specific test-P__TESTING=trueand related properties)contains()methodTo enable or disable this check, please contact the maintainers of Excavator.