Examples of MockRequestContext


Examples of org.springframework.webflow.test.MockRequestContext

    assertEquals(1, result.getAttributes().size());
  }

  public void testDoExecuteWithError() throws Exception {
    tested.setStopOnError(true);
    MockRequestContext mockRequestContext = new MockRequestContext();
    EasyMock.expect(actionMock.execute(mockRequestContext)).andReturn(new Event(this, "error"));
    EasyMock.replay(new Object[] { actionMock });
    Event result = tested.doExecute(mockRequestContext);
    EasyMock.verify(new Object[] { actionMock });
    assertEquals("error", result.getId());
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    assertEquals("error", result.getId());
  }

  public void testDoExecuteWithNullResult() throws Exception {
    tested.setStopOnError(true);
    MockRequestContext mockRequestContext = new MockRequestContext();
    EasyMock.expect(actionMock.execute(mockRequestContext)).andReturn(null);
    EasyMock.replay(new Object[] { actionMock });
    Event result = tested.doExecute(mockRequestContext);
    EasyMock.verify(new Object[] { actionMock });
    assertEquals("Expecting success since no check is performed if null result,", "success", result.getId());
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    }, new Action() {
      public Event execute(RequestContext context) throws Exception {
        return new Event(this, "bar");
      }
    } });
    assertEquals("Result of last executed action should be returned", "bar", ca.execute(new MockRequestContext())
        .getId());
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

public class RenderActionTests extends TestCase {
  public void testRenderAction() throws Exception {
    StaticExpression name = new StaticExpression("frag1");
    StaticExpression name2 = new StaticExpression("frag2");
    RenderAction action = new RenderAction(new Expression[] { name, name2 });
    MockRequestContext context = new MockRequestContext();
    Event result = action.execute(context);
    assertEquals("success", result.getId());
    String[] fragments = (String[]) context.getFlashScope().getArray(View.RENDER_FRAGMENTS_ATTRIBUTE,
        String[].class);
    assertEquals("frag1", fragments[0]);
    assertEquals("frag2", fragments[1]);
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    action = new TestAbstractAction() {
      protected Event doExecute(RequestContext context) throws Exception {
        return success();
      }
    };
    Event result = action.execute(new MockRequestContext());
    assertEquals("success", result.getId());
    assertTrue(result.getAttributes().size() == 0);
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    assertTrue(result.getAttributes().size() == 0);
  }

  public void testExceptionalExecute() throws Exception {
    try {
      action.execute(new MockRequestContext());
      fail("Should've failed execute");
    } catch (IllegalStateException e) {

    }
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    action = new TestAbstractAction() {
      protected Event doPreExecute(RequestContext context) throws Exception {
        return success();
      }
    };
    Event result = action.execute(new MockRequestContext());
    assertEquals("success", result.getId());
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

public class ResultObjectBasedEventFactoryTests extends TestCase {

  private ResultObjectBasedEventFactory factory = new ResultObjectBasedEventFactory();

  public void testNull() {
    Event event = factory.createResultEvent(this, null, new MockRequestContext());
    assertEquals(factory.getNullEventId(), event.getId());
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    Event event = factory.createResultEvent(this, null, new MockRequestContext());
    assertEquals(factory.getNullEventId(), event.getId());
  }

  public void testBoolean() {
    Event event = factory.createResultEvent(this, Boolean.TRUE, new MockRequestContext());
    assertEquals(factory.getYesEventId(), event.getId());
    event = factory.createResultEvent(this, Boolean.FALSE, new MockRequestContext());
    assertEquals(factory.getNoEventId(), event.getId());
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    event = factory.createResultEvent(this, Boolean.FALSE, new MockRequestContext());
    assertEquals(factory.getNoEventId(), event.getId());
  }

  public void testLabeledEnum() {
    Event event = factory.createResultEvent(this, MyLabeledEnum.A, new MockRequestContext());
    assertEquals("A", event.getId());
    assertSame(MyLabeledEnum.A, event.getAttributes().get("result"));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.