@Test
public void testPollAndExecuteIsolatedSystemTask() {

    System.setProperty("workflow.isolated.system.task.worker.thread.count", "1");
    Configuration configuration = new SystemPropertiesConfiguration();
    when(queueDAO.pop(anyString(), anyInt(), anyInt())).thenReturn(Collections.singletonList("isolated_taskId"));
    systemTaskExecutor = new SystemTaskExecutor(queueDAO, workflowExecutor, configuration, executionService);
    CountDownLatch latch = new CountDownLatch(1);
    doAnswer(invocation -> {
            latch.countDown();
            return null;
        }
    ).when(workflowExecutor).executeSystemTask(any(), anyString(), anyInt());
    scheduledExecutorService.scheduleAtFixedRate(
        () -> systemTaskExecutor.pollAndExecute(ISOLATED_TASK), 0, 1, TimeUnit.SECONDS);
    Uninterruptibles.awaitUninterruptibly(latch);
    verify(workflowExecutor).executeSystemTask(any(), anyString(), anyInt());
}