Package net.sourceforge.stripes.mock

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


    }

    @Test(groups="fast")
    public void testNonDefaultResolution() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.execute("two");

        BasicResolverTests bean = trip.getActionBean( getClass() );
        Assert.assertEquals(bean.getNumber(), 2);
    }
View Full Code Here


    }

    @Test(groups="fast")
    public void testImageStyleResolution() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.execute("two.x");

        BasicResolverTests bean = trip.getActionBean( getClass() );
        Assert.assertEquals(bean.getNumber(), 2);
    }
View Full Code Here

    @Test(groups="fast")
    public void testImageStyleResolution2() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.addParameter("two.x", "381");
        trip.execute();

        BasicResolverTests bean = trip.getActionBean( getClass() );
        Assert.assertEquals(bean.getNumber(), 2);
    }
View Full Code Here

    @Test(groups="fast")
    public void testEventNameParameterResolution() throws Exception {
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
        trip.addParameter(StripesConstants.URL_KEY_EVENT_NAME, "two");
        trip.execute();

        BasicResolverTests bean = trip.getActionBean( getClass() );
        Assert.assertEquals(bean.getNumber(), 2);
        Assert.assertEquals(bean.getContext().getEventName(), "two");
    }
View Full Code Here

        Class<? extends NoAnnotation> beanType = bean.getClass();
        MockRoundtrip trip = new MockRoundtrip(StripesTestFixture.getServletContext(), beanType);
        for (String p : properties)
            trip.addParameter(p, p + "Value");
        trip.execute();

        bean = trip.getActionBean(beanType);
        for (int i = 0; i < properties.length; i++) {
            String fullName = beanType.getSimpleName() + "." + properties[i];
            log.debug("Testing binding security on ", fullName);
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();

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

    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();

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

    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();

        GenericsBindingTests bean = trip.getActionBean(GenericsBindingTests.class);
        Assert.assertNotNull(bean.getList());
        Assert.assertEquals(bean.getList().get(0), Boolean.TRUE);
        Assert.assertEquals(bean.getList().get(1), Boolean.FALSE);
View Full Code Here

    public void testTypeVariableMaps() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("map[10]", "1/1/2010");
        trip.addParameter("map[20]", "1/1/2020");
        trip.addParameter("map[30]", "1/1/2030");
        trip.execute();

        GenericsBindingTests bean = trip.getActionBean(GenericsBindingTests.class);
        Assert.assertNotNull(bean.getMap());
        Assert.assertEquals(bean.getMap().get(10l), makeDate(2010,1,1));
        Assert.assertEquals(bean.getMap().get(20l), makeDate(2020,1,1));
View Full Code Here

    @Test(groups="fast")
    public void testTypeVariableNestedProperties() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("bean.longProperty", "1234");
        trip.addParameter("bean.stringProperty", "foobar");
        trip.execute();

        GenericsBindingTests bean = trip.getActionBean(GenericsBindingTests.class);
        Assert.assertNotNull(bean.getBean());
        Assert.assertEquals(bean.getBean().getLongProperty(), new Long(1234));
        Assert.assertEquals(bean.getBean().getStringProperty(), "foobar");
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.