use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testUnsuccessfulDelegateTask.
@Test
public void testUnsuccessfulDelegateTask() {
doThrow(new ProcessEngineException("expected exception")).when(taskServiceMock).delegateTask(any(String.class), any(String.class));
Map<String, Object> json = new HashMap<String, Object>();
json.put("userId", EXAMPLE_USER_ID);
given().pathParam("id", EXAMPLE_TASK_ID).header("accept", MediaType.APPLICATION_JSON).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(ProcessEngineException.class.getSimpleName())).body("message", equalTo("expected exception")).when().post(DELEGATE_TASK_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testUnsuccessfulSetAssignee.
@Test
public void testUnsuccessfulSetAssignee() {
doThrow(new ProcessEngineException("expected exception")).when(taskServiceMock).setAssignee(any(String.class), any(String.class));
given().pathParam("id", EXAMPLE_TASK_ID).header("accept", MediaType.APPLICATION_JSON).contentType(POST_JSON_CONTENT_TYPE).body(EMPTY_JSON_OBJECT).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(ProcessEngineException.class.getSimpleName())).body("message", equalTo("expected exception")).when().post(ASSIGNEE_TASK_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testDeleteSingleTaskAttachmentForNonExistingTask.
@Test
public void testDeleteSingleTaskAttachmentForNonExistingTask() {
doThrow(new ProcessEngineException()).when(taskServiceMock).deleteTaskAttachment(NON_EXISTING_ID, EXAMPLE_TASK_ATTACHMENT_ID);
given().pathParam("id", NON_EXISTING_ID).pathParam("attachmentId", EXAMPLE_TASK_ATTACHMENT_ID).header("accept", MediaType.APPLICATION_JSON).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).body(containsString("Deletion is not possible. No attachment exists for task id '" + NON_EXISTING_ID + "' and attachment id '" + EXAMPLE_TASK_ATTACHMENT_ID + "'.")).when().delete(SINGLE_TASK_DELETE_SINGLE_ATTACHMENT_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class CaseExecutionRestServiceInteractionTest method testGetVariablesForNonExistingExecution.
@Test
public void testGetVariablesForNonExistingExecution() {
when(caseServiceMock.getVariablesTyped(anyString(), anyBoolean())).thenThrow(new ProcessEngineException("expected exception"));
given().pathParam("id", "aNonExistingExecutionId").then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(ProcessEngineException.class.getSimpleName())).body("message", equalTo("expected exception")).when().get(CASE_EXECUTION_VARIABLES_URL);
verify(caseServiceMock).getVariablesTyped("aNonExistingExecutionId", true);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class CaseInstanceRestServiceInteractionTest method testGetVariableForNonExistingInstance.
@Test
public void testGetVariableForNonExistingInstance() {
String variableKey = "aVariableKey";
when(caseServiceMock.getVariableTyped(eq(MockProvider.EXAMPLE_CASE_INSTANCE_ID), eq(variableKey), eq(true))).thenThrow(new ProcessEngineException("expected exception"));
given().pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID).pathParam("varId", variableKey).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(RestException.class.getSimpleName())).body("message", is("Cannot get case execution variable " + variableKey + ": expected exception")).when().get(SINGLE_CASE_INSTANCE_VARIABLE_URL);
}
Aggregations