Search in sources :

Example 26 with TaskBuilder

use of org.motechproject.tasks.domain.mds.task.builder.TaskBuilder in project motech by motech.

the class TaskContextTest method testGetTriggerKeyShouldThrowException.

@Test(expected = IllegalStateException.class)
public void testGetTriggerKeyShouldThrowException() throws Exception {
    MotechEvent event = mock(MotechEvent.class);
    when(event.getParameters()).thenReturn(new HashMap<>());
    KeyInformation key = parse(String.format("%s.%s", TRIGGER_PREFIX, EVENT_KEY));
    Task task = new TaskBuilder().addAction(new TaskActionInformation()).build();
    new TaskContext(task, event.getParameters(), null, activityService).getTriggerValue(key.getKey());
}
Also used : TaskBuilder(org.motechproject.tasks.domain.mds.task.builder.TaskBuilder) Task(org.motechproject.tasks.domain.mds.task.Task) TaskActionInformation(org.motechproject.tasks.domain.mds.task.TaskActionInformation) MotechEvent(org.motechproject.event.MotechEvent) KeyInformation(org.motechproject.tasks.domain.KeyInformation) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)26 Task (org.motechproject.tasks.domain.mds.task.Task)26 TaskBuilder (org.motechproject.tasks.domain.mds.task.builder.TaskBuilder)26 TaskActionInformation (org.motechproject.tasks.domain.mds.task.TaskActionInformation)24 HashMap (java.util.HashMap)11 KeyInformation (org.motechproject.tasks.domain.KeyInformation)10 ActionEvent (org.motechproject.tasks.domain.mds.channel.ActionEvent)9 ObjectTest (org.motechproject.tasks.domain.ObjectTest)8 ActionEventBuilder (org.motechproject.tasks.domain.mds.channel.builder.ActionEventBuilder)8 TreeSet (java.util.TreeSet)7 TaskContext (org.motechproject.tasks.service.util.TaskContext)7 MotechEvent (org.motechproject.event.MotechEvent)5 DataSource (org.motechproject.tasks.domain.mds.task.DataSource)5 FilterSet (org.motechproject.tasks.domain.mds.task.FilterSet)4 TaskConfig (org.motechproject.tasks.domain.mds.task.TaskConfig)4 TaskTriggerInformation (org.motechproject.tasks.domain.mds.task.TaskTriggerInformation)4 ArrayList (java.util.ArrayList)3 Filter (org.motechproject.tasks.domain.mds.task.Filter)3 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)2 Matchers.anyString (org.mockito.Matchers.anyString)2