@Test
public void testCheckTaskPollTimeout() {

    Counter counter = registry.counter("task_timeout", "class", "WorkflowMonitor", "taskType", "test");
    long counterCount = counter.count();
    TaskDef taskType = new TaskDef();
    taskType.setName("test");
    taskType.setTimeoutPolicy(TimeoutPolicy.RETRY);
    taskType.setPollTimeoutSeconds(1);
    Task task = new Task();
    task.setTaskType(taskType.getName());
    task.setScheduledTime(System.currentTimeMillis() - 2_000);
    task.setStatus(Status.SCHEDULED);
    deciderService.checkTaskPollTimeout(taskType, task);
    assertEquals(++counterCount, counter.count());
    assertEquals(Status.TIMED_OUT, task.getStatus());
    assertNotNull(task.getReasonForIncompletion());
    task.setScheduledTime(System.currentTimeMillis());
    task.setReasonForIncompletion(null);
    task.setStatus(Status.SCHEDULED);
    deciderService.checkTaskPollTimeout(taskType, task);
    assertEquals(counterCount, counter.count());
    assertEquals(Status.SCHEDULED, task.getStatus());
    assertNull(task.getReasonForIncompletion());
}