What version of OpenRewrite are you using?
rewrite-core 8.81.4
rewrite-testing-frameworks 3.35.2
What is the smallest, simplest way to reproduce the problem?
@Test
void useAssertSameChangesBoxedNumericValueEquality() {
rewriteRun(
spec -> spec.recipe(new UseAssertSame()),
java(
"""
package com.helloworld;
import static org.junit.jupiter.api.Assertions.assertTrue;
class ExampleTest {
void test() {
assertTrue(123L == 123);
}
}
"""));
}
What did you expect to see?
No change. The original assertion uses Java numeric equality:
This evaluates to true.
What did you see instead?
The recipe changes numeric value equality into object identity equality:
This assertion fails because the arguments are boxed as Long and Integer, which are different object types.
What is the full stack trace of any errors you encountered?
When the rewritten test is executed, JUnit fails with an assertion error like:
org.opentest4j.AssertionFailedError: expected: java.lang.Long<123> but was: java.lang.Integer<123>
What version of OpenRewrite are you using?
rewrite-core8.81.4rewrite-testing-frameworks3.35.2What is the smallest, simplest way to reproduce the problem?
What did you expect to see?
No change. The original assertion uses Java numeric equality:
This evaluates to
true.What did you see instead?
The recipe changes numeric value equality into object identity equality:
This assertion fails because the arguments are boxed as
LongandInteger, which are different object types.What is the full stack trace of any errors you encountered?
When the rewritten test is executed, JUnit fails with an assertion error like: