Skip to content

Excavator: Migrate Groovy nebula test ConjureLocalPluginTest to the new Java Junit framework#1888

Open
svc-excavator-bot wants to merge 1 commit intodevelopfrom
roomba/migrate-gradle-testing-junit-framework-8a8c00c7e5db1fc1
Open

Excavator: Migrate Groovy nebula test ConjureLocalPluginTest to the new Java Junit framework#1888
svc-excavator-bot wants to merge 1 commit intodevelopfrom
roomba/migrate-gradle-testing-junit-framework-8a8c00c7e5db1fc1

Conversation

@svc-excavator-bot
Copy link
Collaborator

@svc-excavator-bot svc-excavator-bot commented Feb 1, 2026

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/ConjureLocalPluginTest.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: opus


Claude Execution Message

Claude finished running successfully.

Migration complete. Here's a summary of what was done:

Files modified:

  • gradle-conjure/src/test/groovy/com/palantir/gradle/conjure/ConjureLocalPluginTest.groovy - Added ***DELINEATOR FOR REVIEW comments before each method and Spock keywords (when:, then:, expect:)

Files created:

  • gradle-conjure/src/test/java/com/palantir/gradle/conjure/ConjureLocalPluginTest.java - Migrated test with all 5 test methods
  • gradle-conjure/src/test/java/com/palantir/gradle/conjure/TestVersions.java - Moved from groovy directory so Java tests can reference it
  • test-migration-errors.md - Documents errors encountered and fixes applied

Key migration decisions:

  1. Plugin application - apply plugin: 'com.palantir.conjure-local' replaced with .plugins().add("com.palantir.conjure-local")
  2. standardBuildFile - Converted from a Groovy variable to a helper method returning GradleFile, using append() with format parameters for version interpolation
  3. SubProject handling - Used rootProject.subproject("name") for tests that don't reference the SubProject variable (to avoid Error Prone's StrictUnusedVariable check); used SubProject parameter injection for tests that do use it
  4. Assertions - Converted Spock implicit assertions to explicit assertThat() calls with .as() descriptions for file and output assertions
  5. Task outcome checks - Converted result.tasks(TaskOutcome.FAILED)*.path.contains(...) to assertThat(result).task(":taskName").failed()

Claude Code Metrics

Metric Value
Total cost $3.18361175
Total Duration (API) 761602 ms
Total Duration (WALL) 788535 ms
Token usage 125 (input), 37219 (output)
Cached tokens 78996 (creation), 2792554 (read)

Migration Notes

Test Migration Errors - ConjureLocalPluginTest

Error 1: TestVersions class not found during compilation

Error: cannot find symbol - variable TestVersions (7 occurrences)

Cause: TestVersions.java was located in src/test/groovy/ directory. The Java compiler (compileTestJava) only compiles sources in src/test/java/, so it could not resolve TestVersions referenced from the migrated Java test.

Fix: Moved TestVersions.java from src/test/groovy/com/palantir/gradle/conjure/ to src/test/java/com/palantir/gradle/conjure/. The Groovy compiler (compileTestGroovy) depends on compileTestJava output, so existing Groovy tests still compile successfully since they can reference the Java-compiled TestVersions class.

Error 2: StrictUnusedVariable Error Prone check for SubProject parameters

Error: [StrictUnusedVariable] The parameter 'java' is never read (and similar for postman)

Cause: Initially used SubProject java and SubProject postman as method parameters to create subprojects (mirroring the original addSubproject("java") / addSubproject("postman") calls). However, these SubProject variables were never read in the method bodies - they were only needed for the side effect of creating the subproject. The Palantir Error Prone StrictUnusedVariable check flagged these.

Fix: Replaced unused SubProject parameter injection with rootProject.subproject("name") calls inside the method body. This creates the subproject without introducing an unused parameter. Tests that DO use the SubProject variable (e.g., generate_conjure_generates_code_in_subprojects and supports_custom_postman_generator) kept SubProject parameter injection.

Second Pass Review Notes

  • Verified all 5 test methods were migrated (none skipped)
  • Verified .plugins().add("com.palantir.conjure-local") used instead of apply plugin: in text block
  • Verified .as() descriptions are used on file assertions and output assertions where context is helpful
  • Verified text blocks have no leading newlines
  • Verified single .append() calls used (no multiple calls per block)
  • Added blank line before // ***DELINEATOR FOR REVIEW: expect comment in custom_generator_throws_if_generator_missing for consistency with original formatting
  • No additional changes were needed on the second pass review

To enable or disable this check, please contact the maintainers of Excavator.

@svc-excavator-bot svc-excavator-bot force-pushed the roomba/migrate-gradle-testing-junit-framework-8a8c00c7e5db1fc1 branch from 061f9f2 to 84009a4 Compare March 1, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant