Excavator: Migrate Groovy nebula test TestReportFormattingPluginIntegrationSpec to the new Java Junit framework
#870
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/TestReportFormattingPluginIntegrationSpec.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.
Excellent! The migration is complete. Let me create a summary of what was done:
Summary
I've successfully migrated the test class from the Nebula testing framework to the new Java-based testing framework. Here's what was accomplished:
Files Modified/Created:
Original Groovy Test (
gradle-witchcraft-logging/src/test/groovy/com/palantir/witchcraft/java/logging/gradle/testreport/TestReportFormattingPluginIntegrationSpec.groovy):New Java Test (
gradle-witchcraft-logging/src/test/java/com/palantir/witchcraft/java/logging/gradle/testreport/TestReportFormattingPluginIntegrationTest.java):@GradlePluginTestsannotationGradleInvokerandRootProjectformats_test_report_stdout_and_stderr.plugins().add("com.palantir.witchcraft-logging-testreport").testSourceSet().java().writeClass()for creating test Java files.assertThat().content()with chained assertionsError Documentation (
test-migration-errors.md):Key Changes:
runTasksSuccessfully()→.buildsSuccessfully(),runTasksWithFailure()→.buildsWithFailure().assertThat().content()fluent APIbuild.gradleviagradleTestUtilsextension rather than per-testapplyPlugin(TestReportFormattingPlugin)to structured API.plugins().add("com.palantir.witchcraft-logging-testreport")Verification:
The test compiles successfully: ✅
All best practices from the testing-guide.md have been followed, and the test is ready for use.
Claude Code Metrics
Migration Notes
Test Migration Errors and Fixes
Migration: TestReportFormattingPluginIntegrationSpec.groovy → TestReportFormattingPluginIntegrationTest.java
Initial Pass
Error 1: Incorrect assertion API usage
Error Message:
Problem:
I initially read the file content using
.text()and tried to assert on the String directly usingassertThat(htmlReport). However, theGradlePluginTestAssertions.assertThat()method only acceptsTaskOutcomeorInvocationResult, not arbitrary strings.Solution:
According to the testing-guide.md section on "File Assertions" (lines 677-680), the correct approach is to use the fluent file assertion API:
Changed from:
To:
Information Source: Testing guide section on "File Assertions" which shows using
.assertThat().content()for AssertJ string assertions on file content.Observations
Multi-Version Testing
The original Groovy test explicitly tested against three Gradle versions:
7.6.4,8.8, andGradleVersion.current().In the new framework, multi-version testing is configured via the
gradleTestUtilsextension in build.gradle. The current configuration only specifies one version:According to the testing-guide.md (lines 132-146), the framework automatically runs each test against multiple Gradle versions when configured. Since the build.gradle only specifies
8.14.3, the test will only run against that version, not the three versions from the original test.Note: This is not an error in the migration itself, but a change in test coverage. The multi-version testing configuration is now centralized in build.gradle rather than per-test. If broader version coverage is desired, the build.gradle would need to be updated.
Second Pass Review
After reviewing the testing-guide.md and instructions:
All best practices followed:
@GradlePluginTestsannotation.buildsSuccessfully()and.buildsWithFailure()methods.plugins().add()structured APINo additional changes needed.
To enable or disable this check, please contact the maintainers of Excavator.