18
18
package br .org .soujava .pomeditor .mojo ;
19
19
20
20
21
+ import br .org .soujava .pomeditor .InvalidGroupIdArtifactIdArgs ;
21
22
import br .org .soujava .pomeditor .api .Dependency ;
22
23
import org .apache .maven .plugin .MojoExecutionException ;
23
24
import org .apache .maven .plugin .MojoFailureException ;
29
30
import org .junit .jupiter .api .Test ;
30
31
import org .junit .jupiter .api .extension .ExtendWith ;
31
32
import org .junit .jupiter .params .ParameterizedTest ;
32
- import org .junit .jupiter .params .provider .Arguments ;
33
- import org .junit .jupiter .params .provider .MethodSource ;
33
+ import org .junit .jupiter .params .provider .ArgumentsSource ;
34
34
import org .mockito .ArgumentCaptor ;
35
35
import org .mockito .Captor ;
36
36
import org .mockito .Mock ;
48
48
import java .util .function .Consumer ;
49
49
import java .util .function .Function ;
50
50
import java .util .stream .Collectors ;
51
- import java .util .stream .Stream ;
52
51
53
52
import static org .assertj .core .api .Assertions .assertThat ;
54
- import static org .junit .jupiter .params .provider .Arguments .arguments ;
55
53
import static org .mockito .ArgumentMatchers .any ;
56
54
import static org .mockito .ArgumentMatchers .anyString ;
57
55
import static org .mockito .Mockito .atLeastOnce ;
@@ -84,7 +82,7 @@ class AddDependencyMojoTest {
84
82
85
83
@ DisplayName ("should return error when" )
86
84
@ ParameterizedTest (name = "groupId={0}, artifactId={1}" )
87
- @ MethodSource ( "invalidParameters" )
85
+ @ ArgumentsSource ( InvalidGroupIdArtifactIdArgs . class )
88
86
void shouldReturnErrorsForInvalidRequiredParameters (final String groupId ,
89
87
final String artifactId ) {
90
88
Assertions .assertThrows (MojoExecutionException .class , () -> {
@@ -99,36 +97,6 @@ void shouldReturnErrorsForInvalidRequiredParameters(final String groupId,
99
97
verify (rollbackFunction , never ()).accept (any ());
100
98
}
101
99
102
- static Stream <Arguments > invalidParameters () {
103
- return Stream .of (
104
- arguments (
105
- null , // groupId,
106
- null // artifactId,
107
- ),
108
- arguments (
109
- null , // groupId,
110
- "artifactId" // artifactId,
111
- ),
112
- arguments (
113
- "groupId" , // groupId,
114
- null // artifactId,
115
- ),
116
- arguments (
117
- "" , // groupId,
118
- "" // artifactId,
119
- ),
120
- arguments (
121
- "" , // groupId,
122
- "artifactId" // artifactId,
123
- ),
124
- arguments (
125
- "groupId" , // groupId,
126
- "" // artifactId,
127
- )
128
- );
129
- }
130
-
131
-
132
100
@ Test
133
101
void shouldAddDependencyProperly () throws MojoExecutionException , MojoFailureException {
134
102
0 commit comments