use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class TaskVariableLocalRestResourceInteractionTest method testGetLocalVariableForNonExistingTaskId.
@Test
public void testGetLocalVariableForNonExistingTaskId() {
String variableKey = "aVariableKey";
when(taskServiceMock.getVariableLocalTyped(eq(NON_EXISTING_ID), eq(variableKey), anyBoolean())).thenThrow(new ProcessEngineException("task " + NON_EXISTING_ID + " doesn't exist"));
given().pathParam("id", NON_EXISTING_ID).pathParam("varId", variableKey).header("accept", MediaType.APPLICATION_JSON).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(RestException.class.getSimpleName())).body("message", is("Cannot get task variable " + variableKey + ": task " + NON_EXISTING_ID + " doesn't exist")).when().get(SINGLE_TASK_SINGLE_VARIABLE_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class TenantRestServiceInteractionTest method createExistingTenant.
@Test
public void createExistingTenant() {
Tenant newTenant = MockProvider.createMockTenant();
when(identityServiceMock.newTenant(MockProvider.EXAMPLE_TENANT_ID)).thenReturn(newTenant);
String message = "exception expected";
doThrow(new ProcessEngineException(message)).when(identityServiceMock).saveTenant(newTenant);
given().body(TenantDto.fromTenant(newTenant)).contentType(ContentType.JSON).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(ProcessEngineException.class.getSimpleName())).body("message", equalTo(message)).when().post(TENANT_CREATE_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class UserRestServiceInteractionTest method testUserCreateExistingFails.
@Test
public void testUserCreateExistingFails() {
User newUser = MockProvider.createMockUser();
when(identityServiceMock.newUser(MockProvider.EXAMPLE_USER_ID)).thenReturn(newUser);
doThrow(new ProcessEngineException("")).when(identityServiceMock).saveUser(newUser);
UserDto userDto = UserDto.fromUser(newUser, true);
given().body(userDto).contentType(ContentType.JSON).then().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(ProcessEngineException.class.getSimpleName())).when().post(USER_CREATE_URL);
verify(identityServiceMock).newUser(MockProvider.EXAMPLE_USER_ID);
verify(identityServiceMock).saveUser(newUser);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class DeploymentRestServiceInteractionTest method testRedeployThrowsProcessEngineException.
@Test
public void testRedeployThrowsProcessEngineException() {
String message = "something went wrong";
doThrow(new ProcessEngineException(message)).when(mockDeploymentBuilder).deployWithResult();
given().pathParam("id", MockProvider.EXAMPLE_DEPLOYMENT_ID).contentType(POST_JSON_CONTENT_TYPE).expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(ProcessEngineException.class.getSimpleName())).body("message", is(message)).when().post(REDEPLOY_DEPLOYMENT_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testDeleteSingleTaskAttachmentForNonExistingAttachmentId.
@Test
public void testDeleteSingleTaskAttachmentForNonExistingAttachmentId() {
doThrow(new ProcessEngineException()).when(taskServiceMock).deleteTaskAttachment(EXAMPLE_TASK_ID, NON_EXISTING_ID);
given().pathParam("id", EXAMPLE_TASK_ID).pathParam("attachmentId", NON_EXISTING_ID).header("accept", MediaType.APPLICATION_JSON).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON).body(containsString("Deletion is not possible. No attachment exists for task id '" + EXAMPLE_TASK_ID + "' and attachment id '" + NON_EXISTING_ID + "'.")).when().delete(SINGLE_TASK_DELETE_SINGLE_ATTACHMENT_URL);
}
Aggregations