Skip to content

Commit 116718a

Browse files
author
Greg Adams
committed
read all annotations when converting junit4 test annotation to junit 5
1 parent ce7cf36 commit 116718a

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
@@ -50,7 +50,7 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration method, Ex
5050
J.MethodDeclaration m = super.visitMethodDeclaration(method, ctx);
5151

5252
boolean changed = false;
53-
List<J.Annotation> annotations = new ArrayList<>(m.getLeadingAnnotations());
53+
List<J.Annotation> annotations = new ArrayList<>(m.getAllAnnotations());
5454
for (int i = 0, annotationsSize = annotations.size(); i < annotationsSize; i++) {
5555

5656
J.Annotation a = annotations.get(i);
@@ -83,7 +83,7 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration method, Ex
8383
m = m.withTemplate(
8484
template("{ assertThrows(#{}, () -> {#{}}); }")
8585
.javaParser(
86-
(JavaParser) JavaParser.fromJavaVersion().dependsOn(Arrays.asList(
86+
JavaParser.fromJavaVersion().dependsOn(Arrays.asList(
8787
Parser.Input.fromString(
8888
"package org.junit.jupiter.api.function;\n" +
8989
"public interface Executable {\n" +

0 commit comments

Comments
 (0)