Add unit tests for JavaLocator - #932
Open
vasiliy-mikhailov wants to merge 1 commit into
Open
Conversation
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.
Adds unit tests for
util.JavaLocator, which previously had little coverage of its executable-resolution logic.The new tests cover
findExecutableFromToolchain(...):javafrom thejava.homesystem propertyjavafrom theJAVA_HOMEenvironment variablejrelayout (siblingbin/java) and the fallback when no siblingbinexistsIllegalStateExceptionpaths (java.home / JAVA_HOME set but nobin/java), asserting the exact messagesThey use
TemporaryFolderfor throwaway JDK layouts and save/restorejava.homein@Before/@Afterso no global state leaks, and reuse the existingenvironmentVariablesrule.I found the gaps with PIT mutation testing; the additions take the class from 34 to 77 killed mutants. One test (
shouldNotEnterJreBranchWhenJavaHomeDoesNotEndWithJre) specifically pins theendsWith("jre")branch, which nothing covered before.Additive only: +8 tests, no production changes.
How this was produced
This PR was generated with an AI-assisted pipeline built around mutation testing (PIT). The pipeline mutates the target class (flipping conditions and changing boundary/edge cases) and runs the existing tests against each mutant. Where a mutant survives (the existing tests do not catch that edge case), it writes a focused test for that case and reruns PIT to confirm the new test actually kills that specific mutant. So every added test is verified to catch a concrete edge case the suite missed before, rather than being speculative or redundant. The change is additive only (no production code modified), and the module builds green under its CI JDK.