use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class CaseInstanceRestServiceInteractionTest method testVariableModificationForNonExistingCaseInstance.
@Test
public void testVariableModificationForNonExistingCaseInstance() {
doThrow(new ProcessEngineException("expected exception")).when(caseExecutionCommandBuilderMock).execute();
String variableKey = "aKey";
int variableValue = 123;
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
Map<String, Object> modifications = VariablesBuilder.create().variable(variableKey, variableValue).getVariables();
messageBodyJson.put("modifications", modifications);
given().pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID).contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(RestException.class.getSimpleName())).body("message", equalTo("Cannot modify variables for case execution " + MockProvider.EXAMPLE_CASE_INSTANCE_ID + ": expected exception")).when().post(CASE_INSTANCE_VARIABLES_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class CaseInstanceRestServiceInteractionTest method testPutVariableForNonExistingInstance.
@Test
public void testPutVariableForNonExistingInstance() {
String variableKey = "aVariableKey";
String variableValue = "aVariableValue";
Map<String, Object> variableJson = VariablesBuilder.getVariableValueMap(variableValue);
doThrow(new ProcessEngineException("expected exception")).when(caseExecutionCommandBuilderMock).execute();
given().pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID).pathParam("varId", variableKey).contentType(ContentType.JSON).body(variableJson).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(RestException.class.getSimpleName())).body("message", is("Cannot put case execution variable " + variableKey + ": expected exception")).when().put(SINGLE_CASE_INSTANCE_VARIABLE_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class DecisionDefinitionRestServiceInteractionTest method testEvaluateDecision_ProcessEngineException.
@Test
public void testEvaluateDecision_ProcessEngineException() {
String message = "expected message";
when(decisionEvaluationBuilderMock.evaluate()).thenThrow(new ProcessEngineException(message));
Map<String, Object> json = new HashMap<String, Object>();
json.put("variables", Collections.emptyMap());
given().pathParam("id", MockProvider.EXAMPLE_DECISION_DEFINITION_ID).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", is(RestException.class.getSimpleName())).body("message", containsString(message)).when().post(EVALUATE_DECISION_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class DecisionDefinitionRestServiceInteractionTest method testEvaluateDecisionByKey_ProcessEngineException.
@Test
public void testEvaluateDecisionByKey_ProcessEngineException() {
String message = "expected message";
when(decisionEvaluationBuilderMock.evaluate()).thenThrow(new ProcessEngineException(message));
Map<String, Object> json = new HashMap<String, Object>();
json.put("variables", Collections.emptyMap());
given().pathParam("key", MockProvider.EXAMPLE_DECISION_DEFINITION_KEY).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", is(RestException.class.getSimpleName())).body("message", containsString(message)).when().post(EVALUATE_DECISION_BY_KEY_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class CaseDefinitionRestServiceInteractionTest method testCreateCaseInstanceByInvalidCaseDefinitionKey.
@Test
public void testCreateCaseInstanceByInvalidCaseDefinitionKey() {
when(caseInstanceBuilder.create()).thenThrow(new ProcessEngineException("expected exception"));
given().pathParam("key", MockProvider.EXAMPLE_CASE_DEFINITION_KEY).contentType(POST_JSON_CONTENT_TYPE).body(EMPTY_JSON_OBJECT).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(RestException.class.getSimpleName())).body("message", containsString("Cannot instantiate case definition aCaseDefnitionId: expected exception")).when().post(CREATE_INSTANCE_BY_KEY_URL);
}
Aggregations