@Test
public void archiveWorkflowsWithActionsWorks() {

  List<Long> workflowIds = new ArrayList<>();
  List<Long> actionIds = new ArrayList<>();
  storeActions(storeActiveWorkflow(archiveTime1), 3);
  storeActions(storeActiveWorkflow(prodTime1), 1);
  storeActions(storePassiveWorkflow(prodTime1), 2);
  long archivable1 = storePassiveWorkflow(archiveTime1);
  long archivable2 = storePassiveWorkflow(archiveTime2);
  actionIds.addAll(storeActions(archivable1, 1));
  actionIds.addAll(storeActions(archivable2, 3));
  workflowIds.addAll(asList(archivable1, archivable2));
  int actionCountBefore = getActiveActionCount();
  assertEquals(workflowIds.size(), maintenanceDao.archiveWorkflows(workflowIds));
  int actionCountAfter = getActiveActionCount();
  assertActiveWorkflowsRemoved(workflowIds);
  assertArchiveWorkflowsExist(workflowIds);
  assertActiveActionsRemoved(actionIds);
  assertArchiveActionsExist(actionIds, true);
  assertEquals(actionIds.size(), getArchiveActionCount());
  assertEquals(actionCountAfter, actionCountBefore - actionIds.size());
}