File tree Expand file tree Collapse file tree
src/test/java/org/openrewrite/java/testing/junit5 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -992,4 +992,42 @@ public void testUltimateAnswer() {
992992 )
993993 );
994994 }
995+
996+ @ Test
997+ void extendsAssertWithUnqualifiedAssertionsLeavesBrokenCode () {
998+ // `after` is the broken output the recipes currently produce.
999+ rewriteRun (
1000+ spec -> spec .typeValidationOptions (TypeValidation .none ()),
1001+ //language=java
1002+ java (
1003+ """
1004+ import org.junit.Assert;
1005+ import org.junit.Test;
1006+
1007+ public class MyTest extends Assert {
1008+ @Test
1009+ public void shouldPass() {
1010+ assertEquals("expected message", 1, 1);
1011+ assertTrue(true);
1012+ }
1013+ }
1014+ """ ,
1015+ """
1016+ import org.junit.Assert;
1017+ import org.junit.jupiter.api.Test;
1018+
1019+ import static org.junit.jupiter.api.Assertions.assertEquals;
1020+ import static org.junit.jupiter.api.Assertions.assertTrue;
1021+
1022+ public class MyTest extends Assert {
1023+ @Test
1024+ public void shouldPass() {
1025+ assertEquals(1, 1, "expected message");
1026+ assertTrue(true);
1027+ }
1028+ }
1029+ """
1030+ )
1031+ );
1032+ }
9951033}
You can’t perform that action at this time.
0 commit comments