fix: detect JUnit 5 from submodule build files and default to JUnit 5#2063
Open
mashraf-222 wants to merge 1 commit intomainfrom
Open
fix: detect JUnit 5 from submodule build files and default to JUnit 5#2063mashraf-222 wants to merge 1 commit intomainfrom
mashraf-222 wants to merge 1 commit intomainfrom
Conversation
Multi-module Gradle projects declare JUnit 5 dependencies in submodule build files, not the root. The detection function only checked the root build.gradle, missing JUnit 5 entirely and falling back to JUnit 4. Now scans immediate child directories for build files. Also changes the default framework from JUnit 4 to JUnit 5 (standard since 2017). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Problem
Multi-module Gradle projects (OpenRewrite, Spring, etc.) were misdetected as JUnit 4 projects. The AI service then generated JUnit 4 tests that failed to compile because the project only has JUnit 5 dependencies.
Root Cause
_detect_test_deps_from_gradle()inconfig.pyonly checked the rootbuild.gradle(.kts). For multi-module projects, the root build file typically only has plugin declarations — JUnit dependencies are in module-level build files.Secondary: the default framework was
junit4, which is wrong for the vast majority of modern Java projects.Fix
build.gradle(.kts)filesjunit4tojunit5(JUnit 5 has been the standard since 2017)Test Coverage
TestGradleSubmoduleDetection:test_detect_gradle_junit5_from_submodule: Multi-module with junit-jupiter in submodule onlytest_detect_gradle_junit5_from_root: Single-module with junit-jupiter in root (regression check)test_default_to_junit5_when_nothing_detected: Empty project defaults to junit5Testing
All 21 existing config tests still pass (18 existing + 3 new).