Search in sources :

Example 1 with NullValueException

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

the class JobRestServiceInteractionTest method deleteNotExistingJob.

@Test
public void deleteNotExistingJob() {
    String jobId = MockProvider.NON_EXISTING_JOB_ID;
    String expectedMessage = "No job found with id '" + jobId + "'.";
    doThrow(new NullValueException(expectedMessage)).when(mockManagementService).deleteJob(jobId);
    given().pathParam("id", jobId).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo(expectedMessage)).when().delete(SINGLE_JOB_RESOURCE_URL);
    verify(mockManagementService).deleteJob(jobId);
    verifyNoMoreInteractions(mockManagementService);
}
Also used : InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) Matchers.anyString(org.mockito.Matchers.anyString) NullValueException(org.camunda.bpm.engine.exception.NullValueException) Test(org.junit.Test)

Example 2 with NullValueException

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

the class ProcessInstanceQueryTest method testQueryByInvalidSuperCaseInstanceId.

@Test
public void testQueryByInvalidSuperCaseInstanceId() {
    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
    assertNull(query.superProcessInstanceId("invalid").singleResult());
    assertEquals(0, query.superProcessInstanceId("invalid").list().size());
    try {
        query.superCaseInstanceId(null);
        fail();
    } catch (NullValueException e) {
    // expected
    }
}
Also used : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) NullValueException(org.camunda.bpm.engine.exception.NullValueException) Test(org.junit.Test)

Example 3 with NullValueException

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

the class ProcessInstanceQueryTest method testQueryByInvalidSubCaseInstanceId.

@Test
public void testQueryByInvalidSubCaseInstanceId() {
    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
    assertNull(query.subProcessInstanceId("invalid").singleResult());
    assertEquals(0, query.subProcessInstanceId("invalid").list().size());
    try {
        query.subCaseInstanceId(null);
        fail();
    } catch (NullValueException e) {
    // expected
    }
}
Also used : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) NullValueException(org.camunda.bpm.engine.exception.NullValueException) Test(org.junit.Test)

Example 4 with NullValueException

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

the class RuntimeServiceTest method testGetInvalidTransitionInstancesForActivity.

@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testGetTransitionInstancesForActivity.bpmn20.xml")
@Test
public void testGetInvalidTransitionInstancesForActivity() {
    ProcessInstance instance = runtimeService.startProcessInstanceByKey("miSubprocess");
    ActivityInstance tree = runtimeService.getActivityInstance(instance.getId());
    try {
        tree.getTransitionInstances(null);
        fail("exception expected");
    } catch (NullValueException e) {
    // happy path
    }
}
Also used : ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) NullValueException(org.camunda.bpm.engine.exception.NullValueException) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 5 with NullValueException

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

the class HistoricDecisionInstanceStatisticsQueryTest method testStatisticForRootDecisionWithNullInstanceConstraintEvaluation.

@Test
public void testStatisticForRootDecisionWithNullInstanceConstraintEvaluation() throws Exception {
    // when
    decisionService.evaluateDecisionTableByKey(DISH_DECISION).variables(Variables.createVariables().putValue(TEMPERATURE, 21).putValue(DAY_TYPE, WEEKEND)).evaluate();
    DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
    // when
    HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId()).decisionInstanceId(null);
    // then
    try {
        query.count();
    } catch (NullValueException e) {
    // expected
    }
    try {
        query.list();
    } catch (NullValueException e) {
    // expected
    }
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery) NullValueException(org.camunda.bpm.engine.exception.NullValueException) Test(org.junit.Test)

Aggregations

NullValueException (org.camunda.bpm.engine.exception.NullValueException)18 Test (org.junit.Test)7 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)3 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)3 Deployment (org.camunda.bpm.engine.test.Deployment)3 Date (java.util.Date)2 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)2 Batch (org.camunda.bpm.engine.batch.Batch)2 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)2 CompositeDbHistoryEventHandler (org.camunda.bpm.engine.impl.history.handler.CompositeDbHistoryEventHandler)2 CompositeHistoryEventHandler (org.camunda.bpm.engine.impl.history.handler.CompositeHistoryEventHandler)2 HistoryEventHandler (org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler)2 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)2 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)2 Matchers.anyString (org.mockito.Matchers.anyString)2 HashMap (java.util.HashMap)1 FilterService (org.camunda.bpm.engine.FilterService)1 ProcessEngineConfiguration (org.camunda.bpm.engine.ProcessEngineConfiguration)1 TaskService (org.camunda.bpm.engine.TaskService)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1