ArchivingWorkflowStatusListener implements WorkflowStatusListener { @Override public void onWorkflowCompleted(Workflow workflow) { LOGGER.info("Archiving workflow {} on completion ", workflow.getWorkflowId()); this.executionDAOFacade.removeWorkflow(workflow.getWorkflowId(), true); Monitors.recordWorkflowArchived(workflow.getWorkflowName(), workflow.getStatus()); } @Inject  ArchivingWorkflowStatusListener(ExecutionDAOFacade executionDAOFacade); @Override void onWorkflowCompleted(Workflow workflow); @Override void onWorkflowTerminated(Workflow workflow);  }
@Test public void testArchiveOnWorkflowCompleted() { cut.onWorkflowCompleted(wf); verify(executionDAOFacade, times(1)) .removeWorkflow(wf.getWorkflowId(), true); verifyNoMoreInteractions(executionDAOFacade); }