### Question:
StateMachine { public String execute(String input) { String startState = entryState; for(int i = 0; i < input.length();i++){ char event = input.charAt(i) ; if(_symbols.indexOf(event) < 0) { return null; } String key = startState + "_" + event; if (endStates.containsKey(key)) { startState = endStates.get(key); } } if (states.containsKey(startState)) { return states.get(startState); } return null; } StateMachine(String symbols, String statesIn, String transitions); String execute(String input); static void main(String[] args);  }### Answer:
@Test public void test1 () { StateMachine fsm = new StateMachine("0,1", "EVEN:pass,ODD:fail,BAD:fail", "EVEN:ODD:1,ODD:EVEN:1,ODD:BAD:0"); assertEquals("pass", fsm.execute("00110")); assertEquals("fail", fsm.execute("00111")); assertEquals("fail", fsm.execute("001110000110011")); assertEquals("fail", null,fsm.execute("0011100001130011")); }