Tuesday, January 28, 2014

Easymock: matcher calls were used outside expectations

You are running your unit tests with EasyMock and then you face this kind of error "matcher calls were used outside expectations".

java.lang.IllegalStateException: matcher calls were used outside expectations
at org.easymock.internal.RecordState.replay(RecordState.java:86)
at org.easymock.internal.MocksControl.replay(MocksControl.java:169)


This happens because you are having some kind of code like this, where the .andReturn is not returning an object.
expect(mockdao.bark(EasyMock.anyObject(Dog.class))).andReturn(EasyMock.anyObject(Noise.class)));

To fix this, you should use the null return or return an instance of an object, or even a mock object:
expect(mockdao.bark(EasyMock.anyObject(Dog.class))).andReturn(new Noise()));

Sunday, January 26, 2014

Online Photo Editor: PicMonkey

Edit a photo, create a collage, easy, fast fearless photo embetterment! It's their slogan.
I've already tried and it is really easy to use.

Use the free photo editor PicMonkey (no registration is required) or use the Upgrade (Royale) that has ads-free editing, more glorious effects and exclusive designs! Register using this link and get one day of a Royale account!


This screenshot has been edited by PicMonkey in a few minutes.