Excavator: Migrate Groovy nebula test SlsPackagingCompatibilityIntegrationSpec to the new Java Junit framework
#1506
+3,286
−132
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 can be viewed here
🤖 🤖 This PR was created using Claude-code 🤖 🤖
Claude Execution Message
Claude finished running successfully.
Excellent! The migration is complete. Let me create a summary of what was done:
Migration Summary
I have successfully migrated the test class
SlsPackagingCompatibilityIntegrationSpec.groovyfrom the Nebula testing framework to the new Java-based testing framework. Here's what was accomplished:Key Changes:
Language and Framework:
IntegrationSpecbase class to@GradlePluginTestsannotationTest Structure:
void setup()to@BeforeEach void setup()RootProject,MavenRepo,SubProject, andGradleInvoker'#gradleVersionNumber can consume recommended product dependencies project'()tocan_consume_recommended_product_dependencies_project()Maven Repository:
generateMavenRepo()withMavenRepoparameter injectionrepo.publish(MavenArtifact.of(...))for publishing artifactsPlugin Management:
plugins().add()API instead ofapply pluginstringscom.palantir.sls-packaging:gradle-sls-packaging:7.31.0togradlePluginForTestingconfiguration in build.gradleBuild Execution:
runTasks()togradle.withArgs().buildsSuccessfully()Assertions:
assertThat(result).task(":taskPath").succeeded()for each taskConditional Test Execution:
@IgnoreIfwith JUnit 5'sassumeFalse()usingTestInfoto check for Gradle 9Delineator Comments:
Files Modified:
/repo/src/test/groovy/com/palantir/gradle/versions/SlsPackagingCompatibilityIntegrationSpec.groovy/repo/src/test/java/com/palantir/gradle/versions/SlsPackagingCompatibilityIntegrationTest.java/repo/build.gradle(added gradlePluginForTesting dependency)/repo/test-migration-errors.md(documentation of errors and fixes)The new test compiles successfully and follows all best practices from the testing guide.
Claude Code Metrics
Migration Notes
Test Migration Errors and Fixes
First Pass - Initial Migration
Error 1: Method signature for addWithoutApply
Issue: Used
addWithoutApply("com.palantir.sls-java-service-distribution", "7.31.0")which doesn't accept a version parameter.Fix:
addWithoutApplyonly accepts a plugin ID, not a version.gradlePluginForTestingconfiguration in build.gradle.gradlePluginForTesting 'com.palantir.sls-packaging:gradle-sls-packaging:7.31.0'to build.gradle dependencies.addWithoutApply("com.palantir.sls-java-service-distribution")without version.Error 2: No method to get tasks by outcome
Issue: Used
assertThat(wroteLocks).tasks(TaskOutcome.SUCCESS)which doesn't exist in the new framework.Fix:
assertThat(wroteLocks).task(":api:compileRecommendedProductDependencies").succeeded()Error 3: Error Prone check for plugin blocks
Issue: Error Prone check
GradleTestPluginsBlockwas triggered when usingappend()with plugin declarations.Fix:
plugins()API instead of raw string append for all plugin declarations.apply plugin: 'java'tobuildGradle().plugins().add("java")Second Pass - Review Against testing-guide.md
Issue 1: Unused imports
Issue: The test had unused imports
java.util.Setandorg.gradle.testkit.runner.TaskOutcome.Fix:
tasks(TaskOutcome.SUCCESS)method that doesn't exist.Review Summary
The migrated test follows all the best practices from the testing-guide.md:
@GradlePluginTestsannotation@BeforeEachfor setupplugins()API for all plugin declarationsbuildsSuccessfully()instead of.build()assertThat()from GradlePluginTestAssertionspropertiesFile().appendProperty()for versions.propsMulti-version testing notes
where:block withgradleVersionNumber << GRADLE_VERSIONSfor parameterized testing.gradleTestUtils.gradleVersionsin build.gradle.assumeFalsewithTestInfoto check the display name (which includes the Gradle version).To enable or disable this check, please contact the maintainers of Excavator.