@@ -1532,8 +1532,8 @@ examples:
15321532 }
15331533 after: |
15341534 import static org.easymock.EasyMock.expect;
1535- import static org.easymock.EasyMock.createNiceMock;
15361535 import static org.mockito.Mockito.verify;
1536+ import static org.easymock.EasyMock.createNiceMock;
15371537
15381538 public class ExampleTest {
15391539 public void testServiceMethod() {
@@ -1814,15 +1814,14 @@ examples:
18141814 after: |
18151815 import org.junit.jupiter.api.Test;
18161816
1817- import static org.assertj.core.api.Assertions.assertThat;
18181817 import static org.hamcrest.MatcherAssert.assertThat;
18191818 import static org.hamcrest.Matchers.equalTo;
18201819 import static org.hamcrest.Matchers.hasLength;
18211820
18221821 class MyTest {
18231822 @Test
18241823 void testMethod() {
1825- assertThat("hello world")
1824+ org.assertj.core.api.Assertions. assertThat("hello world")
18261825 .satisfies(
18271826 arg -> assertThat(arg, equalTo("hello world")),
18281827 arg -> assertThat(arg, hasLength(12))
@@ -2248,7 +2247,7 @@ examples:
22482247 @Test
22492248 void testJUnit5() {
22502249 List<String> list = new ArrayList<>();
2251- assertTrue(list instanceof Iterable );
2250+ assertTrue(list instanceof List );
22522251 }
22532252 }
22542253 after: |
@@ -2262,7 +2261,7 @@ examples:
22622261 @Test
22632262 void testJUnit5() {
22642263 List<String> list = new ArrayList<>();
2265- assertInstanceOf(Iterable .class, list);
2264+ assertInstanceOf(List .class, list);
22662265 }
22672266 }
22682267 language: java
@@ -2396,16 +2395,17 @@ examples:
23962395 after: |
23972396 import org.junit.Test;
23982397
2398+ import static org.hamcrest.CoreMatchers.containsString;
2399+ import static org.hamcrest.MatcherAssert.assertThat;
23992400 import static org.junit.jupiter.api.Assertions.assertThrows;
2400- import static org.junit.jupiter.api.Assertions.assertTrue;
24012401
24022402 class MyTest {
24032403
24042404 @Test
24052405 public void testEmptyPath() {
24062406 Throwable exception = assertThrows(IllegalArgumentException.class, () ->
24072407 foo());
2408- assertTrue (exception.getMessage().contains ("Invalid location: gs://"));
2408+ assertThat (exception.getMessage(), containsString ("Invalid location: gs://"));
24092409 }
24102410 void foo() {
24112411 }
@@ -3389,6 +3389,25 @@ examples:
33893389type : specs.openrewrite.org/v1beta/example
33903390recipeName : org.openrewrite.java.testing.mockito.Mockito1to5Migration
33913391examples :
3392+ - description : ' '
3393+ sources :
3394+ - before : |
3395+ <project>
3396+ <modelVersion>4.0.0</modelVersion>
3397+ <groupId>com.example</groupId>
3398+ <artifactId>demo</artifactId>
3399+ <version>0.0.1-SNAPSHOT</version>
3400+ <dependencies>
3401+ <dependency>
3402+ <groupId>org.mockito</groupId>
3403+ <artifactId>mockito-inline</artifactId>
3404+ <version>3.11.2</version>
3405+ <scope>test</scope>
3406+ </dependency>
3407+ </dependencies>
3408+ </project>
3409+ path: pom.xml
3410+ language: xml
33923411 - description : ' '
33933412 sources :
33943413 - before : |
@@ -3424,25 +3443,6 @@ examples:
34243443 }
34253444 }
34263445 language: java
3427- - description : ' '
3428- sources :
3429- - before : |
3430- <project>
3431- <modelVersion>4.0.0</modelVersion>
3432- <groupId>com.example</groupId>
3433- <artifactId>demo</artifactId>
3434- <version>0.0.1-SNAPSHOT</version>
3435- <dependencies>
3436- <dependency>
3437- <groupId>org.mockito</groupId>
3438- <artifactId>mockito-inline</artifactId>
3439- <version>3.11.2</version>
3440- <scope>test</scope>
3441- </dependency>
3442- </dependencies>
3443- </project>
3444- path: pom.xml
3445- language: xml
34463446 ---
34473447type : specs.openrewrite.org/v1beta/example
34483448recipeName : org.openrewrite.java.testing.mockito.MockitoBestPractices
0 commit comments