コード例 #1
0
 public void setUp(String s) {
   UserInput userInput = Mockito.mock(UserInput.class);
   Mockito.when(userInput.readUserInput()).thenReturn("10000").thenReturn("2134").thenReturn(s);
   RichPreparation richPreparation = new RichPreparation(userInput);
   ;
   richPreparation.prepareRichGame();
   richGame = richPreparation.getRichGame();
   player = richGame.getPlayers().get(2);
   rollAction = new RollAction(player, richGame, userInput);
   richGame.getGameMap().getGroundList().get(13).setOwners("S");
   richGame.getGameMap().getGroundList().get(13).setGroundType(2);
 }
コード例 #2
0
  @Test
  public void shouldMeetNoPropWhenGotoAreaisAnotherPlayer() {
    UserInput userInput = Mockito.mock(UserInput.class);
    Mockito.when(userInput.readUserInput()).thenReturn("10000").thenReturn("2134");
    RichPreparation richPreparation = new RichPreparation(userInput);
    ;
    richPreparation.prepareRichGame();
    richGame = richPreparation.getRichGame();
    player = richGame.getPlayers().get(2);
    player.setLocaion(41);
    rollAction = new RollAction(player, richGame, userInput);
    richGame.getGameMap().getGroundList().get(44).setOwners("J");
    richGame.getGameMap().getGroundList().get(44).setGroundType(1);
    ;
    HashMap props = new HashMap();

    rollAction.executeRoll(3);
    assertThat(rollAction.getPlayer().getLocaion(), is(44));
    assertThat(rollAction.getPlayer().getFunds(), is(9700));
  }