コード例 #1
0
  @Test
  public void execute_should_save_event() {
    warriorGameOverAction.execute();

    ArgumentCaptor<Event> captor = ArgumentCaptor.forClass(Event.class);
    verify(eventStore, times(1)).saveEvent(captor.capture());
    assertThat(captor.getValue().getEventType(), is(EventType.GAME_OVER));
  }
コード例 #2
0
  @Test
  public void execute_should_consume_event() {
    warriorGameOverAction.execute();

    assertThat(
        RandomWar.getInstance().currentWarrior.position.x, is(WarriorConstant.WARRIOR_INIT_X));
    assertThat(
        RandomWar.getInstance().currentWarrior.position.y, is(WarriorConstant.WARRIOR_INIT_Y));
    assertThat(
        RandomWar.getInstance().currentWarrior.health, is(WarriorConstant.WARRIOR_INIT_HEALTH));
    assertThat(
        RandomWar.getInstance().currentWarrior.score, is(WarriorConstant.WARRIOR_INIT_SCORE));
  }