1616package org .openrewrite .java .testing .assertj ;
1717
1818import org .junit .jupiter .api .Test ;
19+ import org .openrewrite .InMemoryExecutionContext ;
1920import org .openrewrite .java .JavaParser ;
2021import org .openrewrite .test .RecipeSpec ;
2122import org .openrewrite .test .RewriteTest ;
@@ -29,7 +30,8 @@ class JUnitAssertArrayEqualsToAssertThatTest implements RewriteTest {
2930 @ Override
3031 public void defaults (RecipeSpec spec ) {
3132 spec
32- .parser (JavaParser .fromJavaVersion ().classpath ("junit" ))
33+ .parser (JavaParser .fromJavaVersion ()
34+ .classpathFromResources (new InMemoryExecutionContext (), "junit-jupiter-api-5.9.+" ))
3335 .recipe (new JUnitAssertArrayEqualsToAssertThat ());
3436 }
3537
@@ -39,7 +41,7 @@ void singleStaticMethodNoMessage() {
3941 rewriteRun (
4042 java (
4143 """
42- import org.junit.Test;
44+ import org.junit.jupiter.api. Test;
4345
4446 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
4547
@@ -56,7 +58,7 @@ private Integer[] notification() {
5658 }
5759 """ ,
5860 """
59- import org.junit.Test;
61+ import org.junit.jupiter.api. Test;
6062
6163 import static org.assertj.core.api.Assertions.assertThat;
6264
@@ -83,7 +85,7 @@ void singleStaticMethodWithMessageLambda() {
8385 spec -> spec .typeValidationOptions (TypeValidation .none ()),
8486 java (
8587 """
86- import org.junit.Test;
88+ import org.junit.jupiter.api. Test;
8789
8890 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
8991
@@ -98,7 +100,7 @@ private int[] notification() {
98100 }
99101 """ ,
100102 """
101- import org.junit.Test;
103+ import org.junit.jupiter.api. Test;
102104
103105 import static org.assertj.core.api.Assertions.assertThat;
104106
@@ -122,7 +124,7 @@ void doublesWithinNoMessage() {
122124 rewriteRun (
123125 java (
124126 """
125- import org.junit.Test;
127+ import org.junit.jupiter.api. Test;
126128
127129 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
128130
@@ -138,7 +140,7 @@ private double[] notification() {
138140 }
139141 """ ,
140142 """
141- import org.junit.Test;
143+ import org.junit.jupiter.api. Test;
142144
143145 import static org.assertj.core.api.Assertions.assertThat;
144146 import static org.assertj.core.api.Assertions.within;
@@ -165,7 +167,7 @@ void doublesWithinAndWithMessage() {
165167 spec -> spec .typeValidationOptions (TypeValidation .none ()),
166168 java (
167169 """
168- import org.junit.Test;
170+ import org.junit.jupiter.api. Test;
169171
170172 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
171173
@@ -180,7 +182,7 @@ private double[] notification() {
180182 }
181183 """ ,
182184 """
183- import org.junit.Test;
185+ import org.junit.jupiter.api. Test;
184186
185187 import static org.assertj.core.api.Assertions.assertThat;
186188 import static org.assertj.core.api.Assertions.within;
@@ -206,7 +208,7 @@ void doublesObjectsWithMessage() {
206208 spec -> spec .typeValidationOptions (TypeValidation .none ()),
207209 java (
208210 """
209- import org.junit.Test;
211+ import org.junit.jupiter.api. Test;
210212
211213 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
212214
@@ -221,7 +223,7 @@ private Double[] notification() {
221223 }
222224 """ ,
223225 """
224- import org.junit.Test;
226+ import org.junit.jupiter.api. Test;
225227
226228 import static org.assertj.core.api.Assertions.assertThat;
227229
@@ -245,10 +247,10 @@ void floatCloseToWithNoMessage() {
245247 rewriteRun (
246248 java (
247249 """
248- import org.junit.Test;
249-
250+ import org.junit.jupiter.api. Test;
251+
250252 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
251-
253+
252254 public class MyTest {
253255 @Test
254256 public void test() {
@@ -260,11 +262,11 @@ private float[] notification() {
260262 }
261263 """ ,
262264 """
263- import org.junit.Test;
264-
265+ import org.junit.jupiter.api. Test;
266+
265267 import static org.assertj.core.api.Assertions.assertThat;
266268 import static org.assertj.core.api.Assertions.within;
267-
269+
268270 public class MyTest {
269271 @Test
270272 public void test() {
@@ -286,7 +288,7 @@ void floatCloseToWithMessage() {
286288 spec -> spec .typeValidationOptions (TypeValidation .none ()),
287289 java (
288290 """
289- import org.junit.Test;
291+ import org.junit.jupiter.api. Test;
290292
291293 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
292294
@@ -301,7 +303,7 @@ private float[] notification() {
301303 }
302304 """ ,
303305 """
304- import org.junit.Test;
306+ import org.junit.jupiter.api. Test;
305307
306308 import static org.assertj.core.api.Assertions.assertThat;
307309 import static org.assertj.core.api.Assertions.within;
@@ -327,7 +329,7 @@ void fullyQualifiedMethodWithMessage() {
327329 spec -> spec .typeValidationOptions (TypeValidation .none ()),
328330 java (
329331 """
330- import org.junit.Test;
332+ import org.junit.jupiter.api. Test;
331333
332334 public class MyTest {
333335 @Test
@@ -341,7 +343,7 @@ private String[] notification() {
341343 }
342344 """ ,
343345 """
344- import org.junit.Test;
346+ import org.junit.jupiter.api. Test;
345347
346348 import static org.assertj.core.api.Assertions.assertThat;
347349
0 commit comments