Package net.sourceforge.stripes.mock

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


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

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

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

        GenericsBindingTests2 bean = trip.getActionBean(GenericsBindingTests2.class);
        Assert.assertNotNull(bean.getBean());
        Assert.assertEquals(bean.getBean().getLongProperty(), new Long(1234));
        Assert.assertEquals(bean.getBean().getStringProperty(), "foobar");
View Full Code Here

    // Start of Test Methods

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

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

    @Test(groups="fast")
    public void basicBinding() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("singleString", "testValue");
        trip.addParameter("singleLong", "12345");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        Assert.assertEquals(bean.getSingleString(), "testValue");
        Assert.assertEquals(bean.getSingleLong(), new Long(12345L));
    }
View Full Code Here

    @Test(groups="fast")
    public void bindSetsOfStrings() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("setOfStrings", "testValue", "testValue", "testValue2", "testValue3");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        Assert.assertTrue(bean.getSetOfStrings().contains("testValue"));
        Assert.assertTrue(bean.getSetOfStrings().contains("testValue2"));
        Assert.assertTrue(bean.getSetOfStrings().contains("testValue3"));
View Full Code Here

    @Test(groups="fast")
    public void bindListOfLongs() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("listOfLongs", "1", "2", "3", "456");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        Assert.assertTrue(bean.getListOfLongs().contains(1L));
        Assert.assertTrue(bean.getListOfLongs().contains(2L));
        Assert.assertTrue(bean.getListOfLongs().contains(3L));
View Full Code Here

    @Test(groups="fast")
    public void bindNonGenericListOfLongs() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("nakedListOfLongs", "10", "20", "30", "4567");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        Assert.assertTrue(bean.getNakedListOfLongs().contains(10L));
        Assert.assertTrue(bean.getNakedListOfLongs().contains(20L));
        Assert.assertTrue(bean.getNakedListOfLongs().contains(30L));
View Full Code Here

        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("testBean.intProperty", "10");
        trip.addParameter("testBean.longProperty", "20");
        trip.addParameter("testBean.booleanProperty", "true");
        trip.addParameter("testBean.enumProperty", "Third");
        trip.execute();

        TestBean bean = trip.getActionBean(TestActionBean.class).getTestBean();
        Assert.assertNotNull(bean);
        Assert.assertEquals(bean.getIntProperty()10);
        Assert.assertEquals(bean.getLongProperty(), new Long(20));
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.