See below...

> -----Original Message-----
> From: Samuel Mota [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, October 02, 2003 11:16 AM
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] Testing actions
> 
> 
> Hi,
> 
> I'm building a test case with JUnit, I'm trying to use the 
> hole WW/XW engine ...
> 
> while trying to put an object into the session map I'm 
> getting a NPE ... At my action the code: 
> ActionContext.getContext().put(
>                         ActionContext.SESSION,
>                         ActionContext.getContext().>                               
> getSession().put(Static.USER_SESSION_KEY, user) );

Try getting the Session first, then setting something into it... Why are you trying to 
set something into the ActionContext to replace the Session?

ActionContext context = ActionContext.getContext();
Map session = context.getSession();
session.put(Static.USER_SESSION_KEY, user);

> 
> The setUp method from the test case:
>       protected void setUp() throws Exception {
>             super.setUp();
>             Static.setEnvironment();
>             XmlConfigurationProvider configurationProvider = 
> new XmlConfigurationProvider( "xwork.xml");
>             ConfigurationManager.clearConfigurationProviders();
>             
> ConfigurationManager.addConfigurationProvider(configurationProvider);
>             ConfigurationManager.getConfiguration().reload();
>             proxy = 
> ActionProxyFactory.getFactory().createActionProxy("","login",null);
>             userLogin = (UserLogin) proxy.getAction();
>       }
> 
> One test method:
>       public void testInvalidLogin() throws Exception {
>             proxy.setExecuteResult(false);
>             userLogin.setCelulaTecnica(new Integer(1));
>             userLogin.setPassword("0");
>             assertEquals(Action.ERROR,proxy.execute());
>             assertTrue(userLogin.hasErrors());
>       }
> 
> How can I achive this?
> 
> thanks
> 
> + Samuel G. Mota
> + [EMAIL PROTECTED]
> + 55 (11) 4417 7093
> + Business Application Dpt.
> + Netset Servi�os em Tecnologia
> + a Hypercom Company
> + http://www.hypercom.com
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf 
> _______________________________________________
> Opensymphony-webwork mailing list 
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to