You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c7fbb04
Browse filesBrowse the repository at this point in the historyBrowse files
Only drop a literal zero delta in AssertEqualsIntegralDeltaToAssertEquals (#1212)
The recipe removed the delta from any `assertEquals(int|long, int|long, delta)`, so a tolerance check such as `assertEquals(100, elapsed, 50)` became the exact `assertEquals(100, elapsed)` and started failing. Only a literal zero delta is redundant, so the recipe now leaves any other delta in place, and the description no longer claims the delta is meaningless.
Copy file name to clipboardExpand all lines: src/main/java/org/openrewrite/java/testing/cleanup/AssertEqualsIntegralDeltaToAssertEquals.java
+8-16Lines changed: 8 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -40,9 +40,7 @@ public class AssertEqualsIntegralDeltaToAssertEquals extends Recipe {
40
40
finalStringdisplayName = "Remove unnecessary `assertEquals` delta argument for integral types";
41
41
42
42
@Getter
43
-
finalStringdescription = "Remove the delta argument from `assertEquals()` when both expected and actual are " +
44
-
"`int` or `long` types, since the delta is meaningless for exact integer comparison. " +
45
-
"Integer arguments get unnecessarily upcasted to `double` when a delta is provided.";
43
+
finalStringdescription = "Remove a literal zero delta argument from `assertEquals()` when both expected and actual are `int` or `long` types, since a zero delta already asks for an exact comparison. Integer arguments get unnecessarily upcasted to `double` when a delta is provided; a non-zero delta is a tolerance and is kept.";
maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.assertj.StaticImports,Statically import AssertJ's `assertThat`,Consistently use a static import rather than inlining the `Assertions` class name in tests.,3,AssertJ,Testing,Java,,,Basic building blocks for transforming Java code.,,
85
85
maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.byteman.BytemanJUnit4ToBytemanJUnit5,Use Byteman JUnit 5 dependency,Migrates Byteman JUnit 4 to JUnit 5.,3,Byteman,Testing,Java,Recipes for [Byteman](https://byteman.jboss.org/) bytecode injection in tests.,,Basic building blocks for transforming Java code.,,
86
86
maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertEqualsBooleanToAssertBoolean,"Replace JUnit `assertEquals(false, <boolean>)` to `assertFalse(<boolean>)` / `assertTrue(<boolean>)`",Using `assertFalse` or `assertTrue` is simpler and more clear.,1,Test cleanup,Testing,Java,Recipes to simplify assertions and clean up test code.,,Basic building blocks for transforming Java code.,,
87
-
maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertEqualsIntegralDeltaToAssertEquals,Remove unnecessary `assertEquals` delta argument for integral types,"Remove the delta argument from `assertEquals()` when both expected and actual are `int` or `long` types, since the delta is meaningless for exact integer comparison. Integer arguments get unnecessarily upcasted to `double` when a delta is provided.",1,Test cleanup,Testing,Java,Recipes to simplify assertions and clean up test code.,,Basic building blocks for transforming Java code.,,
87
+
maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertEqualsIntegralDeltaToAssertEquals,Remove unnecessary `assertEquals` delta argument for integral types,"Remove a literal zero delta argument from `assertEquals()` when both expected and actual are `int` or `long` types, since a zero delta already asks for an exact comparison. Integer arguments get unnecessarily upcasted to `double` when a delta is provided; a non-zero delta is a tolerance and is kept.",1,Test cleanup,Testing,Java,Recipes to simplify assertions and clean up test code.,,Basic building blocks for transforming Java code.,,
88
88
maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertEqualsNullToAssertNull,"`assertEquals(a, null)` to `assertNull(a)`",Using `assertNull(a)` is simpler and more clear.,1,Test cleanup,Testing,Java,Recipes to simplify assertions and clean up test code.,,Basic building blocks for transforming Java code.,,
89
89
maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertFalseEqualsToAssertNotEquals,"Replace JUnit `assertFalse(a.equals(b))` to `assertNotEquals(a,b)`","Using `assertNotEquals(a,b)` is simpler and more clear.",1,Test cleanup,Testing,Java,Recipes to simplify assertions and clean up test code.,,Basic building blocks for transforming Java code.,,
90
90
maven,org.openrewrite.recipe:rewrite-testing-frameworks,org.openrewrite.java.testing.cleanup.AssertFalseNegationToAssertTrue,Replace JUnit `assertFalse(!<boolean>)` to `assertTrue(<boolean>)`,Using `assertTrue` is simpler and more clear.,1,Test cleanup,Testing,Java,Recipes to simplify assertions and clean up test code.,,Basic building blocks for transforming Java code.,,
0 commit comments