Ejemplo n.º 1
0
 @Test
 public void shouldMeetTheBlockAndBuyArea() {
   setUp("y");
   HashMap props = new HashMap();
   props.put(2, "BLOCK");
   richGame.setProps(props);
   rollAction.executeRoll(3);
   assertThat(rollAction.getPlayer().getLocaion(), is(2));
   assertFalse(rollAction.getRichGame().getProps().containsValue(2));
   assertThat(player.getFunds(), is(9800));
   assertThat(rollAction.getRichGame().getGameMap().getGroundList().get(2).getOwners(), is("S"));
 }
Ejemplo n.º 2
0
  @Test
  public void shouldStopInASpace() {
    setUp("y");
    HashMap props = new HashMap();

    rollAction.executeRoll(4);
    assertThat(rollAction.getPlayer().getLocaion(), is(4));
    assertThat(rollAction.getPlayer().getFunds(), is(9800));
    assertThat(rollAction.getRichGame().getGameMap().getGroundList().get(4).getOwners(), is("S"));
    assertThat(rollAction.getPlayer().getLandedProperty()[0], is(1));
  }
Ejemplo n.º 3
0
  @Test
  public void shouldMeetNoPropWhenGotoAAreaisType2OfThePlayer() {
    UserInput userInput = Mockito.mock(UserInput.class);
    Mockito.when(userInput.readUserInput()).thenReturn("10000").thenReturn("2134").thenReturn("y");
    RichPreparation richPreparation = new RichPreparation(userInput);
    ;
    richPreparation.prepareRichGame();
    richGame = richPreparation.getRichGame();
    player = richGame.getPlayers().get(2);
    player.setLocaion(29);
    rollAction = new RollAction(player, richGame, userInput);
    richGame.getGameMap().getGroundList().get(31).setOwners("S");
    richGame.getGameMap().getGroundList().get(31).setGroundType(2);
    ;
    HashMap props = new HashMap();

    rollAction.executeRoll(2);
    assertThat(rollAction.getPlayer().getLocaion(), is(31));
    assertThat(rollAction.getPlayer().getFunds(), is(9500));
    assertThat(rollAction.getRichGame().getGameMap().getGroundList().get(31).getOwners(), is("S"));
    assertThat(
        rollAction.getRichGame().getGameMap().getGroundList().get(31).getGroundType(), is(3));
  }