Package org.springframework.webflow

Examples of org.springframework.webflow.TestException


  protected void setUp() {
    flow = new Flow("myFlow");
    state = new TransitionableState(flow, "state1") {
      protected void doEnter(RequestControlContext context) {
        throw new FlowExecutionException(getFlow().getId(), getId(), "Oops!", new TestException());
      }
    };
    state.getTransitionSet().add(new Transition(toState("end")));
  }
View Full Code Here


  public void testTransitionExecutorHandlesExceptionExactMatch() {
    TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
    handler.add(TestException.class, "state");
    FlowExecutionException e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops",
        new TestException());
    assertTrue("Doesn't handle state exception", handler.canHandle(e));

    e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops", new Exception());
    assertFalse("Shouldn't handle exception", handler.canHandle(e));
  }
View Full Code Here

  public void testTransitionExecutorHandlesExceptionSuperclassMatch() {
    TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
    handler.add(Exception.class, "state");
    FlowExecutionException e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops",
        new TestException());
    assertTrue("Doesn't handle state exception", handler.canHandle(e));
    e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops", new RuntimeException());
    assertTrue("Doesn't handle state exception", handler.canHandle(e));
  }
View Full Code Here

    flow.getExceptionHandlerSet().add(
        new TransitionExecutingFlowExecutionExceptionHandler().add(TestException.class, "myState2"));
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.setCurrentState(flow.getStateInstance("myState1"));
    FlowExecutionException e = new FlowExecutionException(flow.getId(), flow.getStartState().getId(), "Oops!",
        new TestException());
    flow.handleException(e, context);
    assertFalse(context.getFlowExecutionContext().isActive());
  }
View Full Code Here

  }

  public void testHandleExceptionNoMatch() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    FlowExecutionException e = new FlowExecutionException(flow.getId(), flow.getStartState().getId(), "Oops!",
        new TestException());
    try {
      flow.handleException(e, context);
    } catch (FlowExecutionException ex) {
      // expected
    }
View Full Code Here

  protected void setUp() {
    flow = new Flow("myFlow");
    state = new TransitionableState(flow, "state1") {
      protected void doEnter(RequestControlContext context) {
        throw new FlowExecutionException(getFlow().getId(), getId(), "Oops!", new TestException());
      }
    };
    state.getTransitionSet().add(new Transition(toState("end")));
  }
View Full Code Here

  public void testTransitionExecutorHandlesExceptionExactMatch() {
    TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
    handler.add(TestException.class, "state");
    FlowExecutionException e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops",
        new TestException());
    assertTrue("Doesn't handle state exception", handler.canHandle(e));

    e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops", new Exception());
    assertFalse("Shouldn't handle exception", handler.canHandle(e));
  }
View Full Code Here

  public void testTransitionExecutorHandlesExceptionSuperclassMatch() {
    TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
    handler.add(Exception.class, "state");
    FlowExecutionException e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops",
        new TestException());
    assertTrue("Doesn't handle state exception", handler.canHandle(e));
    e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops", new RuntimeException());
    assertTrue("Doesn't handle state exception", handler.canHandle(e));
  }
View Full Code Here

    flow.getExceptionHandlerSet().add(
        new TransitionExecutingFlowExecutionExceptionHandler().add(TestException.class, "myState2"));
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.setCurrentState(flow.getStateInstance("myState1"));
    FlowExecutionException e = new FlowExecutionException(flow.getId(), flow.getStartState().getId(), "Oops!",
        new TestException());
    flow.handleException(e, context);
    assertFalse(context.getFlowExecutionContext().isActive());
  }
View Full Code Here

  }

  public void testHandleExceptionNoMatch() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    FlowExecutionException e = new FlowExecutionException(flow.getId(), flow.getStartState().getId(), "Oops!",
        new TestException());
    try {
      flow.handleException(e, context);
    } catch (FlowExecutionException ex) {
      // expected
    }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.TestException

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.