Skip to content

Commit 2380acb

Browse files
committed
Update ReplaceDeprecatedEnvironmentTestUtils with rewrite 7.21.0 changes.
1 parent 530a09b commit 2380acb

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/main/java/org/openrewrite/java/spring/boot2/ReplaceDeprecatedEnvironmentTestUtils.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
*/
1616
package org.openrewrite.java.spring.boot2;
1717

18-
import org.openrewrite.ExecutionContext;
19-
import org.openrewrite.Parser;
20-
import org.openrewrite.Recipe;
21-
import org.openrewrite.TreeVisitor;
18+
import org.openrewrite.*;
2219
import org.openrewrite.internal.lang.Nullable;
2320
import org.openrewrite.java.JavaIsoVisitor;
2421
import org.openrewrite.java.JavaParser;
@@ -67,11 +64,12 @@ protected TreeVisitor<?, ExecutionContext> getSingleSourceApplicableTest() {
6764
private static final class ReplaceEnvironmentUtilsMarker implements Marker {
6865
private final String templateString;
6966
private final List<Expression> parameters;
70-
private final UUID id = randomId();
67+
private final UUID id;
7168

72-
private ReplaceEnvironmentUtilsMarker(String templateString, List<Expression> parameters) {
69+
private ReplaceEnvironmentUtilsMarker(String templateString, List<Expression> parameters, UUID id) {
7370
this.templateString = templateString;
7471
this.parameters = parameters;
72+
this.id = UUID.randomUUID();
7573
}
7674

7775
public String getDescription() {
@@ -82,6 +80,11 @@ public String getDescription() {
8280
public UUID getId() {
8381
return id;
8482
}
83+
84+
@Override
85+
public <T extends Tree> T withId(UUID id) {
86+
return (T) new ReplaceEnvironmentUtilsMarker(templateString, parameters, id);
87+
}
8588
}
8689

8790
private static class FindEnvironmentTestUtilsVisitor extends JavaIsoVisitor<ExecutionContext> {
@@ -196,7 +199,7 @@ private J.MethodInvocation coalesceToFluentMethod(List<J.MethodInvocation> colle
196199
String currentTemplateString = generateTemplateString(collectedMethods);
197200
List<Expression> parameters = generateParameters(collectedMethods);
198201

199-
return toReplace.withMarkers(toReplace.getMarkers().addIfAbsent(new ReplaceEnvironmentUtilsMarker(currentTemplateString, parameters)));
202+
return toReplace.withMarkers(toReplace.getMarkers().addIfAbsent(new ReplaceEnvironmentUtilsMarker(currentTemplateString, parameters, UUID.randomUUID())));
200203
}
201204

202205
private List<Expression> generateParameters(List<J.MethodInvocation> collectedMethods) {

0 commit comments

Comments
 (0)