I am trying to write test for Struts2 action by extending StrutsSpringTestCase
. The reference: Unit Testing.
When I call getActionMapping(<action url>)
, does it search struts.xml
file for the action mapping?
The Code:
ActionMapping mapping = getActionMapping("/custSeach.action");// Intentionally missed 'r'.
assertEquals("custSeach", mapping.getName());
This passes. But there is no custSeach
action in my struts.xml
mapping.
More details:
struts.xml
is in the class path. I could print all files loaded from the classpath and struts.xml
is one of them.
also, I tried the following as well:
ActionProxy proxy = getActionProxy("custSearch");
assertNotNull(proxy);
custSearch
does exist. But it's still throwing the error
There is no Action mapped for action name custSearch.