List<HistoricCaseActivityInstance> mockedHistoricCaseActivityInstances = MockProvider.createMockRunningHistoricCaseActivityInstances();
HistoricCaseActivityInstanceQuery mockedHistoricCaseActivityInstanceQuery = mock(HistoricCaseActivityInstanceQuery.class);
when(mockedHistoricCaseActivityInstanceQuery.list()).thenReturn(mockedHistoricCaseActivityInstances);
when(processEngine.getHistoryService().createHistoricCaseActivityInstanceQuery()).thenReturn(mockedHistoricCaseActivityInstanceQuery);
Response response = given()
.queryParam("unfinished", true)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(HISTORIC_CASE_ACTIVITY_INSTANCE_RESOURCE_URL);
InOrder inOrder = inOrder(mockedHistoricCaseActivityInstanceQuery);
inOrder.verify(mockedHistoricCaseActivityInstanceQuery).notEnded();
inOrder.verify(mockedHistoricCaseActivityInstanceQuery).list();
String content = response.asString();
List<String> instances = from(content).getList("");
Assert.assertEquals(1, instances.size());
Assert.assertNotNull(instances.get(0));
String returnedCaseDefinitionId = from(content).getString("[0].caseDefinitionId");