@Test
public void testExecute() throws Exception {

    persistFlowHistory();
    assertEquals(6, flowRepository.findFlows(allFlows).size());
    flowPurgerMBean.getScheduler().getListenerManager().addJobListener(new PurgeJobListener(latch));
    flowPurgerMBean.setDoNotPurgeErrorFlows(false);
    flowPurgerMBean.setPurgeFlowsOlderThan("9d");
    flowPurgerMBean.execute();
    latch.await(WAIT_TIMEOUT, TimeUnit.SECONDS);        
    assertEquals(1, flowRepository.findFlows(allFlows).size());
    flowPurgerMBean.unschedule();
}