FSM implements Runnable, Serializable { public void setStart(String name) { if (this.start != null && state != null) { throw new IllegalStateException("Start state can be changed now"); } this.start = states.get(name); this.state = start; } FSM(ScheduledExecutorService scheduler); void setLogger(Logger logger); State getState(); void setStart(String name); void setEnd(String name); State createState(String name); void setAttribute(String name, Object value); Object getAttribute(String name); void removeAttribute(String name); Transition createTransition(String name, String from, String to); Transition createTimeoutTransition(String from, String to, long timeout); synchronized void signal(String name); void signalAsync(String name); void run();  }
@Test public void testSetStart() { fsm.createState("start"); fsm.createState("state1"); fsm.createState("end"); fsm.setStart("start"); fsm.setEnd("end"); assertEquals("start", fsm.getState().getName()); }