Search in sources :

Example 41 with NotFoundException

use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.

the class TaskRestServiceInteractionTest method testGetDeployedTaskFormWithUnexistingForm.

@Test
public void testGetDeployedTaskFormWithUnexistingForm() {
    String message = "not found";
    when(formServiceMock.getDeployedTaskForm(anyString())).thenThrow(new NotFoundException(message));
    given().pathParam("id", MockProvider.EXAMPLE_TASK_ID).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).body("message", equalTo(message)).when().get(DEPLOYED_TASK_FORM_URL);
}
Also used : NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 42 with NotFoundException

use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.

the class DecisionDefinitionRestServiceInteractionTest method testEvaluateDecision_NotFound.

@Test
public void testEvaluateDecision_NotFound() {
    String message = "expected message";
    when(decisionEvaluationBuilderMock.evaluate()).thenThrow(new NotFoundException(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.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON).body("type", is(InvalidRequestException.class.getSimpleName())).body("message", containsString(message)).when().post(EVALUATE_DECISION_URL);
}
Also used : HashMap(java.util.HashMap) FileNotFoundException(java.io.FileNotFoundException) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 43 with NotFoundException

use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.

the class DeploymentRestServiceInteractionTest method testRedeployThrowsNotFoundException.

@Test
public void testRedeployThrowsNotFoundException() {
    String message = "deployment not found";
    doThrow(new NotFoundException(message)).when(mockDeploymentBuilder).deployWithResult();
    String expected = "Cannot redeploy deployment '" + MockProvider.EXAMPLE_DEPLOYMENT_ID + "': " + message;
    given().pathParam("id", MockProvider.EXAMPLE_DEPLOYMENT_ID).contentType(POST_JSON_CONTENT_TYPE).expect().statusCode(Status.NOT_FOUND.getStatusCode()).body("type", is(InvalidRequestException.class.getSimpleName())).body("message", is(expected)).when().post(REDEPLOY_DEPLOYMENT_URL);
}
Also used : NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) Matchers.anyString(org.mockito.Matchers.anyString) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 44 with NotFoundException

use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.

the class JobDefinitionRestServiceInteractionTest method testResetNonExistingJobDefinitionPriority.

@Test
public void testResetNonExistingJobDefinitionPriority() {
    String expectedMessage = "expected exception message";
    doThrow(new NotFoundException(expectedMessage)).when(mockManagementService).clearOverridingJobPriorityForJobDefinition(MockProvider.NON_EXISTING_JOB_DEFINITION_ID);
    Map<String, Object> priorityJson = new HashMap<String, Object>();
    priorityJson.put("priority", null);
    given().pathParam("id", MockProvider.NON_EXISTING_JOB_DEFINITION_ID).contentType(ContentType.JSON).body(priorityJson).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo(expectedMessage)).when().put(JOB_DEFINITION_PRIORITY_URL);
}
Also used : HashMap(java.util.HashMap) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)44 Test (org.junit.Test)20 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)17 NotValidException (org.camunda.bpm.engine.exception.NotValidException)17 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)17 RestException (org.camunda.bpm.engine.rest.exception.RestException)17 Matchers.anyString (org.mockito.Matchers.anyString)15 HashMap (java.util.HashMap)11 CaseService (org.camunda.bpm.engine.CaseService)9 NotAllowedException (org.camunda.bpm.engine.exception.NotAllowedException)9 CaseExecutionCommandBuilder (org.camunda.bpm.engine.runtime.CaseExecutionCommandBuilder)8 InputStream (java.io.InputStream)4 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 RepositoryService (org.camunda.bpm.engine.RepositoryService)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 FileNotFoundException (java.io.FileNotFoundException)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2