Skip to content

Commit 436eeb4

Browse files
timtebeekclaude
andcommitted
Apply best practices cleanup
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 0d24ee2 commit 436eeb4

File tree

3 files changed

+79
-4
lines changed

3 files changed

+79
-4
lines changed

src/main/java/org/openrewrite/java/testing/junit6/MigrateMethodOrdererAlphanumeric.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@
2020
import org.openrewrite.Recipe;
2121
import org.openrewrite.TreeVisitor;
2222
import org.openrewrite.java.JavaIsoVisitor;
23-
import org.openrewrite.java.JavaParser;
24-
import org.openrewrite.java.JavaTemplate;
2523
import org.openrewrite.java.search.UsesType;
2624
import org.openrewrite.java.tree.J;
27-
import org.openrewrite.java.tree.JavaType;
2825
import org.openrewrite.java.tree.TypeUtils;
2926

3027
public class MigrateMethodOrdererAlphanumeric extends Recipe {

src/main/resources/META-INF/rewrite/examples.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3396,6 +3396,43 @@ examples:
33963396
language: java
33973397
---
33983398
type: specs.openrewrite.org/v1beta/example
3399+
recipeName: org.openrewrite.java.testing.junit6.MigrateMethodOrdererAlphanumeric
3400+
examples:
3401+
- description: ''
3402+
sources:
3403+
- before: |
3404+
import org.junit.jupiter.api.MethodOrderer;
3405+
import org.junit.jupiter.api.TestMethodOrder;
3406+
import org.junit.jupiter.api.Test;
3407+
3408+
@TestMethodOrder(MethodOrderer.Alphanumeric.class)
3409+
class MyTest {
3410+
@Test
3411+
void test1() {
3412+
}
3413+
3414+
@Test
3415+
void test2() {
3416+
}
3417+
}
3418+
after: |
3419+
import org.junit.jupiter.api.MethodOrderer;
3420+
import org.junit.jupiter.api.TestMethodOrder;
3421+
import org.junit.jupiter.api.Test;
3422+
3423+
@TestMethodOrder(MethodOrderer.MethodName.class)
3424+
class MyTest {
3425+
@Test
3426+
void test1() {
3427+
}
3428+
3429+
@Test
3430+
void test2() {
3431+
}
3432+
}
3433+
language: java
3434+
---
3435+
type: specs.openrewrite.org/v1beta/example
33993436
recipeName: org.openrewrite.java.testing.junit6.MinimumJreConditions
34003437
examples:
34013438
- description: ''
@@ -3477,6 +3514,47 @@ examples:
34773514
language: java
34783515
---
34793516
type: specs.openrewrite.org/v1beta/example
3517+
recipeName: org.openrewrite.java.testing.junit6.RemoveInterceptDynamicTest
3518+
examples:
3519+
- description: ''
3520+
sources:
3521+
- before: |
3522+
import org.junit.jupiter.api.extension.ExtensionContext;
3523+
import org.junit.jupiter.api.extension.InvocationInterceptor;
3524+
import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
3525+
3526+
class MyInterceptor implements InvocationInterceptor {
3527+
@Override
3528+
public void interceptDynamicTest(Invocation<Void> invocation, ExtensionContext extensionContext) throws Throwable {
3529+
System.out.println("Before dynamic test");
3530+
invocation.proceed();
3531+
System.out.println("After dynamic test");
3532+
}
3533+
3534+
@Override
3535+
public void interceptTestMethod(Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable {
3536+
invocation.proceed();
3537+
}
3538+
3539+
private static class Method {}
3540+
}
3541+
after: |
3542+
import org.junit.jupiter.api.extension.ExtensionContext;
3543+
import org.junit.jupiter.api.extension.InvocationInterceptor;
3544+
import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
3545+
3546+
class MyInterceptor implements InvocationInterceptor {
3547+
3548+
@Override
3549+
public void interceptTestMethod(Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable {
3550+
invocation.proceed();
3551+
}
3552+
3553+
private static class Method {}
3554+
}
3555+
language: java
3556+
---
3557+
type: specs.openrewrite.org/v1beta/example
34803558
recipeName: org.openrewrite.java.testing.mockito.CleanupMockitoImports
34813559
examples:
34823560
- description: ''

src/test/java/org/openrewrite/java/testing/junit6/MigrateMethodOrdererAlphanumericTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,4 @@ void test2() {
178178
)
179179
);
180180
}
181-
}
181+
}

0 commit comments

Comments
 (0)