Skip to content

Commit bcd31ce

Browse files
author
Joan Viladrosa
authored
Fixed type attribution (#369)
1 parent dc83bf7 commit bcd31ce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration method, Ex
121121
.visitNonNull(m, ctx, getCursor().getParentOrThrow());
122122
}
123123
if (cta.expectedException != null) {
124-
m = JavaTemplate.builder("Object o = () -> #{};")
124+
m = JavaTemplate.builder("org.junit.jupiter.api.function.Executable o = () -> #{};")
125125
.contextSensitive()
126+
.javaParser(javaParser(ctx))
126127
.build()
127128
.apply(
128129
updateCursor(m),
@@ -135,7 +136,6 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration method, Ex
135136
.getVariables().get(0).getInitializer();
136137

137138
assert lambda != null;
138-
lambda = lambda.withType(JavaType.ShallowClass.build("org.junit.jupiter.api.function.Executable"));
139139

140140
if (cta.expectedException instanceof J.FieldAccess
141141
&& TypeUtils.isAssignableTo("org.junit.Test$None", ((J.FieldAccess) cta.expectedException).getTarget().getType())) {

0 commit comments

Comments
 (0)