@Test(expected = ApplicationException.class)
public void testMetadataPopulationMissingDefinitions() {

    String nameTaskDefinition1 = "task4";
    WorkflowTask workflowTask1 = createWorkflowTask(nameTaskDefinition1);
    String nameTaskDefinition2 = "task5";
    WorkflowTask workflowTask2 = createWorkflowTask(nameTaskDefinition2);
    TaskDef taskDefinition = createTaskDefinition(nameTaskDefinition1);
    WorkflowDef workflowDefinition = createWorkflowDefinition("testMetadataPopulation");
    workflowDefinition.setTasks(ImmutableList.of(workflowTask1, workflowTask2));
    when(metadataDAO.getTaskDef(nameTaskDefinition1)).thenReturn(taskDefinition);
    when(metadataDAO.getTaskDef(nameTaskDefinition2)).thenReturn(null);
    metadataMapperService.populateTaskDefinitions(workflowDefinition);
}