2

Right now I am running the java version of FitNesse 20130530. I would like to have a method in my fixture that have variable arguments, like:

public class VarArgTester {
    public void testVarargs(Object... newData) {
    [...]
    }
}

and to call it like

!define TEST_SYSTEM {slim}

!|import|
|VarArgTester|

!|script|VarArgTester|
|test varargs;|9999|fitnesse|01-Jan-1970|

Right now I get following error message:

Method testVarargs[3] not found in package.name.VarArgTester.

So, it seems like this functionality is not implemented. But if so, how do I use it?

D. Josefsson
  • 1,052
  • 7
  • 21

1 Answers1

1

Slim doesn't support variable arguments. The best you can do is write wrapper methods with fixed arguments.

public void testOneArg(Object arg1) { testArgs(arg1); }
public void testTwoArgs(Object arg1, Object arg2) { testArgs(arg1, arg2); }
Mike Stockdale
  • 5,256
  • 3
  • 29
  • 33
  • I had a look in the source yesterday and I can second that. I thought that adding `method.isVarArgs()` in `findMathcingMethod` to could do the trick but since FitNesse is converting the arguments and thereby calls `method.getParameterTypes()` it was not possible. A solution might be to create a custom Converter that handles Object[] and then take care of the proper conversion in my fixture. – D. Josefsson Feb 13 '14 at 07:42