Package net.sourceforge.stripes.mock

Examples of net.sourceforge.stripes.mock.MockRoundtrip.execute()


    @Test(groups="fast")
    public void testListOfDate() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.getRequest().addLocale(Locale.ENGLISH);
        trip.addParameter("dates", "12/31/2005, 1/1/2006, 6/15/2008, 7/7/2007");
        trip.execute();
        OneToManyTypeConverterTest bean = trip.getActionBean(getClass());
        List<Date> dates = bean.getDates();

        DateFormat format = new SimpleDateFormat("MM/dd/yyyy");
        Assert.assertEquals(dates, Literal.list(format.parse("12/31/2005"),
View Full Code Here


    @Test(groups="fast")
    public void testWithErrors() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.addParameter("numbers", "123 456 abc 789 def");
        trip.execute();

        OneToManyTypeConverterTest bean = trip.getActionBean(getClass());
        List<Long> numbers = bean.getNumbers();

        Assert.assertNull(numbers);
View Full Code Here

     */
    @Test(groups="fast")
    public void testEventZeroNoErrors() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.addParameter("numberZero", "99");
        trip.execute("eventZero");

        ValidationFlowTest test = trip.getActionBean(getClass());
        Assert.assertEquals(1, test.validateAlwaysRan);
        Assert.assertEquals(0, test.validateOneRan);
        Assert.assertEquals(0, test.validateTwoRan);
View Full Code Here

    @Test(groups="fast")
    public void testEventZeroWithErrors() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.addParameter("numberZero", "99");
        trip.addParameter("numberOne", "-100");
        trip.execute("eventZero");

        ValidationFlowTest test = trip.getActionBean(getClass());
        Assert.assertEquals(0, test.validateAlwaysRan);
        Assert.assertEquals(0, test.validateOneRan);
        Assert.assertEquals(0, test.validateTwoRan);
View Full Code Here

    public void testEventOneNoErrors() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.addParameter("numberZero", "100");
        trip.addParameter("numberOne", "101");

        trip.execute("eventOne");

        ValidationFlowTest test = trip.getActionBean(getClass());
        Assert.assertEquals(1, test.validateAlwaysRan);
        Assert.assertEquals(2, test.validateOneRan);
        Assert.assertEquals(0, test.validateTwoRan);
View Full Code Here

    @Test(groups="fast")
    public void testEventOneWithErrors() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.addParameter("numberZero", "100");
        trip.addParameter("numberOne", "")// required field for event one
        trip.execute("eventOne");

        ValidationFlowTest test = trip.getActionBean(getClass());
        Assert.assertEquals(0, test.validateAlwaysRan);
        Assert.assertEquals(0, test.validateOneRan);
        Assert.assertEquals(0, test.validateTwoRan);
View Full Code Here

    @Test(groups="fast")
    public void testEventOneAsDefault() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.addParameter("numberZero", "100");
        trip.addParameter("numberOne", "101");
        trip.execute();

        ValidationFlowTest test = trip.getActionBean(getClass());
        Assert.assertEquals(1, test.validateAlwaysRan);
        Assert.assertEquals(2, test.validateOneRan);
        Assert.assertEquals(0, test.validateTwoRan);
View Full Code Here

    public void testEventTwoNoErrors() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.addParameter("numberZero", "100");
        trip.addParameter("numberTwo""102");

        trip.execute("eventTwo");

        ValidationFlowTest test = trip.getActionBean(getClass());
        Assert.assertEquals(1, test.validateAlwaysRan);
        Assert.assertEquals(0, test.validateOneRan);
        Assert.assertEquals(2, test.validateTwoRan);
View Full Code Here

    @Test(groups="fast")
    public void testEventTwoWithErrors() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.addParameter("numberZero", ""); // required field always
        trip.addParameter("numberTwo", "")// required field for event one
        trip.execute("eventTwo");

        ValidationFlowTest test = trip.getActionBean(getClass());
        Assert.assertEquals(0, test.validateAlwaysRan);
        Assert.assertEquals(0, test.validateOneRan);
        Assert.assertEquals(1, test.validateTwoRan);
View Full Code Here

    public void bindSingleQuotedStringKey() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("mapStringLong['one']", "1");
        trip.addParameter("mapStringLong['two']", "2");
        trip.addParameter("mapStringLong['three']", "3");
        trip.execute();

        MapBindingTests bean = trip.getActionBean(MapBindingTests.class);
        Assert.assertEquals(bean.getMapStringLong().get("one"), new Long(1));
        Assert.assertEquals(bean.getMapStringLong().get("two"), new Long(2));
        Assert.assertEquals(bean.getMapStringLong().get("three"), new Long(3));
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.