aspose file tools*
The moose likes Testing and the fly likes EasyMock 3.0 Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "EasyMock 3.0 Question" Watch "EasyMock 3.0 Question" New topic
Author

EasyMock 3.0 Question

Jeff Palmer
Greenhorn

Joined: Feb 14, 2011
Posts: 1
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

Joined: Mar 02, 2008
Posts: 5
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
 
Don't get me started about those stupid light bulbs.
 
subject: EasyMock 3.0 Question