use of org.motechproject.tasks.domain.mds.task.TaskActivity in project motech by motech.
the class TaskActivityServiceImplTest method shouldAddErrorActivityWithTaskException.
@Test
public void shouldAddErrorActivityWithTaskException() {
when(taskActivitiesDataService.findById(TASK_ACTIVITY_ID)).thenReturn(createInProgress());
String messageKey = "error.notFoundTrigger";
TaskHandlerException exception = new TaskHandlerException(TRIGGER, messageKey, ERROR_FIELD.get(0));
ArgumentCaptor<TaskActivity> captor = ArgumentCaptor.forClass(TaskActivity.class);
activityService.addFailedExecution(TASK_ACTIVITY_ID, exception);
verify(taskActivitiesDataService).update(captor.capture());
assertActivity(messageKey, ERROR_FIELD, TASK_ID, TaskActivityType.ERROR, getStackTrace(exception), null, captor.getValue());
}
Aggregations