mockit.internal.expectations.invocation.InvocationArguments Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmockit Show documentation
Show all versions of jmockit Show documentation
JMockit is a Java toolkit for automated developer testing.
It contains APIs for the creation of the objects to be tested, for mocking dependencies, and for faking external
APIs; JUnit (4 & 5) and TestNG test runners are supported.
It also contains an advanced code coverage tool.
/*
* 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.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 & Access.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
© 2015 - 2024 Weber Informatics LLC | Privacy Policy