Ejemplo n.º 1
0
  @Test
  public void load_and_set_active_state_as_a_inner_state() {
    StateMachine atm = new ATMStateMachine();
    atm.activeStateConfiguration(Arrays.asList(SERVING_CUSTOMER, AUTHENTICATION));

    atm.execute(new Authenticated());

    assertThat(atm.getActiveStateConfiguration())
        .containsSequence(SERVING_CUSTOMER, SELECTING_TRANSACTION);
  }
Ejemplo n.º 2
0
  @Test
  public void from_idle_to_authentication() {
    StateMachine atm = new ATMStateMachine();
    atm.activeStateConfiguration(asList(IDLE));

    atm.execute(new CardInserted());

    assertThat(atm.getActiveStateConfiguration())
        .containsSequence(SERVING_CUSTOMER, AUTHENTICATION);
  }