out.flush();
assertThat(outputStream.toString()).containsIgnoringCase("please supply a business key");
}
private ProcessEngine newMockProcessEngine() {
final ProcessEngine engine = mock(ProcessEngine.class);
final List<ProcessInstance> processes = ImmutableList.of(
newProcessInstanceMock("p1", BUSINESS_KEY, true),
newProcessInstanceMock("p2", BUSINESS_KEY, false),
newProcessInstanceMock("p3", BUSINESS_KEY, true)
);
final RuntimeService runtimeService = mock(RuntimeService.class);
final ProcessInstanceQuery processInstanceQuery = mock(ProcessInstanceQuery.class);
when(engine.getRuntimeService()).thenReturn(runtimeService);
when(runtimeService.createProcessInstanceQuery()).thenReturn(processInstanceQuery);
when(processInstanceQuery.variableValueEquals(CoreProcessVariables.POOL_BUSINESS_KEY, BUSINESS_KEY))
.thenReturn(processInstanceQuery);
when(processInstanceQuery.orderByProcessInstanceId()).thenReturn(processInstanceQuery);
when(processInstanceQuery.desc()).thenReturn(processInstanceQuery);