Sunday, May 12, 2013

EayMock: Troubleshooting


EasyMock notes:

There are three stages in mocking an object using EasyMock:

1. mock objects and set the expected behaviour of methods of mocking object
2. replay or simulate the mocked behaviour
3. verify that mocked object is executing correctly on the method being tested.


mocking --> replay -->  verify


EasyMock error examples:

1. Expectation failure on verify:

sample example:


java.lang.AssertionError:
  Expectation failure on verify:
    IResponseCondition.isSatisfied(): expected: 1, actual: 0

what is the problem  ? :

the function isSatisfid() is being called with EasyMock.expect() function. but this error says

expect :1  means the function 'isSatisfied' is being called once in your program.

actual:1 means this function 'isSatisfied' shoudl be called zero number of times. i.e. no call at all.



how to resolve it  ?

remove the expect call of EasyMock libraray from this function.
That should resolve the error.

No comments:

Post a Comment