@Test
public void getMappedTasksException() throws Exception {

    //Given
    WorkflowTask  taskToSchedule = new WorkflowTask();
    taskToSchedule.setName("simple_task");
    String taskId = IDGenerator.generate();
    String retriedTaskId = IDGenerator.generate();
    WorkflowDef  wd = new WorkflowDef();
    Workflow w = new Workflow();
    w.setWorkflowDefinition(wd);
    TaskMapperContext taskMapperContext = TaskMapperContext.newBuilder()
            .withWorkflowDefinition(wd)
            .withWorkflowInstance(w)
            .withTaskDefinition(new TaskDef())
            .withTaskToSchedule(taskToSchedule)
            .withTaskInput(new HashMap<>())
            .withRetryCount(0)
            .withRetryTaskId(retriedTaskId)
            .withTaskId(taskId)
            .build();
    //then
    expectedException.expect(TerminateWorkflowException.class);
    expectedException.expectMessage(String.format("Invalid task. Task %s does not have a definition", taskToSchedule.getName()));
    //when
    simpleTaskMapper.getMappedTasks(taskMapperContext);
}