Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JUnit problem with addRequestParameter . HELP * * *

 
Nivan scorp
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am running into one peculiar error with JUnit.

I have three test methods namely
1. testSetup,
2. testSubmit and
3. testApply.

When I run my Test class, each of my test methods enter the method named
"unspecified" in my Action file which always point to the setup() method.


I have correctly used the addRequestParameter(PARAM_DISPATCH_METHOD, METHOD_SETUP)function.
The problem I just defined occurs only when my Action extends BaseLookupDispatchAction.

If I make my Action extends BaseDispatchAction, then my test runs through
fine and it enters all the methods in order!!!

Is there an alternative to addRequestParameter while using BaseLookupDispatchAction?

Doesnt anyone have a clue on the difference betweeen handling the problem I stated between BaseDispatchAction and BaseLookupDispatchAction.

Am justhoping someone knows it!!

Thanks,
Nivan.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm. I just looked and I can't find BaseLookupDispatchAction from the Struts API -- is that a WebLogic extension of the "standard" org.apache.struts.actions.LookupDispatchAction?
 
Nivan scorp
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh!
Its not in the Struts API but this guy has been derived from the
"org.apache.struts.actions.LookupDispatchAction". I see that they have introduced an abstract method in this BaseLookupDispatchAction class called getKeyMethodMap() which returns a Map and its implementation in
my Action Class looks as under

-----------------------CODE-----------------------
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("setup", "setup");
map.put("xxx.selectbutton", "selectedAccount");
map.put("xxx.submitbutton", "submit");
map.put("xxx.cancelbutton", "cancel");
return map;
}
-----------------------CODE-----------------------

The new class has been derived to handle multiple buttons on web pages.

Can you get anything from this?

Thanks,
Nivan.
 
Nivan scorp
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Doesnt my last mail give any clue on how I need to use
addRequestParameter() in my JUnit Test file?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic