Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

easymock, j2ee (struts 2) and debugging...  RSS feed

 
olze oli
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

i have a struts 2 application which uses now junit and easymock (for testing purposes).
I have some domain objects and those have some methods for testing that all neccessary fields are valid (isValid()), for example a object user and the data object which i called userData
The problem is now, that i am unable to debug into the method - it just throws me into some framework sources



the line above should return true because all neccessary fields are correct, but it returns false, and i have no idea why, so i must debug it.
In eclipse, when i use the debug view, i can set a breakpoint at this line, go with the mouse over "setUserData" and press F5, then it should go into the method and display me what it does
but i get thrown to easymock.jar (which has no debug symbols because i dont use the source, i use the .jar)

Is there any way i can debug it? I need to know why the method "setUserData" returns false

I use eclipse 3.4.2 with Java(TM) SE Runtime Environment (build 1.6.0_14-b08)

Edit: i also set a breakpoint at the first codeline in setUserData (this is where isValid() is called) but it just dont breaks there...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're debugging the mock, not your code--you mocked it.

I'm more familiar with Mockito than EasyMock, but don't you have to specify what the method will return when you call it? It'll be hard to help without actually seeing your test code that isn't doing what you expect.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!