Search in sources :

Example 6 with ResourceAuthorizationAttribute

use of org.zalando.nakadi.domain.ResourceAuthorizationAttribute in project nakadi by zalando.

the class EventTypeControllerTest method whenPostAndAuthorizationInvalidThen422.

@Test
public void whenPostAndAuthorizationInvalidThen422() throws Exception {
    final EventType eventType = buildDefaultEventType();
    eventType.setAuthorization(new ResourceAuthorization(ImmutableList.of(new ResourceAuthorizationAttribute("type1", "value1")), ImmutableList.of(new ResourceAuthorizationAttribute("type2", "value2")), ImmutableList.of(new ResourceAuthorizationAttribute("type3", "value3"))));
    doThrow(new UnableProcessException("dummy")).when(authorizationValidator).validateAuthorization(any());
    postETAndExpect422WithProblem(eventType, Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, "dummy"));
}
Also used : TestUtils.buildDefaultEventType(org.zalando.nakadi.utils.TestUtils.buildDefaultEventType) EventType(org.zalando.nakadi.domain.EventType) ResourceAuthorization(org.zalando.nakadi.domain.ResourceAuthorization) ResourceAuthorizationAttribute(org.zalando.nakadi.domain.ResourceAuthorizationAttribute) UnableProcessException(org.zalando.nakadi.exceptions.UnableProcessException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 ResourceAuthorizationAttribute (org.zalando.nakadi.domain.ResourceAuthorizationAttribute)6 EventType (org.zalando.nakadi.domain.EventType)5 ResourceAuthorization (org.zalando.nakadi.domain.ResourceAuthorization)5 TestUtils.buildDefaultEventType (org.zalando.nakadi.utils.TestUtils.buildDefaultEventType)5 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Permission (org.zalando.nakadi.domain.Permission)1 UnableProcessException (org.zalando.nakadi.exceptions.UnableProcessException)1 TestUtils.resourceAsString (org.zalando.nakadi.utils.TestUtils.resourceAsString)1