@BeforeMethod(groups = "unit") public void init() { support = new EventSupportImpl(); eventDispatcher = EasyMock.createMock(EventDispatcher.class); messageSource = EasyMock.createMock(MessageSource.class); collection.add(eventDispatcher); collection.add(messageSource); support.setEventDispatcher(eventDispatcher); support.setMessageSource(messageSource); event = null; eventDispatcher.fireEvent( EasyMockUtils.record( new EasyMockUtils.Recorder<EventBase>() { public void record(final EventBase object) { event = object; } })); EasyMock.expect(messageSource.getMessage("code", null)).andStubReturn("message"); collection.replay(); final User user = new User(); user.setCagridId(userId); template = new EventBaseImpl(); template.setJobId(jobId); template.setUserId(userId); template.setJobName(jobName); template.setWorkflowId(workflowId); }