feat: implement Java assertion removal transformer#1295
feat: implement Java assertion removal transformer#1295misrasaurabh1 merged 4 commits intoomni-javafrom
Conversation
Add a robust Java assert removal transformer to convert generated unit tests into regression tests. This removes assertion statements while preserving function calls, enabling behavioral verification by comparing outputs between original and optimized code. Key features: - Support for JUnit 5 assertions (assertEquals, assertTrue, assertThrows, etc.) - Support for JUnit 4 assertions (org.junit.Assert.*) - Support for AssertJ fluent assertions (assertThat().isEqualTo()) - Support for TestNG and Hamcrest assertions - Framework auto-detection from imports - Handles assertAll grouped assertions - Preserves non-assertion code (setup, Mockito mocks, etc.) - 57 comprehensive tests with exact string equality assertions Co-Authored-By: Claude Opus 4.5 <[email protected]>
The log statement was using `func_name` which is only defined in the Java block, not the JavaScript block. Co-Authored-By: Claude Opus 4.5 <[email protected]>
⚡️ Codeflash found optimizations for this PR📄 13% (0.13x) speedup for
|
⚡️ Codeflash found optimizations for this PR📄 236% (2.36x) speedup for
|
⚡️ Codeflash found optimizations for this PR📄 22% (0.22x) speedup for
|
⚡️ Codeflash found optimizations for this PR📄 21% (0.21x) speedup for
|
⚡️ Codeflash found optimizations for this PR📄 33% (0.33x) speedup for
|
⚡️ Codeflash found optimizations for this PR📄 12% (0.12x) speedup for
|
- Update receiver extraction pattern to handle constructor calls - Fix test expectation for behavior mode instrumentation Co-Authored-By: Claude Opus 4.5 <[email protected]>
Summary
Add a robust Java assert removal transformer to convert AI-generated unit tests into regression tests. This removes assertion statements while preserving function calls, enabling behavioral verification by comparing outputs between original and optimized code.
Transformation Examples
Key Features
assertEquals,assertTrue,assertThrows,assertAll, etc.org.junit.Assert.*assertThat().isEqualTo()assertAllwith nested assertionsFiles Changed
codeflash/languages/java/remove_asserts.pycodeflash/languages/java/instrumentation.pycodeflash/languages/java/__init__.pytests/test_java_assertion_removal.pyTest plan
instrument_generated_java_testverified🤖 Generated with Claude Code