Skip to content

Commit 78bbbbc

Browse files
committed
Updated ChangeType to the latest version of rewrite.
1 parent 90e2f6c commit 78bbbbc

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/main/java/org/openrewrite/java/testing/junit5/MigrateJUnitTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public J.CompilationUnit visitCompilationUnit(J.CompilationUnit cu, ExecutionCon
8585
J.CompilationUnit c = super.visitCompilationUnit(cu, executionContext);
8686
doAfterVisit(new TestCaseVisitor());
8787
// ChangeType for org.junit.Assert method invocations because TestCase extends org.junit.Assert
88-
doAfterVisit(new ChangeType("junit.framework.TestCase", "org.junit.Assert"));
88+
doAfterVisit(new ChangeType("junit.framework.TestCase", "org.junit.Assert", true));
8989
doAfterVisit(new AssertToAssertions.AssertToAssertionsVisitor());
9090
doAfterVisit(new UseStaticImport("org.junit.jupiter.api.Assertions assert*(..)"));
9191
doAfterVisit(new UseStaticImport("org.junit.jupiter.api.Assertions fail*(..)"));

src/main/java/org/openrewrite/java/testing/junit5/TemporaryFolderToTempDir.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private static class TemporaryFolderToTempDirVisitor extends JavaVisitor<Executi
6969
public J visitCompilationUnit(J.CompilationUnit cu, ExecutionContext executionContext) {
7070
J.CompilationUnit c = (J.CompilationUnit) super.visitCompilationUnit(cu, executionContext);
7171
if (c != cu) {
72-
doAfterVisit(new ChangeType("org.junit.rules.TemporaryFolder", "java.io.File"));
72+
doAfterVisit(new ChangeType("org.junit.rules.TemporaryFolder", "java.io.File", true));
7373
maybeAddImport("java.io.File");
7474
maybeAddImport("org.junit.jupiter.api.io.TempDir");
7575
maybeRemoveImport("org.junit.ClassRule");

src/main/java/org/openrewrite/java/testing/junit5/TestRuleToTestInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public J visitMethodInvocation(J.MethodInvocation method, ExecutionContext execu
9393
return mi;
9494
}
9595
});
96-
doAfterVisit(new ChangeType("org.junit.rules.TestName", "String"));
97-
doAfterVisit(new ChangeType("org.junit.Before", "org.junit.jupiter.api.BeforeEach"));
96+
doAfterVisit(new ChangeType("org.junit.rules.TestName", "String", true));
97+
doAfterVisit(new ChangeType("org.junit.Before", "org.junit.jupiter.api.BeforeEach", true));
9898
return compilationUnit;
9999
}
100100

src/main/java/org/openrewrite/java/testing/junit5/UpdateBeforeAfterAnnotations.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ public static class UpdateBeforeAfterAnnotationsVisitor extends JavaIsoVisitor<E
5959
public J.CompilationUnit visitCompilationUnit(J.CompilationUnit cu, ExecutionContext ctx) {
6060
//This visitor handles changing the method visibility for any method annotated with one of the four before/after
6161
//annotations. It registers visitors that will sweep behind it making the type changes.
62-
doAfterVisit(new ChangeType("org.junit.Before", "org.junit.jupiter.api.BeforeEach"));
63-
doAfterVisit(new ChangeType("org.junit.After", "org.junit.jupiter.api.AfterEach"));
64-
doAfterVisit(new ChangeType("org.junit.BeforeClass", "org.junit.jupiter.api.BeforeAll"));
65-
doAfterVisit(new ChangeType("org.junit.AfterClass", "org.junit.jupiter.api.AfterAll"));
62+
doAfterVisit(new ChangeType("org.junit.Before", "org.junit.jupiter.api.BeforeEach", true));
63+
doAfterVisit(new ChangeType("org.junit.After", "org.junit.jupiter.api.AfterEach", true));
64+
doAfterVisit(new ChangeType("org.junit.BeforeClass", "org.junit.jupiter.api.BeforeAll", true));
65+
doAfterVisit(new ChangeType("org.junit.AfterClass", "org.junit.jupiter.api.AfterAll", true));
6666

6767
return super.visitCompilationUnit(cu, ctx);
6868
}

src/main/java/org/openrewrite/java/testing/junit5/UseWiremockExtension.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected JavaVisitor<ExecutionContext> getVisitor() {
4949
@Override
5050
public J visitJavaSourceFile(JavaSourceFile cu, ExecutionContext context) {
5151
doNext(new ChangeType("com.github.tomakehurst.wiremock.junit.WireMockRule",
52-
"com.github.tomakehurst.wiremock.junit5.WireMockExtension"));
52+
"com.github.tomakehurst.wiremock.junit5.WireMockExtension", true));
5353
return super.visitJavaSourceFile(cu, context);
5454
}
5555

@@ -59,7 +59,7 @@ public J visitNewClass(J.NewClass newClass, ExecutionContext executionContext) {
5959
if (newWiremockRule.matches(n)) {
6060
maybeAddImport("com.github.tomakehurst.wiremock.junit5.WireMockExtension");
6161

62-
doAfterVisit(new ChangeType("org.junit.Rule", "org.junit.jupiter.api.extension.RegisterExtension"));
62+
doAfterVisit(new ChangeType("org.junit.Rule", "org.junit.jupiter.api.extension.RegisterExtension", true));
6363

6464
assert n.getArguments() != null;
6565
Expression arg = n.getArguments().get(0);

0 commit comments

Comments
 (0)