Blog Archives

Flexible Mocking

Unit tests, in particular the assertions within, should be no more and no less specific than they need to be. Make a test too loose, and it will be possible for someone to make changes to the code in a

Posted in Clean Test Code, EasyMock

JUnit Rule for Annotations in EasyMock 3.3

In my first contribution for EasyMock 3.3 I have added support for processing the annotations with a JUnit Rule instead of the JUnit Runner. In 3.2 you could do this: @RunWith(EasyMockRunner.class) public class SomethingTest extends EasyMockSupport{ @Test public void shouldDoSomething()

Posted in EasyMock, JUnit

Annotations in EasyMock 3.2

Lots of people have been asking for annotation support in EasyMock, including me: EASYMOCK-51. I created EasyMockRule as a way to add annotation driven mocking, and a few other nice features like Hamcrest matcher support for expectation setters and automatic verification, mostly

Posted in EasyMock

Annotations for EasyMock

Look at this: With JUnit, that’s all you have to do make a method behave as a test. It’s clear at first glance that this is a test. That one simple annotation makes the method take on all the characteristics

Posted in EasyMock, JUnit