use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testUnclaimTaskThrowsAuthorizationException.
@Test
public void testUnclaimTaskThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(taskServiceMock).setAssignee(anyString(), anyString());
given().pathParam("id", EXAMPLE_TASK_ID).header("accept", MediaType.APPLICATION_JSON).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().post(UNCLAIM_TASK_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testSetAssigneeThrowsAuthorizationException.
@Test
public void testSetAssigneeThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(taskServiceMock).setAssignee(anyString(), anyString());
given().pathParam("id", EXAMPLE_TASK_ID).contentType(POST_JSON_CONTENT_TYPE).body(EMPTY_JSON_OBJECT).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().post(ASSIGNEE_TASK_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TenantRestServiceInteractionTest method saveTenantThrowsAuthorizationException.
@Test
public void saveTenantThrowsAuthorizationException() {
Tenant newTenant = MockProvider.createMockTenant();
when(identityServiceMock.newTenant(MockProvider.EXAMPLE_TENANT_ID)).thenReturn(newTenant);
String message = "exception expected";
doThrow(new AuthorizationException(message)).when(identityServiceMock).saveTenant(newTenant);
given().body(TenantDto.fromTenant(newTenant)).contentType(ContentType.JSON).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().post(TENANT_CREATE_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TenantRestServiceInteractionTest method createTenantUserMembershipThrowsAuthorizationException.
@Test
public void createTenantUserMembershipThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(identityServiceMock).createTenantUserMembership(MockProvider.EXAMPLE_TENANT_ID, MockProvider.EXAMPLE_USER_ID);
given().pathParam("id", MockProvider.EXAMPLE_TENANT_ID).pathParam("userId", MockProvider.EXAMPLE_USER_ID).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().put(TENANT_USER_MEMBER_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TenantRestServiceInteractionTest method updateTenantThrowsAuthorizationException.
@Test
public void updateTenantThrowsAuthorizationException() {
Tenant updatedTenant = MockProvider.createMockTenant();
when(updatedTenant.getName()).thenReturn("updatedName");
String message = "exception expected";
doThrow(new AuthorizationException(message)).when(identityServiceMock).saveTenant(any(Tenant.class));
given().pathParam("id", MockProvider.EXAMPLE_TENANT_ID).body(TenantDto.fromTenant(updatedTenant)).contentType(ContentType.JSON).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().put(TENANT_URL);
}
Aggregations