Skip to content

Commit ab99222

Browse files
committed
Fix JavaTemplate type reference
1 parent 82f5ffb commit ab99222

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private J.ClassDeclaration insertTimeoutAnnotation(Expression ex, J.ClassDeclara
9292
if (TIMEOUT_CONSTRUCTOR_MATCHER.matches(ex)) {
9393
List<Expression> arguments = ((J.NewClass) ex).getArguments();
9494
if (arguments.size() == 2) {
95-
template = "@Timeout(value = #{any(long)}, unit = #{any(TimeUnit)})";
95+
template = "@Timeout(value = #{any(long)}, unit = #{any(java.util.concurrent.TimeUnit)})";
9696
params = new Object[]{arguments.get(0), arguments.get(1)};
9797
} else {
9898
template = "@Timeout(value = #{any(long)}, unit = TimeUnit.MILLISECONDS)";
@@ -112,7 +112,8 @@ private J.ClassDeclaration insertTimeoutAnnotation(Expression ex, J.ClassDeclara
112112
return JavaTemplate.builder(template)
113113
.javaParser(JavaParser.fromJavaVersion()
114114
.classpathFromResources(ctx, "junit-jupiter-api-5", "hamcrest-3"))
115-
.imports("org.junit.jupiter.api.Timeout", "java.util.concurrent.TimeUnit")
115+
.imports("org.junit.jupiter.api.Timeout",
116+
"java.util.concurrent.TimeUnit")
116117
.build()
117118
.apply(updateCursor(cd),
118119
cd.getCoordinates().addAnnotation(Comparator.comparing(J.Annotation::getSimpleName)),

0 commit comments

Comments
 (0)