@Test
public void testSearchRecentRunningWorkflows() {

    workflow.setWorkflowId("completed-workflow");
    workflow.setStatus(Workflow.WorkflowStatus.COMPLETED);
    indexDAO.indexWorkflow(workflow);
    String workflowId = "recent-running-workflow-id";
    workflow.setWorkflowId(workflowId);
    workflow.setStatus(Workflow.WorkflowStatus.RUNNING);
    workflow.setCreateTime(new Date().getTime());
    workflow.setUpdateTime(new Date().getTime());
    workflow.setEndTime(new Date().getTime());
    indexDAO.indexWorkflow(workflow);
    await()
            .atMost(3, TimeUnit.SECONDS)
            .untilAsserted(
                    () -> {
                        List<String> searchIds = indexDAO.searchRecentRunningWorkflows(1,0);
                        assertEquals(1, searchIds.size());
                        assertEquals(workflowId, searchIds.get(0));
                    }
            );
}