• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EasyMock 3.0 Question

 
Jeff Palmer
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to use EasyMock 3.0 to test a MessageListener class that I wrote. When I run my test, I'm consistently getting a NPE for a class that I'm mocking.

The code for the method I'm trying to test is as follows (the NPE is happening at line 07 in the following code):



My test code is as follows:



I'm fairly new to EasyMock so any help would be greatly appreciated. Thanks!
 
Krisztian Milesz
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems like that you've just created a mock MessageUtility but you didn't inject that into the listener object. You have to tell the listener to use your mocked MessageUtility.

Regards,
Krisztian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic