zhouxingxing created MCOBERTURA-162:
---------------------------------------

             Summary: 
apache.struts2.StrutsTestCase.getActionProxy(StrutsTestCase.java:130)      
NullPointerException 
                 Key: MCOBERTURA-162
                 URL: https://jira.codehaus.org/browse/MCOBERTURA-162
             Project: Maven 2.x Cobertura Plugin
          Issue Type: Bug
    Affects Versions: 2.5.1
         Environment: stuts2.2.1,hibernate3.1,spring3.0
            Reporter: zhouxingxing


I learn for example:
include stuts.xml file:
<constant name="struts.objectFactory" value="spring" />
<!-- Add packages here -->
<package name="default" namespace="/ut/regnlogin" extends="struts-default">
<action name="activateUserByEmail" class="activateUserByEmailBean">
        <result>/ut/regnlogin/success.jsp</result>
        <result name="error">/ut/regnlogin/error.jsp</result>
</action>

Test class&#65306;

public class ActivateUserByEmailTest extends StrutsTestCase{
        @Test
        public void testExecute() throws Exception {
                
                
                MockHttpServletRequest request = new MockHttpServletRequest();

                request.setParameter("id", "email1"); 
        
                ActionProxy proxy = getActionProxy 
("/ut/regnlogin/activateUserByEmail.action"); 

                assertNotNull(proxy); 

                ActivateUserByEmail action = (ActivateUserByEmail) 
proxy.getAction(); 

                assertNotNull(action); 
                String result;
        
                        result = proxy.execute();


                assertEquals(Action.SUCCESS, result); 
}

excute relsult&#65306;
java.lang.NullPointerException   
        at 
org.apache.struts2.StrutsTestCase.getActionProxy(StrutsTestCase.java:130)
        at 
com.cnbab.proj118.regnlogin.action.ActivateUserByEmailTest.testExecute(ActivateUserByEmailTest.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)

wait for Code execution to:`ActionProxy proxy = 
getActionProxy("/ut/regnlogin/activateUserByEmail.action"); 
Display pointer null error, where is the problem?
change Path to&#65306;.... getActionProxy("/ut/regnlogin/activateUserByEmail"); 
 or                  getActionProxy("/activateUserByEmail.action"); 
 or                  getActionProxy("/activateUserByEmail"); 
All display null pointer, what is the reason?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to