Skip to content

Commit 0df9047

Browse files
committed
Fix JUnitParamsRunnerToParameterized compile error and some polish
1 parent 834aa35 commit 0df9047

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333

3434
/**
3535
* Converts Pragmatists JUnitParamsRunner tests to their JUnit 5 ParameterizedTest and associated MethodSource equivalent
36-
* https://github.com/Pragmatists/JUnitParams
37-
*
36+
* <a href="https://github.com/Pragmatists/JUnitParams">...</a>
3837
* Supports the following conversions
3938
* `@Parameters` annotation with out arguments and default `parametersFor...` init-method exists
4039
* `@Parameters(method = "...")` annotation with defined method references
@@ -123,7 +122,7 @@ public J.Annotation visitAnnotation(J.Annotation annotation, ExecutionContext ex
123122
} else if (anno.getArguments() != null && !anno.getArguments().isEmpty()) {
124123
// This conversion is not supported add a comment to the annotation and the method name to the not supported list
125124
String comment = " JunitParamsRunnerToParameterized conversion not supported";
126-
if (anno.getComments().stream().noneMatch(c -> c.printComment().endsWith(comment))) {
125+
if (anno.getComments().stream().noneMatch(c -> c.printComment(getCursor()).endsWith(comment))) {
127126
anno = anno.withComments(ListUtils.concat(anno.getComments(), new TextComment(false, comment,
128127
"\n" + anno.getPrefix().getIndent(), Markers.EMPTY)));
129128
}
@@ -309,7 +308,7 @@ private String getAnnotationArgumentValueForMethodTemplate(J.Annotation anno) {
309308
if (annotationArgumentValue != null) {
310309
String[] methodRefs = annotationArgumentValue.split(",");
311310
if (methodRefs.length > 1) {
312-
String methods = Arrays.stream(methodRefs).map(mref -> mref = "\"" + mref + "\"").collect(Collectors.joining(", "));
311+
String methods = Arrays.stream(methodRefs).map(mref -> "\"" + mref + "\"").collect(Collectors.joining(", "));
313312
annotationArgumentValue = "{" + methods + "}";
314313
} else {
315314
annotationArgumentValue = "\"" + annotationArgumentValue + "\"";

0 commit comments

Comments
 (0)