Package net.sourceforge.stripes.mock

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


    @Test(groups="fast")
    public void bindPropertyWithoutGetterMethod() throws Exception {
        // Should be able to set it just fine
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("setOnlyString", "whee");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        Assert.assertTrue(bean.setOnlyStringIsNotNull());
    }
View Full Code Here


    @Test(groups="fast")
    public void bindPublicPropertyWithoutMethods() throws Exception {
        // Should be able to set it just fine
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("publicLong", "12345");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        Assert.assertEquals(new Long(12345), bean.publicLong);
    }
View Full Code Here

    @Test(groups="fast")
    public void attemptToBindIntoActionBeanContext() throws Exception {
        // Should be able to set it just fine
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("context.eventName", "woohaa!");
        trip.addParameter(" context.eventName", "woohaa!");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        ActionBeanContext context = bean.getContext();
View Full Code Here

    @Test(groups="fast")
    public void attemptToBindIntoActionBeanContext() throws Exception {
        // Should be able to set it just fine
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("context.eventName", "woohaa!");
        trip.addParameter(" context.eventName", "woohaa!");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        ActionBeanContext context = bean.getContext();
        Assert.assertFalse("woohaa!".equals(context.getEventName()));
View Full Code Here

    @Test(groups="fast")
    public void attemptToBindIntoActionBeanContextII() throws Exception {
        // Should be able to set it just fine
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("Context.eventName", "woohaa!");
        trip.addParameter(" Context.eventName", "woohaa!");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        ActionBeanContext context = bean.getContext();
View Full Code Here

    @Test(groups="fast")
    public void attemptToBindIntoActionBeanContextII() throws Exception {
        // Should be able to set it just fine
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("Context.eventName", "woohaa!");
        trip.addParameter(" Context.eventName", "woohaa!");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        ActionBeanContext context = bean.getContext();
        Assert.assertFalse("woohaa!".equals(context.getEventName()));
View Full Code Here

    @Test(groups="fast")
    public void bindArrayOfEnums() throws Exception {
        // Should be able to set it just fine
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("colors", "Red", "Green", "Blue");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        TestActionBean.Color[] colors = bean.getColors();
        Assert.assertNotNull(colors);
View Full Code Here

    }

    @Test(groups="fast")
    public void testBindingToSubclassOfDeclaredType() throws Exception {
        MockRoundtrip trip = getRoundtrip();
        trip.addParameter("item.id", "1000000");
        trip.execute();

        TestActionBean bean = trip.getActionBean(TestActionBean.class);
        TestActionBean.PropertyLess item = bean.getItem();
        Assert.assertEquals(item.getClass(), TestActionBean.Item.class);
View Full Code Here

        Locale locale = trip.getRequest().getLocale();
        TypeConverterFactory factory = StripesFilter.getConfiguration().getTypeConverterFactory();
        TypeConverter<?> tc = factory.getTypeConverter(Integer.class, locale);
        try {
            factory.add(Integer.class, MyIntegerTypeConverter.class);
            trip.addParameter("shouldBeDoubled", "42");
            trip.addParameter("shouldNotBeDoubled", "42");
            trip.execute("validateTypeConverters");
            ValidationAnnotationsTest actionBean = trip.getActionBean(getClass());
            Assert.assertEquals(actionBean.shouldBeDoubled, new Integer(84));
            Assert.assertEquals(actionBean.shouldNotBeDoubled, new Integer(42));
View Full Code Here

        TypeConverterFactory factory = StripesFilter.getConfiguration().getTypeConverterFactory();
        TypeConverter<?> tc = factory.getTypeConverter(Integer.class, locale);
        try {
            factory.add(Integer.class, MyIntegerTypeConverter.class);
            trip.addParameter("shouldBeDoubled", "42");
            trip.addParameter("shouldNotBeDoubled", "42");
            trip.execute("validateTypeConverters");
            ValidationAnnotationsTest actionBean = trip.getActionBean(getClass());
            Assert.assertEquals(actionBean.shouldBeDoubled, new Integer(84));
            Assert.assertEquals(actionBean.shouldNotBeDoubled, new Integer(42));
        }
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.