Hi Freddy,

yes, I do use a custom subclass of ActionBeanContext. And I found out 
this was the problem.
I used two different implementations, one for production and one for 
unit testing as described in 
http://www.stripesframework.org/display/stripes/Unit+Testing.

The implementation of these two classed looks like:

public class MyActionBeanContext extends ActionBeanContext {

        public User getUser() {
            return (User) 
getRequest().getSession().getAttribute(KEY_CURRENT_USER);
        }

        public void setUser(User user) {
            getRequest().getSession().setAttribute(KEY_CURRENT_USER, user);
        }
}

public class MyTestActionBeanContext extends ActionBeanContext {

       User user;

        public User getUser() {
            return this.user;
        }

        public void setUser(User user) {
            this.user = user;
        }
}

I used the first one for production and the second one for testing. And 
as said in my last email all field of MyTestActionBeanContext were 
always null in subsequent ActionBeans in my tests.
Since I use only the first one in all cases it works fine. I think I 
mixed up the two concepts descripted in 
http://www.stripesframework.org/display/stripes/Unit+Testing. When using 
a mock, there's no need to use a special subclass of ActionBeanContext 
for testing any more.

Thanks for your help, Freddy and John.


Freddy D. wrote:
> Hi Karsten,
>
> - Bean2 relies on information set in ActionBeanContext by Bean1. Since the 
> - ActionBeanContext is empty the test fails.
> - Has anybody an idea what's going wrong?
>
> Are you using a custom subclass of ActionBeanContext? If so, can you
> paste the source? Either way, can you paste the code where Bean1 sets
> information on the ActionBeanContext? Maybe it's the way that information
> is set and stored that is causing the problem.
>
> Freddy
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>   


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to