13
13
import org .testng .IDataProviderInterceptor ;
14
14
import org .testng .IDataProviderListener ;
15
15
import org .testng .IInstanceInfo ;
16
+ import org .testng .ITestClassInstance ;
16
17
import org .testng .ITestContext ;
17
18
import org .testng .ITestMethodFinder ;
18
19
import org .testng .ITestNGListener ;
@@ -145,8 +146,8 @@ private static String[] getAllGroups(
145
146
return groups .toArray (new String [0 ]);
146
147
}
147
148
148
- public org . testng . IParameterInfo [] invoke () {
149
- List <org . testng . IParameterInfo > result = Lists .newArrayList ();
149
+ public ITestClassInstance [] invoke () {
150
+ List <ITestClassInstance > result = Lists .newArrayList ();
150
151
151
152
Map <String , String > allParameterNames = Maps .newHashMap ();
152
153
Parameters .MethodParameters methodParameters =
@@ -175,7 +176,7 @@ public org.testng.IParameterInfo[] invoke() {
175
176
try {
176
177
List <Integer > indices = factoryAnnotation .getIndices ();
177
178
int position = 0 ;
178
- AtomicInteger counter = new AtomicInteger (0 );
179
+ AtomicInteger invocationCounter = new AtomicInteger (0 );
179
180
while (parameterIterator .hasNext ()) {
180
181
Object [] parameters = parameterIterator .next ();
181
182
if (parameters == null ) {
@@ -201,15 +202,21 @@ public org.testng.IParameterInfo[] invoke() {
201
202
.map (
202
203
instance ->
203
204
new ParameterInfo (
204
- instance , instancePosition , parameters , counter .getAndIncrement ()))
205
+ instance ,
206
+ instancePosition ,
207
+ parameters ,
208
+ invocationCounter .getAndIncrement ()))
205
209
.collect (Collectors .toList ()));
206
210
} else {
207
211
for (Integer index : indices ) {
208
212
int i = index - position ;
209
213
if (i >= 0 && i < testInstances .length ) {
210
214
result .add (
211
215
new ParameterInfo (
212
- testInstances [i ], position , parameters , counter .getAndIncrement ()));
216
+ testInstances [i ],
217
+ position ,
218
+ parameters ,
219
+ invocationCounter .getAndIncrement ()));
213
220
}
214
221
}
215
222
}
@@ -218,7 +225,8 @@ public org.testng.IParameterInfo[] invoke() {
218
225
if (indices == null || indices .isEmpty () || indices .contains (position )) {
219
226
Object instance = m_objectFactory .newInstance (com .getConstructor (), parameters );
220
227
result .add (
221
- new ParameterInfo (instance , position , parameters , counter .getAndIncrement ()));
228
+ new ParameterInfo (
229
+ instance , position , parameters , invocationCounter .getAndIncrement ()));
222
230
}
223
231
position ++;
224
232
}
0 commit comments