@Test
public void testTaskToDomainsPerTask() {

    Workflow workflow = generateSampleWorkflow();
    List<Task> tasks = generateSampleTasks(2);
    Map<String, String> taskToDomain = new HashMap<>();
    taskToDomain.put("*", "mydomain, NO_DOMAIN");
    workflow.setTaskToDomain(taskToDomain);
    PollData pollData1 = new PollData("queue1", "mydomain", "worker1", System.currentTimeMillis() - 99 * 100);
    when(executionDAOFacade.getTaskPollDataByDomain(eq("task1"), anyString())).thenReturn(pollData1);
    when(executionDAOFacade.getTaskPollDataByDomain(eq("task2"), anyString())).thenReturn(null);
    workflowExecutor.setTaskDomains(tasks, workflow);
    assertEquals("mydomain", tasks.get(0).getDomain());
    assertNull(tasks.get(1).getDomain());
}