}
@Test
public void testGetNonExistingProcessInstance() {
HistoricProcessInstanceQuery sampleInstanceQuery = mock(HistoricProcessInstanceQuery.class);
when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(sampleInstanceQuery);
when(sampleInstanceQuery.processInstanceId(anyString())).thenReturn(sampleInstanceQuery);
when(sampleInstanceQuery.singleResult()).thenReturn(null);
given().pathParam("id", "aNonExistingInstanceId")
.then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON)
.body("type", equalTo(InvalidRequestException.class.getSimpleName()))
.body("message", equalTo("Historic process instance with id aNonExistingInstanceId does not exist"))