Search in sources :

Example 6 with JobSuspensionStateDto

use of org.camunda.bpm.engine.rest.dto.runtime.JobSuspensionStateDto in project camunda-bpm-platform by camunda.

the class JobRestServiceInteractionTest method testSuspendThrowsAuthorizationException.

@Test
public void testSuspendThrowsAuthorizationException() {
    JobSuspensionStateDto dto = new JobSuspensionStateDto();
    dto.setSuspended(true);
    String expectedMessage = "expectedMessage";
    doThrow(new AuthorizationException(expectedMessage)).when(mockSuspensionStateBuilder).suspend();
    given().pathParam("id", MockProvider.EXAMPLE_JOB_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", is(AuthorizationException.class.getSimpleName())).body("message", is(expectedMessage)).when().put(SINGLE_JOB_SUSPENDED_URL);
}
Also used : AuthorizationException(org.camunda.bpm.engine.AuthorizationException) Matchers.anyString(org.mockito.Matchers.anyString) JobSuspensionStateDto(org.camunda.bpm.engine.rest.dto.runtime.JobSuspensionStateDto) Test(org.junit.Test)

Aggregations

JobSuspensionStateDto (org.camunda.bpm.engine.rest.dto.runtime.JobSuspensionStateDto)6 Test (org.junit.Test)6 Matchers.anyString (org.mockito.Matchers.anyString)4 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2