Package org.springframework.webflow.test

Examples of org.springframework.webflow.test.MockRequestControlContext


  }

  public void testStateEnterWithEntryAction() {
    TestAction action = new TestAction();
    state.getEntryActionList().add(action);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    state.enter(context);
    assertEquals(state, context.getCurrentState());
    assertTrue(action.isExecuted());
    assertTrue(entered);
    assertEquals(1, action.getExecutionCount());
  }
View Full Code Here


        handled = true;
      }

    });
    FlowExecutionException e = new FlowExecutionException(flow.getId(), state.getId(), "Whatev");
    MockRequestControlContext context = new MockRequestControlContext(flow);
    assertTrue(state.handleException(e, context));
    assertTrue(handled);
  }
View Full Code Here

    assertTrue(handled);
  }

  public void testCouldNotHandleException() {
    FlowExecutionException e = new FlowExecutionException(flow.getId(), state.getId(), "Whatev");
    MockRequestControlContext context = new MockRequestControlContext(flow);
    assertFalse(state.handleException(e, context));
  }
View Full Code Here

    subflowState = new SubflowState(parentFlow, "subflow", new AbstractGetValueExpression() {
      public Object getValue(Object context) throws EvaluationException {
        return subflow;
      }
    });
    context = new MockRequestControlContext(parentFlow);
    context.setCurrentState(subflowState);
  }
View Full Code Here

  public void testIfDecision() {
    Flow flow = new Flow("flow");
    DecisionState state = new DecisionState(flow, "decisionState");
    state.getTransitionSet().add(new Transition(new MockTransitionCriteria("foo"), to("target")));
    new EndState(flow, "target");
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.setCurrentEvent(new Event(this, "foo"));
    state.enter(context);
    assertFalse(context.getFlowExecutionContext().isActive());
  }
View Full Code Here

    Flow flow = new Flow("flow");
    DecisionState state = new DecisionState(flow, "decisionState");
    state.getTransitionSet().add(new Transition(new MockTransitionCriteria("foo"), to("invalid")));
    state.getTransitionSet().add(new Transition(to("target")));
    new EndState(flow, "target");
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.setCurrentEvent(new Event(this, "bogus"));
    state.enter(context);
    assertFalse(context.getFlowExecutionContext().isActive());
  }
View Full Code Here

  public void testCannotDecide() {
    Flow flow = new Flow("flow");
    DecisionState state = new DecisionState(flow, "decisionState");
    state.getTransitionSet().add(new Transition(new MockTransitionCriteria("foo"), to("invalid")));
    state.getTransitionSet().add(new Transition(new MockTransitionCriteria("bar"), to("invalid")));
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.setCurrentEvent(new Event(this, "bogus"));
    try {
      state.enter(context);
      fail("Expected no matching");
    } catch (NoMatchingTransitionException e) {
View Full Code Here

    flow.getGlobalTransitionSet().add(t);
    assertSame(t, flow.getGlobalTransitionSet().toArray()[1]);
  }

  public void testStart() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    flow.start(context, new LocalAttributeMap<Object>());
    assertEquals("Wrong start state", "myState1", context.getCurrentState().getId());
  }
View Full Code Here

    flow.start(context, new LocalAttributeMap<Object>());
    assertEquals("Wrong start state", "myState1", context.getCurrentState().getId());
  }

  public void testStartWithoutStartState() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    try {
      Flow empty = new Flow("empty");
      empty.start(context, null);
      fail("should have failed");
    } catch (IllegalStateException e) {
View Full Code Here

    }
  }

  public void testStartWithAction() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    TestAction action = new TestAction();
    flow.getStartActionList().add(action);
    flow.start(context, new LocalAttributeMap<Object>());
    assertEquals("Wrong start state", "myState1", context.getCurrentState().getId());
    assertEquals(1, action.getExecutionCount());
  }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.test.MockRequestControlContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.