@@ -300,40 +300,40 @@ examples:
300300- description : ' '
301301 sources :
302302 - before : |
303- import static org.testng.Assert.fail;
304-
303+ import static org.assertj.core.api.Assertions.assertThat;
305304 class Test {
306305 void test() {
307- fail("foo");
308- fail("foo", new IllegalStateException());
309- fail();
306+ assertThat("test").isEqualTo("");
310307 }
311308 }
312309 after: |
313- import static org.assertj.core.api.Assertions.fail;
314-
310+ import static org.assertj.core.api.Assertions.assertThat;
315311 class Test {
316312 void test() {
317- fail("foo");
318- fail("foo", new IllegalStateException());
319- fail();
313+ assertThat("test").isEmpty();
320314 }
321315 }
322316 language: java
323317 - description : ' '
324318 sources :
325319 - before : |
326- import static org.assertj.core.api.Assertions.assertThat;
320+ import static org.testng.Assert.fail;
321+
327322 class Test {
328323 void test() {
329- assertThat("test").isEqualTo("");
324+ fail("foo");
325+ fail("foo", new IllegalStateException());
326+ fail();
330327 }
331328 }
332329 after: |
333- import static org.assertj.core.api.Assertions.assertThat;
330+ import static org.assertj.core.api.Assertions.fail;
331+
334332 class Test {
335333 void test() {
336- assertThat("test").isEmpty();
334+ fail("foo");
335+ fail("foo", new IllegalStateException());
336+ fail();
337337 }
338338 }
339339 language: java
@@ -2327,6 +2327,35 @@ examples:
23272327 language: kotlin
23282328 ---
23292329type : specs.openrewrite.org/v1beta/example
2330+ recipeName : org.openrewrite.java.testing.junit5.CsvSourceToValueSource
2331+ examples :
2332+ - description : ' '
2333+ sources :
2334+ - before : |
2335+ import org.junit.jupiter.params.ParameterizedTest;
2336+ import org.junit.jupiter.params.provider.CsvSource;
2337+
2338+ class TestClass {
2339+ @ParameterizedTest
2340+ @CsvSource({"apple", "banana", "cherry"})
2341+ void testWithStrings(String fruit) {
2342+ System.out.println(fruit);
2343+ }
2344+ }
2345+ after: |
2346+ import org.junit.jupiter.params.ParameterizedTest;
2347+ import org.junit.jupiter.params.provider.ValueSource;
2348+
2349+ class TestClass {
2350+ @ParameterizedTest
2351+ @ValueSource(strings = {"apple", "banana", "cherry"})
2352+ void testWithStrings(String fruit) {
2353+ System.out.println(fruit);
2354+ }
2355+ }
2356+ language: java
2357+ ---
2358+ type : specs.openrewrite.org/v1beta/example
23302359recipeName : org.openrewrite.java.testing.junit5.EnvironmentVariables
23312360examples :
23322361- description : ' '
@@ -3300,9 +3329,6 @@ examples:
33003329 after: |
33013330 import org.junit.jupiter.api.Test;
33023331 import org.junit.jupiter.api.condition.EnabledOnJre;
3303- import org.junit.jupiter.api.condition.DisabledOnJre;
3304- import org.junit.jupiter.api.condition.EnabledForJreRange;
3305- import org.junit.jupiter.api.condition.DisabledForJreRange;
33063332 import org.junit.jupiter.api.condition.JRE;
33073333
33083334 class MyTest {
@@ -3411,6 +3437,61 @@ examples:
34113437type : specs.openrewrite.org/v1beta/example
34123438recipeName : org.openrewrite.java.testing.mockito.Mockito1to3Migration
34133439examples :
3440+ - description : ' '
3441+ sources :
3442+ - before : |
3443+ package mockito.example;
3444+
3445+ import java.util.List;
3446+ import java.util.Map;
3447+ import java.util.Set;
3448+
3449+ import static org.mockito.ArgumentMatchers.anyListOf;
3450+ import static org.mockito.ArgumentMatchers.anySetOf;
3451+ import static org.mockito.ArgumentMatchers.anyMapOf;
3452+ import static org.mockito.Mockito.mock;
3453+ import static org.mockito.Mockito.when;
3454+
3455+ public class MockitoVarargMatcherTest {
3456+ public static class Foo {
3457+ public boolean addList(List<String> strings) { return true; }
3458+ public boolean addSet(Set<String> strings) { return true; }
3459+ public boolean addMap(Map<String, String> stringStringMap) { return true; }
3460+ }
3461+ public void usesVarargMatcher() {
3462+ Foo mockFoo = mock(Foo.class);
3463+ when(mockFoo.addList(anyListOf(String.class))).thenReturn(true);
3464+ when(mockFoo.addSet(anySetOf(String.class))).thenReturn(true);
3465+ when(mockFoo.addMap(anyMapOf(String.class, String.class))).thenReturn(true);
3466+ }
3467+ }
3468+ after: |
3469+ package mockito.example;
3470+
3471+ import java.util.List;
3472+ import java.util.Map;
3473+ import java.util.Set;
3474+
3475+ import static org.mockito.ArgumentMatchers.anyList;
3476+ import static org.mockito.ArgumentMatchers.anySet;
3477+ import static org.mockito.ArgumentMatchers.anyMap;
3478+ import static org.mockito.Mockito.mock;
3479+ import static org.mockito.Mockito.when;
3480+
3481+ public class MockitoVarargMatcherTest {
3482+ public static class Foo {
3483+ public boolean addList(List<String> strings) { return true; }
3484+ public boolean addSet(Set<String> strings) { return true; }
3485+ public boolean addMap(Map<String, String> stringStringMap) { return true; }
3486+ }
3487+ public void usesVarargMatcher() {
3488+ Foo mockFoo = mock(Foo.class);
3489+ when(mockFoo.addList(anyList())).thenReturn(true);
3490+ when(mockFoo.addSet(anySet())).thenReturn(true);
3491+ when(mockFoo.addMap(anyMap())).thenReturn(true);
3492+ }
3493+ }
3494+ language: java
34143495 - description : ' '
34153496 sources :
34163497 - before : |
@@ -3546,61 +3627,6 @@ examples:
35463627 </project>
35473628 path: pom.xml
35483629 language: xml
3549- - description : ' '
3550- sources :
3551- - before : |
3552- package mockito.example;
3553-
3554- import java.util.List;
3555- import java.util.Map;
3556- import java.util.Set;
3557-
3558- import static org.mockito.ArgumentMatchers.anyListOf;
3559- import static org.mockito.ArgumentMatchers.anySetOf;
3560- import static org.mockito.ArgumentMatchers.anyMapOf;
3561- import static org.mockito.Mockito.mock;
3562- import static org.mockito.Mockito.when;
3563-
3564- public class MockitoVarargMatcherTest {
3565- public static class Foo {
3566- public boolean addList(List<String> strings) { return true; }
3567- public boolean addSet(Set<String> strings) { return true; }
3568- public boolean addMap(Map<String, String> stringStringMap) { return true; }
3569- }
3570- public void usesVarargMatcher() {
3571- Foo mockFoo = mock(Foo.class);
3572- when(mockFoo.addList(anyListOf(String.class))).thenReturn(true);
3573- when(mockFoo.addSet(anySetOf(String.class))).thenReturn(true);
3574- when(mockFoo.addMap(anyMapOf(String.class, String.class))).thenReturn(true);
3575- }
3576- }
3577- after: |
3578- package mockito.example;
3579-
3580- import java.util.List;
3581- import java.util.Map;
3582- import java.util.Set;
3583-
3584- import static org.mockito.ArgumentMatchers.anyList;
3585- import static org.mockito.ArgumentMatchers.anySet;
3586- import static org.mockito.ArgumentMatchers.anyMap;
3587- import static org.mockito.Mockito.mock;
3588- import static org.mockito.Mockito.when;
3589-
3590- public class MockitoVarargMatcherTest {
3591- public static class Foo {
3592- public boolean addList(List<String> strings) { return true; }
3593- public boolean addSet(Set<String> strings) { return true; }
3594- public boolean addMap(Map<String, String> stringStringMap) { return true; }
3595- }
3596- public void usesVarargMatcher() {
3597- Foo mockFoo = mock(Foo.class);
3598- when(mockFoo.addList(anyList())).thenReturn(true);
3599- when(mockFoo.addSet(anySet())).thenReturn(true);
3600- when(mockFoo.addMap(anyMap())).thenReturn(true);
3601- }
3602- }
3603- language: java
36043630 ---
36053631type : specs.openrewrite.org/v1beta/example
36063632recipeName : org.openrewrite.java.testing.mockito.Mockito1to4Migration
0 commit comments