Sometimes a method has multiple parameters for which the user wants to specify the same argument value. At the moment, one need to specify an Argument value for each parameter:
@Test
@Arguments({Argument.DEFAULT, Argument.DEFAULT})
public void twoArgsRandomOnce(char x, byte y) {
// do something
}
This could be simplified such that the user only need to specify one argument which is applied to each parameter:
@Test
@Arguments(Argument.DEFAULT)
public void twoArgsRandomOnce(char x, byte y) {
// do something
}
A common use-case would be for methods that need to have random values (Argument.RANDOM_ONCE, Argument.RANDOM_EACH).
There are multiple ways to do that:
- @Arguments could either be processed differently to automatically apply a single Argument value to all remaining parameters. However, if the user specified only one Argument value by mistake, he will not be warned by the silent application.
- Adding a new annotation to achieve this, for example, @ArgumentsAll (I would refrain from adding an additional attribute to @Arguments as we are then no longer able to feed it a list without specifying the single default attribute).