/** * Set the owning flow. * @throws IllegalArgumentException if this state cannot be added to the flow */ private void setFlow(Flow flow) throws IllegalArgumentException { Assert.hasText(getId(), "The id of the state should be set before adding the state to a flow"); Assert.notNull(flow, "The owning flow is required"); this.flow = flow; flow.add(this); }
/** * Set the owning flow. * @throws IllegalArgumentException if this state cannot be added to the flow */ private void setFlow(Flow flow) throws IllegalArgumentException { Assert.hasText(getId(), "The id of the state should be set before adding the state to a flow"); Assert.notNull(flow, "The owning flow is required"); this.flow = flow; flow.add(this); }
/** * Set the owning flow. * @throws IllegalArgumentException if this state cannot be added to the flow */ private void setFlow(Flow flow) throws IllegalArgumentException { Assert.hasText(getId(), "The id of the state should be set before adding the state to a flow"); Assert.notNull(flow, "The owning flow is required"); this.flow = flow; flow.add(this); }
/** * Set the owning flow. * @throws IllegalArgumentException if this state cannot be added to the flow */ private void setFlow(Flow flow) throws IllegalArgumentException { Assert.hasText(getId(), "The id of the state should be set before adding the state to a flow"); Assert.notNull(flow, "The owning flow is required"); this.flow = flow; flow.add(this); }
public void testAddStateAlreadyInOtherFlow() { Flow otherFlow = new Flow("myOtherFlow"); State state = new EndState(otherFlow, "myState1"); Flow flow = new Flow("myFlow"); try { flow.add(state); fail("Added state part of another flow"); } catch (IllegalArgumentException e) { // expected } }
public void testAddSameStateTwice() { Flow flow = new Flow("myFlow"); EndState state = new EndState(flow, "myState1"); try { flow.add(state); fail("Should have failed"); } catch (IllegalArgumentException e) { } assertEquals("State count wrong:", 1, flow.getStateCount()); }