@Test
public void testMultipleQueuesExecution() {

    System.setProperty("workflow.system.task.worker.thread.count", "1");
    System.setProperty("workflow.isolated.system.task.worker.thread.count", "1");
    String sysTask = "taskId";
    String isolatedTask = "isolatedTaskId";
    Configuration configuration = new SystemPropertiesConfiguration();
    when(queueDAO.pop(TEST_TASK, 1, 200)).thenReturn(Collections.singletonList(sysTask));
    when(queueDAO.pop(ISOLATED_TASK, 1, 200)).thenReturn(Collections.singletonList(isolatedTask));
    systemTaskExecutor = new SystemTaskExecutor(queueDAO, workflowExecutor, configuration, executionService);
    CountDownLatch sysTaskLatch = new CountDownLatch(1);
    CountDownLatch isolatedTaskLatch = new CountDownLatch(1);
    doAnswer(invocation -> {
            Object[] args = invocation.getArguments();
            String taskId = args[1].toString();
            if (taskId.equals(sysTask)) {
                sysTaskLatch.countDown();
            }
            if (taskId.equals(isolatedTask)) {
                isolatedTaskLatch.countDown();
            }
            return null;
        }
    ).when(workflowExecutor).executeSystemTask(any(), anyString(), anyInt());
    scheduledExecutorService
        .scheduleAtFixedRate(() -> systemTaskExecutor.pollAndExecute(TEST_TASK), 0, 1, TimeUnit.SECONDS);
    ScheduledExecutorService isoTaskService = Executors.newSingleThreadScheduledExecutor();
    isoTaskService
        .scheduleAtFixedRate(() -> systemTaskExecutor.pollAndExecute(ISOLATED_TASK), 0, 1, TimeUnit.SECONDS);
    Uninterruptibles.awaitUninterruptibly(sysTaskLatch);
    Uninterruptibles.awaitUninterruptibly(isolatedTaskLatch);
    shutdownExecutorService(isoTaskService);
}