Beispiel #1
0
 private void givenDice(int... values) {
   dice = mock(Dice.class);
   OngoingStubbing<Integer> when = when(dice.next(anyInt()));
   for (int value : values) {
     when = when.thenReturn(value);
   }
 }
Beispiel #2
0
  private void diceNew(int... ints) {
    OngoingStubbing<Integer> when = when(dice.next(anyInt()));

    if (ints.length == 0) { // we work just with nothing
      when = when.thenReturn(-1);
    }

    if (ints.length == 1) { // we work just with stones
      when = when.thenReturn(-1, -1, -1, -1, ints[0], -1);
    }

    if (ints.length == 2) { // we work with stones and bombs
      when = when.thenReturn(-1, -1, -1, -1, ints[0], ints[1], -1);
    }

    if (ints.length == 4) { // we work stones, bombs and bulletPacks
      when = when.thenReturn(ints[2], ints[3], ints[0], ints[1], -1);
    }
  }
Beispiel #3
0
 private void dice(Direction direction) {
   when(dice.next(anyInt())).thenReturn(direction.value());
 }
Beispiel #4
0
 private void dice(int... ints) {
   OngoingStubbing<Integer> when = when(dice.next(anyInt()));
   for (int i : ints) {
     when = when.thenReturn(i);
   }
 }