Excavator: Migrate Groovy nebula test MainClassInferenceIntegrationSpec to the new Java Junit framework#1945
Open
svc-excavator-bot wants to merge 1 commit intodevelopfrom
Conversation
ed5acfa to
cb1b3f8
Compare
…pec` to the new Java Junit framework
cb1b3f8 to
ce43fe7
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/MainClassInferenceIntegrationSpec.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:
Files Modified
gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/service/MainClassInferenceIntegrationSpec.groovy- Added***DELINEATOR FOR REVIEWcomments to delineate methods, variables, and test sections (when/then blocks)Files Created
gradle-sls-packaging/src/test/java/com/palantir/gradle/dist/service/MainClassInferenceIntegrationTest.java- Migrated test classtest-migration-errors.md- Migration log documenting decisions and any issuesMigration Summary
All 3 tests were migrated from the Groovy Spock framework to Java JUnit 5:
infers main class correctlyinfers_main_class_correctlyfails to infer main class if there are manyfails_to_infer_main_class_if_there_are_manyallows users to override main class if there are manyallows_users_to_override_main_class_if_there_are_manyKey patterns applied:
@GradlePluginTests+@DisabledConfigurationCacheannotations.plugins().add()APIwhere:blocks)buildsWithFailure()+ output assertions.as()descriptions on assertions for self-documenting failure messagesunTarTask,mainClass,schemaClass) take parameters instead of using instance fieldsClaude Code Metrics
Migration Notes
Test Migration Errors - MainClassInferenceIntegrationSpec
Migration: MainClassInferenceIntegrationSpec → MainClassInferenceIntegrationTest
First Pass
No compilation errors were encountered during the initial migration. The test compiled successfully on the first attempt.
Key Migration Decisions
Plugin application: Moved
plugins { id 'java'; id 'com.palantir.sls-java-service-distribution' }from a text block in the Groovysetup()to structured.plugins().add("java").add("com.palantir.sls-java-service-distribution")in the@BeforeEachmethod.Failure test pattern: The original Groovy test used
thrown(UnexpectedBuildFailure)witherror.message.contains(...). Migrated tobuildsWithFailure()+assertThat(result).output().contains(...)which is the idiomatic pattern in the new framework.unTarTaskhelper: The original Groovy method returned a String that was interpolated into a larger build file string via${unTarTask('service-name')}. Converted to a void helper method that directly appends to the build file usingrootProject.buildGradle().append(...)withString.formatstyle%sparameter, following the existing pattern inJavaServiceDistributionPluginTests.createUntarTask().Java source file helpers: Kept
mainClass()andschemaClass()as static String-returning methods, passing their output torootProject.mainSourceSet().java().writeClass(...).Multi-version testing: The original used Spock
where:blocks withGradleTestVersions.GRADLE_VERSIONS. Removed this entirely since@GradlePluginTestsautomatically handles multi-version testing.Second Pass Review
Reviewed the test against the testing-guide.md and migration instructions. No changes were needed - all best practices were already followed in the first pass.
To enable or disable this check, please contact the maintainers of Excavator.