@Test public void testCreate () { TestRunResultPublisher publisher = new TestRunResultPublisherImpl (); DoneConditionFactory factory = new DoneConditionFactory (); assertTrue (factory.create ("never", publisher) instanceof NeverDone); assertTrue (factory.create ("end state", publisher) instanceof DoneWhenInEndState); assertTrue (factory.create ("all states", publisher) instanceof DoneWhenAllStatesSeen); assertTrue (factory.create ("all transitions", publisher) instanceof DoneWhenAllTransitionsSeen); try { factory.create ("unknown condition", publisher); fail ("no exception"); } catch (ExecutionException ee) { } }
DoneCondition create (String conditionName, TestRunResultPublisher publisher) { DoneCondition condition; if ("never".equals (conditionName)) { condition = new NeverDone (); } else if ("all transitions".equals (conditionName)) { condition = new DoneWhenAllTransitionsSeen (); } else if ("all states".equals (conditionName)) { condition = new DoneWhenAllStatesSeen (); } else if ("end state".equals (conditionName)) { condition = new DoneWhenInEndState (); } else { throw new ExecutionException ("unknown condition: %s", conditionName); } publisher.subscribeToModel (condition); return condition; }
DoneConditionFactory { DoneCondition create (String conditionName, TestRunResultPublisher publisher) { DoneCondition condition; if ("never".equals (conditionName)) { condition = new NeverDone (); } else if ("all transitions".equals (conditionName)) { condition = new DoneWhenAllTransitionsSeen (); } else if ("all states".equals (conditionName)) { condition = new DoneWhenAllStatesSeen (); } else if ("end state".equals (conditionName)) { condition = new DoneWhenInEndState (); } else { throw new ExecutionException ("unknown condition: %s", conditionName); } publisher.subscribeToModel (condition); return condition; } }
DoneConditionFactory { DoneCondition create (String conditionName, TestRunResultPublisher publisher) { DoneCondition condition; if ("never".equals (conditionName)) { condition = new NeverDone (); } else if ("all transitions".equals (conditionName)) { condition = new DoneWhenAllTransitionsSeen (); } else if ("all states".equals (conditionName)) { condition = new DoneWhenAllStatesSeen (); } else if ("end state".equals (conditionName)) { condition = new DoneWhenInEndState (); } else { throw new ExecutionException ("unknown condition: %s", conditionName); } publisher.subscribeToModel (condition); return condition; }  }
DoneConditionFactory { DoneCondition create (String conditionName, TestRunResultPublisher publisher) { DoneCondition condition; if ("never".equals (conditionName)) { condition = new NeverDone (); } else if ("all transitions".equals (conditionName)) { condition = new DoneWhenAllTransitionsSeen (); } else if ("all states".equals (conditionName)) { condition = new DoneWhenAllStatesSeen (); } else if ("end state".equals (conditionName)) { condition = new DoneWhenInEndState (); } else { throw new ExecutionException ("unknown condition: %s", conditionName); } publisher.subscribeToModel (condition); return condition; }   }
DoneConditionFactory { DoneCondition create (String conditionName, TestRunResultPublisher publisher) { DoneCondition condition; if ("never".equals (conditionName)) { condition = new NeverDone (); } else if ("all transitions".equals (conditionName)) { condition = new DoneWhenAllTransitionsSeen (); } else if ("all states".equals (conditionName)) { condition = new DoneWhenAllStatesSeen (); } else if ("end state".equals (conditionName)) { condition = new DoneWhenInEndState (); } else { throw new ExecutionException ("unknown condition: %s", conditionName); } publisher.subscribeToModel (condition); return condition; }    }