mockit.internal.expectations.invocation.InvocationArguments Maven / Gradle / Ivy
/*
* Copyright (c) 2006-2013 Rogério Liesenfeld
* This file is subject to the terms of the MIT license (see LICENSE.txt).
*/
package mockit.internal.expectations.invocation;
import java.util.*;
import mockit.external.asm4.*;
import mockit.internal.*;
import mockit.internal.expectations.argumentMatching.*;
import mockit.internal.state.*;
import mockit.internal.util.*;
public final class InvocationArguments
{
final String classDesc;
final String methodNameAndDesc;
final String genericSignature;
final String[] exceptions;
private final ArgumentValuesAndMatchers valuesAndMatchers;
private RealMethod realMethod;
InvocationArguments(
int access, String classDesc, String methodNameAndDesc, String genericSignature, String exceptions, Object[] args)
{
this.classDesc = classDesc;
this.methodNameAndDesc = methodNameAndDesc;
this.genericSignature = genericSignature;
this.exceptions = exceptions == null ? null : exceptions.split(" ");
valuesAndMatchers =
(access & Opcodes.ACC_VARARGS) == 0 ?
new ArgumentValuesAndMatchersWithoutVarargs(this, args) :
new ArgumentValuesAndMatchersWithVarargs(this, args);
}
String getClassName() { return classDesc.replace('/', '.'); }
boolean isForConstructor() { return methodNameAndDesc.charAt(0) == '<'; }
public Object[] getValues() { return valuesAndMatchers.values; }
void setValues(Object[] values) { valuesAndMatchers.values = values; }
public void setValuesWithNoMatchers(Object[] argsToVerify)
{
valuesAndMatchers.setValuesWithNoMatchers(argsToVerify);
}
public List getMatchers() { return valuesAndMatchers.matchers; }
public void setMatchers(List matchers) { valuesAndMatchers.matchers = matchers; }
public Object[] prepareForVerification(Object[] argsToVerify, List matchers)
{
return valuesAndMatchers.prepareForVerification(argsToVerify, matchers);
}
public boolean isMatch(Object[] replayArgs, Map