EasyMock 2.5.2
By Henri Tremblay on Sunday, September 13 2009, 00:05 - Java - Permalink
Just a quick post about EasyMock 2.5.2. It just went out. Mainly to fix a dumb bug on the capture but I also decided to include a new class named EasyMockSupport.
This class should be helpful to anyone who's tired of replaying and verifying explicitly all mocks. It's a helper keeping track of your mocks. Nothing revolutionary but I think it could be quite useful. Here's an example:
public class SupportTest extends EasyMockSupport {
private Collaborator firstCollaborator;
private Collaborator secondCollaborator;
private ClassTested classUnderTest;
@Before
public void setup() {
classUnderTest = new ClassTested();
}
@Test
public void addDocument() {
firstCollaborator = createMock(Collaborator.class);
secondCollaborator = createMock(Collaborator.class);
classUnderTest.addListener(firstCollaborator);
classUnderTest.addListener(secondCollaborator);
firstCollaborator.documentAdded("New Document");
secondCollaborator.documentAdded("New Document");
replayAll();
classUnderTest.addDocument("New Document", new byte[0]);
verifyAll();
}
}
P.S.: Somebody know a good code formatter plugin for dotclear?

