File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414from codeflash .code_utils .tabulate import tabulate
1515from codeflash .code_utils .time_utils import format_perf , format_time
1616from codeflash .github .PrComment import FileDiffContent , PrComment
17+ from codeflash .languages import is_java
1718from codeflash .languages .python .static_analysis .code_replacer import is_zero_diff
1819from codeflash .result .critic import performance_gain
1920
@@ -138,6 +139,14 @@ def existing_tests_source_for(
138139 logger .debug (f"[PR-DEBUG] Mapped { instrumented_abs_path .name } -> { abs_path .name } " )
139140 else :
140141 logger .debug (f"[PR-DEBUG] No mapping found for { instrumented_abs_path .name } " )
142+ elif is_java ():
143+ # Java: test_module_path is the class name (e.g., "BubbleSortTest")
144+ # Search non_generated_tests for a matching .java file
145+ abs_path = (test_cfg .tests_project_rootdir / f"{ test_module_path } .java" ).resolve ()
146+ for candidate in non_generated_tests :
147+ if candidate .stem == test_module_path :
148+ abs_path = candidate
149+ break
141150 else :
142151 # Python: convert module name to path
143152 abs_path = Path (test_module_path .replace ("." , os .sep )).with_suffix (".py" ).resolve ()
You can’t perform that action at this time.
0 commit comments