0
String parserRes [] = {"right9"};
when(mockedParser.parse("whatever")).thenReturn(parserRes);
board = boardMaker.makeBoardFrom("whatever");

I'm using mockito an the argument of the method parse do not matter because whatever is passed in "right9" will always be the returning argument. The same thing applies to makeBoardFromsince it uses the parse method. How do I replace that "whatever" ?

Nikolas Charalambidis
  • 40,893
  • 16
  • 117
  • 183
Mattia
  • 179
  • 15
  • 1
    http://stackoverflow.com/questions/5969630/can-mockito-stub-a-method-without-regard-to-the-argument – Compass Apr 06 '16 at 14:34

1 Answers1

1
when(mockedParser.parse(Matchers.anyString())).thenReturn(parserRes);

should do the trick. See here for more info

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440