Package net.sourceforge.stripes.mock

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


        // Test flashing an ActionBean
        MockRoundtrip trip3 = new MockRoundtrip(ctx, FlashScopeTests.class, (MockHttpSession) trip
                .getRequest().getSession());

        // Get the flash scope ID from the redirect URL and add it back as a parameter
        trip3.addParameter(StripesConstants.URL_KEY_FLASH_SCOPE_ID, id);
        trip3.execute("FlashBean");

        try {
            ActionBeanContext tmp = trip3.getActionBean(getClass()).getContext();
            HttpServletResponse response = tmp.getResponse();
View Full Code Here


     */
    @Test(groups="fast")
    public void testInheritedValidations() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(),
                                               InheritanceTests.class);
        trip.addParameter("two", "not25chars");
        trip.addParameter("three", "3");
        trip.addParameter("four", "onetwothree");
        trip.execute("/Validate.action");

        ValidationErrors errors = trip.getValidationErrors();
View Full Code Here

    @Test(groups="fast")
    public void testInheritedValidations() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(),
                                               InheritanceTests.class);
        trip.addParameter("two", "not25chars");
        trip.addParameter("three", "3");
        trip.addParameter("four", "onetwothree");
        trip.execute("/Validate.action");

        ValidationErrors errors = trip.getValidationErrors();
        Assert.assertNull(errors.get("one"), "Field one should not have errors.");
View Full Code Here

    public void testInheritedValidations() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(),
                                               InheritanceTests.class);
        trip.addParameter("two", "not25chars");
        trip.addParameter("three", "3");
        trip.addParameter("four", "onetwothree");
        trip.execute("/Validate.action");

        ValidationErrors errors = trip.getValidationErrors();
        Assert.assertNull(errors.get("one"), "Field one should not have errors.");
        Assert.assertEquals(errors.get("two").size(), 1, "Field two should not have 1 error.");
View Full Code Here

    }

    @Test
    public void bindInvalidDateKeysInMapBreaksMapInvariant() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("mapDateDate['notadate']", "01/01/2000");
        trip.execute();

        MapBindingTests bean = trip.getActionBean(MapBindingTests.class);
        Map<Date, Date> mapDateDate = bean.getMapDateDate();
        try {
View Full Code Here

    @Test(groups="fast")
    public void testSimpleTypeVariable() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.getRequest().addLocale(Locale.ENGLISH);
        trip.addParameter("number", "123.4");
        trip.execute();

        GenericsBindingTests2 bean = trip.getActionBean(GenericsBindingTests2.class);
        Assert.assertNotNull(bean.getNumber());
        Assert.assertEquals(bean.getNumber(), new Double(123.4));
View Full Code Here

    @Test(groups="fast")
    public void testGenericBean() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.getRequest().addLocale(Locale.ENGLISH);
        trip.addParameter("genericBean.genericA", "123.4");
        trip.addParameter("genericBean.genericB", "true");
        trip.execute();

        GenericsBindingTests2 bean = trip.getActionBean(GenericsBindingTests2.class);
        Assert.assertNotNull(bean.getGenericBean().getGenericA());
View Full Code Here

    @Test(groups="fast")
    public void testGenericBean() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.getRequest().addLocale(Locale.ENGLISH);
        trip.addParameter("genericBean.genericA", "123.4");
        trip.addParameter("genericBean.genericB", "true");
        trip.execute();

        GenericsBindingTests2 bean = trip.getActionBean(GenericsBindingTests2.class);
        Assert.assertNotNull(bean.getGenericBean().getGenericA());
        Assert.assertEquals(bean.getGenericBean().getGenericA(), new Double(123.4));
View Full Code Here

    }

    @Test(groups="fast")
    public void testTypeVariableLists() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("list[0]", "true");
        trip.addParameter("list[1]", "false");
        trip.addParameter("list[2]", "yes");
        trip.execute();

        GenericsBindingTests2 bean = trip.getActionBean(GenericsBindingTests2.class);
View Full Code Here

    @Test(groups="fast")
    public void testTypeVariableLists() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("list[0]", "true");
        trip.addParameter("list[1]", "false");
        trip.addParameter("list[2]", "yes");
        trip.execute();

        GenericsBindingTests2 bean = trip.getActionBean(GenericsBindingTests2.class);
        Assert.assertNotNull(bean.getList());
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.