Skip to content

Commit

Permalink
fixed files form Mockito #1
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 84b0f5b commit 26cebd4
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,18 @@ public Location getLocation() {
public void captureArgumentsFrom(Invocation invocation) {
if (invocation.getMethod().isVarArgs()) {
int indexOfVararg = invocation.getRawArguments().length - 1;
throw new UnsupportedOperationException();
for (int position = 0; position < indexOfVararg; position++) {
Matcher m = matchers.get(position);
if (m instanceof CapturesArguments) {
((CapturesArguments) m).captureFrom(invocation.getArgumentAt(position, Object.class));
}
}
for (int position = indexOfVararg; position < matchers.size(); position++) {
Matcher m = matchers.get(position);
if (m instanceof CapturesArguments) {
((CapturesArguments) m).captureFrom(invocation.getRawArguments()[position - indexOfVararg]);
}
}

} else {
for (int position = 0; position < matchers.size(); position++) {
Expand Down

0 comments on commit 26cebd4

Please sign in to comment.