File | Line |
---|
org/starobjects/tested/fitnesse/internal/fixtures/perform/checkthat/action/ArgumentSetNotValid.java | 17 |
org/starobjects/tested/fitnesse/internal/fixtures/perform/checkthat/action/ArgumentSetValid.java | 17 |
super("is valid for", "is valid", "valid");
}
// TODO: a lot of duplication with InvokeAction; simplify somehow?
public NakedObject that(final PerformContext performContext) {
final NakedObject onAdapter = performContext.getOnAdapter();
final NakedObjectMember nakedObjectMember = performContext
.getNakedObjectMember();
final CellBinding usingMemberBinding = performContext
.getOnMemberBinding();
final Parse[] argumentCells = performContext.getArgumentCells();
final Parse onMemberCell = usingMemberBinding.getCurrentCell();
final NakedObjectAction nakedObjectAction = (NakedObjectAction) nakedObjectMember;
final int parameterCount = nakedObjectAction.getParameterCount();
final boolean isContributedOneArgAction = nakedObjectAction
.isContributed()
&& parameterCount == 1;
if (isContributedOneArgAction) {
return null;
}
if (argumentCells.length != parameterCount) {
getOwner().throwException(onMemberCell,
"(action requires " + parameterCount + " arguments");
}
// lookup arguments
final NakedObject[] proposedArguments = NakedObjectUtils.getAdapters(
getOwner(), onAdapter, nakedObjectAction, argumentCells);
// validate arguments
final Consent argSetValid = nakedObjectAction
.isProposedArgumentSetValid(onAdapter, proposedArguments);
if (argSetValid.isVetoed()) { |
File | Line |
---|
org/starobjects/tested/fitnesse/internal/fixtures/AliasItemsInList.java | 93 |
org/starobjects/tested/fitnesse/internal/fixtures/CheckList.java | 142 |
found(adapter);
return;
}
FitnesseUtil.exception(this, titleBinding.getCurrentCell(),
"(not found)");
}
private boolean titleMatches(final NakedObject adapter) {
final String adapterTitle = adapter.titleString();
final String requiredTitle = titleBinding.getCurrentCell().text();
return StringUtil.nullSafeEquals(adapterTitle, requiredTitle);
}
private boolean typeMatches(final NakedObject adapter) {
if (!typeBinding.isFound()) {
return true;
}
final NakedObjectSpecification spec = adapter.getSpecification();
final String requiredTypeName = typeBinding.getCurrentCell().text();
final String specFullName = spec.getFullName();
if (specFullName.equals(requiredTypeName)) {
return true;
}
final String simpleSpecName = StringUtil.simpleName(specFullName);
final String simpleRequiredType = StringUtil
.simpleName(requiredTypeName);
return simpleSpecName.equalsIgnoreCase(simpleRequiredType);
} |
File | Line |
---|
org/starobjects/tested/fitnesse/internal/fixtures/perform/GetActionParameterChoices.java | 16 |
org/starobjects/tested/fitnesse/internal/fixtures/perform/GetActionParameterDefault.java | 15 |
super("get action parameter default", Type.ACTION, NumParameters.ONE,
mode);
}
@Override
public void doHandle(final PerformContext performContext) {
final NakedObject onAdapter = performContext.getOnAdapter();
final NakedObjectMember nakedObjectMember = performContext
.getNakedObjectMember();
final Parse arg0Cell = performContext.getArg0Binding().getCurrentCell();
int requestedParamNum = -1;
try {
requestedParamNum = Integer.valueOf(arg0Cell.text());
} catch (final NumberFormatException ex) {
getOwner().throwException(arg0Cell, ex.getMessage());
}
final NakedObjectAction noa = (NakedObjectAction) nakedObjectMember;
final int parameterCount = noa.getParameterCount();
if (requestedParamNum < 0 || requestedParamNum > parameterCount - 1) {
getOwner().throwException(arg0Cell,
"(must be between 0 and " + (parameterCount - 1) + ")");
}
final NakedObject[] defaults = noa.getDefaults(onAdapter); |