diff --git a/src/test/java/org/openrewrite/java/testing/assertj/AssertJBestPracticesTest.java b/src/test/java/org/openrewrite/java/testing/assertj/AssertJBestPracticesTest.java index f96060d54..9b0fe0fa5 100644 --- a/src/test/java/org/openrewrite/java/testing/assertj/AssertJBestPracticesTest.java +++ b/src/test/java/org/openrewrite/java/testing/assertj/AssertJBestPracticesTest.java @@ -38,10 +38,36 @@ class AssertJBestPracticesTest implements RewriteTest { public void defaults(RecipeSpec spec) { spec.parser( JavaParser.fromJavaVersion() - .classpathFromResources(new InMemoryExecutionContext(), "assertj-core-3.24")) + .classpathFromResources(new InMemoryExecutionContext(), "assertj-core-3.24", "junit-jupiter-api-5.9")) .recipeFromResources("org.openrewrite.java.testing.assertj.Assertj"); } + @Test + @SuppressWarnings("DataFlowIssue") + void convertsIsInstanceOf() {//todo migrate this test to the specific sub recipe + rewriteRun( + // language=java + java( + """ + import static org.junit.jupiter.api.Assertions.assertInstanceOf; + class Test { + void test() { + assertInstanceOf(Integer.class, 4); + } + } + """, + """ + import static org.assertj.core.api.Assertions.assertThat; + class Test { + void test() { + assertThat(4).isInstanceOf(Integer.class); + } + } + """ + ) + ); + } + @DocumentExample @Test @SuppressWarnings("DataFlowIssue") @@ -319,4 +345,5 @@ void test(%2$s x, %2$s y, Object value) { template.formatted(imprt, argumentsType, dedicatedAssertion))); } } + }