package state;

import state.ts2.TurnstileUserImpl;
import state.ts2.TurnstileUserInterface;

public class MyTestTs {

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception {
    TurnstileUserInterface ts = new TurnstileUserImpl();
    assertEquals(ts.isLocked(), true);
    ts.coin();
    assertEquals(ts.isLocked(), false);
    ts.coin();
    assertEquals(ts.isLocked(), false);
    ts.pass();
    assertEquals(ts.isLocked(), true);
    ts.pass();
    assertEquals(ts.isLocked(), true);
    ts.coin();
    assertEquals(ts.isLocked(), true);
    ts.coin();
    assertEquals(ts.isLocked(), false);
  }

  private static void assertEquals(boolean locked, boolean b) throws Exception {
    if (locked != b) {
      throw new Exception("Error");
    }
  }

}
