Skip to content

Commit bde65d7

Browse files
refactor: Extract documentation examples from tests
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.java.recipes.ExamplesExtractor?organizationId=ODQ2MGExMTUtNDg0My00N2EwLTgzMGMtNGE1NGExMTBmZDkw Co-authored-by: Moderne <[email protected]>
1 parent 827ba5c commit bde65d7

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3246,6 +3246,41 @@ examples:
32463246
language: java
32473247
---
32483248
type: specs.openrewrite.org/v1beta/example
3249+
recipeName: org.openrewrite.java.testing.mockito.CloseUnclosedStaticMocks
3250+
examples:
3251+
- description: ''
3252+
sources:
3253+
- before: |
3254+
import org.junit.jupiter.api.Test;
3255+
3256+
import static org.junit.jupiter.api.Assertions.assertEquals;
3257+
import static org.mockito.Mockito.mockStatic;
3258+
3259+
class TestClass {
3260+
@Test
3261+
void test() {
3262+
mockStatic(A.class);
3263+
assertEquals(A.getNumber(), 42);
3264+
}
3265+
}
3266+
after: |
3267+
import org.junit.jupiter.api.Test;
3268+
import org.mockito.MockedStatic;
3269+
3270+
import static org.junit.jupiter.api.Assertions.assertEquals;
3271+
import static org.mockito.Mockito.mockStatic;
3272+
3273+
class TestClass {
3274+
@Test
3275+
void test() {
3276+
try (MockedStatic<A> mockedStaticA = mockStatic(A.class)) {
3277+
assertEquals(A.getNumber(), 42);
3278+
}
3279+
}
3280+
}
3281+
language: java
3282+
---
3283+
type: specs.openrewrite.org/v1beta/example
32493284
recipeName: org.openrewrite.java.testing.mockito.MockUtilsToStatic
32503285
examples:
32513286
- description: ''

0 commit comments

Comments
 (0)