### Question:
DirectedGraphImpl implements DirectedGraph { public State addState (String name) { if (mStates.containsKey (name)) { throw new ExecutionException ("state name '%s' not unique", name); } else { State state = new State (name, this); mStates.put (name, state); return state; } } DirectedGraphImpl(String name); void read(String path, String fileName); String getName(); State addState(String name); State getState(String name); State getStateByLabel(String label); State getRootState(); State getBeginState(); Transition addTransition(String sourceName, String targetName); Transition addTransition(State source, State target); Transition getTransition(String sourceName, String targetName); Transition getTransition(State source, State target); Set<Transition> getTransitions(String sourceName); Set<Transition> getTransitions(State source);  }### Answer:
@Test public void testAddState () { String STATE_NAME = "state name"; DirectedGraphImpl graph = new DirectedGraphImpl (GRAPH_NAME); State state = graph.addState (STATE_NAME); assertEquals (state, graph.getState (STATE_NAME)); }
@Test public void testAddStateTwice () { String STATE_NAME = "state name"; DirectedGraphImpl graph = new DirectedGraphImpl (GRAPH_NAME); graph.addState (STATE_NAME); try { graph.addState (STATE_NAME); fail ("no exception"); } catch (ExecutionException ee) { } }