|
20 | 20 |
|
21 | 21 | import org.eclipse.aether.RepositorySystem; |
22 | 22 | import org.eclipse.aether.RepositorySystemSession; |
| 23 | +import org.junit.jupiter.api.BeforeEach; |
23 | 24 | import org.junit.jupiter.api.Test; |
24 | 25 | import org.junit.jupiter.api.extension.ExtendWith; |
25 | 26 | import org.mockito.InjectMocks; |
| 27 | +import org.mockito.Mock; |
26 | 28 | import org.mockito.junit.jupiter.MockitoExtension; |
27 | 29 |
|
28 | 30 | import static org.junit.jupiter.api.Assertions.assertEquals; |
29 | 31 | import static org.mockito.ArgumentMatchers.any; |
30 | 32 | import static org.mockito.ArgumentMatchers.anyList; |
31 | | -import static org.mockito.Mockito.mock; |
32 | 33 | import static org.mockito.Mockito.when; |
33 | 34 |
|
34 | 35 | @ExtendWith(MockitoExtension.class) |
35 | 36 | class WrapperMojoTest { |
36 | | - private final RepositorySystem repositorySystem; |
| 37 | + @Mock(strictness = Mock.Strictness.LENIENT) |
| 38 | + private RepositorySystem repositorySystem; |
37 | 39 |
|
38 | | - private final RepositorySystemSession repositorySystemSession; |
| 40 | + @Mock |
| 41 | + private RepositorySystemSession repositorySystemSession; |
39 | 42 |
|
40 | 43 | @InjectMocks |
41 | | - private WrapperMojo wrapperMojo = new WrapperMojo(); |
| 44 | + private WrapperMojo wrapperMojo; |
42 | 45 |
|
43 | | - WrapperMojoTest() { |
44 | | - this.repositorySystem = mock(RepositorySystem.class); |
| 46 | + @BeforeEach |
| 47 | + void setupMocks() { |
45 | 48 | when(repositorySystem.newResolutionRepositories(any(RepositorySystemSession.class), anyList())) |
46 | 49 | .then(i -> i.getArguments()[1]); |
47 | | - this.repositorySystemSession = mock(RepositorySystemSession.class); |
48 | 50 | } |
49 | 51 |
|
50 | 52 | @Test |
|
0 commit comments