tags:

views:

67

answers:

2

As per title, just wondering if there is a mechanism with easymock to test if a method wasn't called during it's lifetime.

A: 

By default, Easymock will throw an exception for any methods that are called that you didn't explicitly set expectations for.

Daniel Alexiuc
+2  A: 

From the EasyMock documentation:

Nice Mocks

On a Mock Object returned by createMock() the default behavior for all methods is to throw an AssertionError for all unexpected method calls. If you would like a "nice" Mock Object that by default allows all method calls and returns appropriate empty values (0, null or false), use createNiceMock() instead.

So what you are asking is the default behavior.

Wim Coenen