use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class HistoricBatchRestServiceInteractionTest method deleteNonExistingHistoricBatch.
@Test
public void deleteNonExistingHistoricBatch() {
String nonExistingId = MockProvider.NON_EXISTING_ID;
doThrow(new BadUserRequestException("Historic batch for id '" + nonExistingId + "' cannot be found")).when(historyServiceMock).deleteHistoricBatch(eq(nonExistingId));
given().pathParam("id", nonExistingId).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo("Unable to delete historic batch with id '" + nonExistingId + "'")).when().delete(HISTORIC_SINGLE_BATCH_RESOURCE_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testCompleteThrowsBadUserRequestException.
@Test
public void testCompleteThrowsBadUserRequestException() {
doThrow(new BadUserRequestException("aMessage")).when(externalTaskService).complete(any(String.class), any(String.class), anyMapOf(String.class, Object.class), anyMapOf(String.class, Object.class));
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("workerId", "aWorkerId");
given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).pathParam("id", "anExternalTaskId").then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("type", equalTo(RestException.class.getSimpleName())).body("message", equalTo("aMessage")).when().post(COMPLETE_EXTERNAL_TASK_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testHandleBpmnErrorThrowsBadUserRequestException.
@Test
public void testHandleBpmnErrorThrowsBadUserRequestException() {
doThrow(new BadUserRequestException("aMessage")).when(externalTaskService).handleBpmnError(any(String.class), any(String.class), any(String.class));
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("workerId", "aWorkerId");
parameters.put("errorCode", "errorCode");
given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).pathParam("id", "anExternalTaskId").then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("type", equalTo(RestException.class.getSimpleName())).body("message", equalTo("aMessage")).when().post(HANDLE_EXTERNAL_TASK_BPMN_ERROR_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class BatchRestServiceInteractionTest method suspendNonExistingBatch.
@Test
public void suspendNonExistingBatch() {
String nonExistingId = MockProvider.NON_EXISTING_ID;
doThrow(new BadUserRequestException("Batch for id '" + nonExistingId + "' cannot be found")).when(managementServiceMock).suspendBatchById(eq(nonExistingId));
given().pathParam("id", nonExistingId).contentType(ContentType.JSON).body(singletonMap("suspended", true)).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo("Unable to suspend batch with id '" + nonExistingId + "'")).when().put(SUSPENDED_BATCH_RESOURCE_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class BatchRestServiceInteractionTest method deleteNonExistingBatch.
@Test
public void deleteNonExistingBatch() {
String nonExistingId = MockProvider.NON_EXISTING_ID;
doThrow(new BadUserRequestException("Batch for id '" + nonExistingId + "' cannot be found")).when(managementServiceMock).deleteBatch(eq(nonExistingId), eq(false));
given().pathParam("id", nonExistingId).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo("Unable to delete batch with id '" + nonExistingId + "'")).when().delete(SINGLE_BATCH_RESOURCE_URL);
}
Aggregations