Skip to content

Commit 69a82d4

Browse files
committed
Fixing Unit tests
1 parent 9fc6ac7 commit 69a82d4

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/test/kotlin/org/openrewrite/java/testing/mockito/JunitMockitoUpgradeIntegrationTest.kt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ class JunitMockitoUpgradeIntegrationTest : RefactorVisitorTestForParser<J.Compil
8989
List<String> mockedList;
9090
9191
@BeforeEach
92-
public void initMocks() {
92+
void initMocks() {
9393
MockitoAnnotations.initMocks(this);
9494
}
9595
9696
@Test
97-
public void usingAnnotationBasedMock() {
97+
void usingAnnotationBasedMock() {
9898
9999
mockedList.add("one");
100100
mockedList.clear();
@@ -343,6 +343,7 @@ class JunitMockitoUpgradeIntegrationTest : RefactorVisitorTestForParser<J.Compil
343343
""".trimIndent()
344344
val exampleJunitAfter = """
345345
package org.openrewrite.java.testing.junit5;
346+
346347
import org.junit.jupiter.api.*;
347348
import org.junit.jupiter.api.io.TempDir;
348349
import org.mockito.Mock;
@@ -365,12 +366,12 @@ class JunitMockitoUpgradeIntegrationTest : RefactorVisitorTestForParser<J.Compil
365366
public File folder;
366367
367368
@BeforeEach
368-
public void beforeClass() {
369+
void beforeClass() {
369370
MockitoAnnotations.initMocks(this);
370371
}
371372
372373
@AfterAll
373-
public static void afterClass() { }
374+
static void afterClass() { }
374375
375376
@Mock
376377
List<String> mockedList;
@@ -380,7 +381,7 @@ class JunitMockitoUpgradeIntegrationTest : RefactorVisitorTestForParser<J.Compil
380381
}
381382
382383
@Test
383-
public void usingAnnotationBasedMock() {
384+
void usingAnnotationBasedMock() {
384385
mockedList.add("one");
385386
mockedList.clear();
386387
@@ -389,7 +390,7 @@ class JunitMockitoUpgradeIntegrationTest : RefactorVisitorTestForParser<J.Compil
389390
}
390391
391392
@Test
392-
public void foo() throws IOException {
393+
void foo() throws IOException {
393394
assertThrows(RuntimeException.class, () -> {
394395
File tempFile = File.createTempFile("junit", null, folder);
395396
File tempFile2 = newFile(folder, "filename");
@@ -403,21 +404,21 @@ class JunitMockitoUpgradeIntegrationTest : RefactorVisitorTestForParser<J.Compil
403404
}
404405
405406
@Test
406-
public void foo2() {
407+
void foo2() {
407408
assertThrows(IndexOutOfBoundsException.class, () -> {
408409
int arr = new int[]{}[0];
409410
});
410411
}
411412
412413
@Test
413-
public void foo3() {
414+
void foo3() {
414415
assertThrows(RuntimeException.class, () -> {
415416
throw new RuntimeException();
416417
});
417418
}
418419
419420
@Test
420-
public void assertsStuff() {
421+
void assertsStuff() {
421422
Assertions.assertEquals(1, 1, "One is one");
422423
Assertions.assertArrayEquals(new int[]{}, new int[]{}, "Empty is empty");
423424
Assertions.assertNotEquals(1, 2, "one is not two");
@@ -430,10 +431,10 @@ class JunitMockitoUpgradeIntegrationTest : RefactorVisitorTestForParser<J.Compil
430431
431432
@Test
432433
@Timeout(500)
433-
public void bar() { }
434+
void bar() { }
434435
435436
@Test
436-
public void aTest() {
437+
void aTest() {
437438
String foo = mock(String.class);
438439
when(foo.concat(any())).then(invocation -> invocation.getArgument(0, String.class));
439440
}

0 commit comments

Comments
 (0)