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