forked from camunda-community-hub/camunda-platform-7-mockito
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueryMocksExample.java
32 lines (24 loc) · 1017 Bytes
/
QueryMocksExample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package org.camunda.community.mockito;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.task.Task;
import org.camunda.bpm.engine.task.TaskQuery;
import org.junit.Ignore;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@Ignore
public class QueryMocksExample {
private final TaskService taskService = mock(TaskService.class);
private final Task task = mock(Task.class);
@Test
public void mock_taskQuery() {
// bind query-mock to service-mock and set result to task.
final TaskQuery taskQuery = null; //QueryMocks1.mockTaskQuery(taskService).singleResult(task);
final Task result = taskService.createTaskQuery().active().activityInstanceIdIn("foo").excludeSubtasks().singleResult();
assertThat(result).isEqualTo(task);
verify(taskQuery).active();
verify(taskQuery).activityInstanceIdIn("foo");
verify(taskQuery).excludeSubtasks();
}
}