The recipe:
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run --define rewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE --define rewrite.activeRecipes=org.openrewrite.java.testing.assertj.Assertj --define rewrite.exportDatatables=true
changes
Assertions.assertEquals(7f, rect.getHeight(), 0);
to the invalid:
assertThat(rect.getHeight()).as(0).isEqualTo(7f);
A delta of 0 might not make sense, but is valid. A delta that makes sense works fine:
Assertions.assertEquals(7f, rect.getHeight(), 0.01f);
becomes the expected:
assertThat(rect.getHeight()).isCloseTo(7f, within(0.01f));
However, if the delta to the float comparison is given as double (which is valid):
Assertions.assertEquals(7f, rect.getHeight(), 0.01);
it is converted to the invalid:
assertThat(rect.getHeight()).isCloseTo(7f, within(0.01));
The recipe:
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run --define rewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE --define rewrite.activeRecipes=org.openrewrite.java.testing.assertj.Assertj --define rewrite.exportDatatables=truechanges
Assertions.assertEquals(7f, rect.getHeight(), 0);to the invalid:
assertThat(rect.getHeight()).as(0).isEqualTo(7f);A delta of 0 might not make sense, but is valid. A delta that makes sense works fine:
Assertions.assertEquals(7f, rect.getHeight(), 0.01f);becomes the expected:
assertThat(rect.getHeight()).isCloseTo(7f, within(0.01f));However, if the delta to the float comparison is given as double (which is valid):
Assertions.assertEquals(7f, rect.getHeight(), 0.01);it is converted to the invalid:
assertThat(rect.getHeight()).isCloseTo(7f, within(0.01));