Search in sources :

Example 1 with TooManyPartitionsException

use of org.zalando.nakadi.exceptions.runtime.TooManyPartitionsException in project nakadi by zalando.

the class PostSubscriptionControllerTest method whenMoreThanAllowedEventTypeThenUnprocessableEntity.

@Test
public void whenMoreThanAllowedEventTypeThenUnprocessableEntity() throws Exception {
    when(subscriptionService.getExistingSubscription(any())).thenThrow(new NoSubscriptionException("", null));
    when(subscriptionService.createSubscription(any())).thenThrow(new TooManyPartitionsException("msg"));
    final SubscriptionBase subscriptionBase = builder().buildSubscriptionBase();
    final Problem expectedProblem = Problem.valueOf(UNPROCESSABLE_ENTITY, "msg");
    checkForProblem(postSubscription(subscriptionBase), expectedProblem);
}
Also used : SubscriptionBase(org.zalando.nakadi.domain.SubscriptionBase) TooManyPartitionsException(org.zalando.nakadi.exceptions.runtime.TooManyPartitionsException) NoSubscriptionException(org.zalando.nakadi.exceptions.runtime.NoSubscriptionException) Problem(org.zalando.problem.Problem) TestUtils.invalidProblem(org.zalando.nakadi.utils.TestUtils.invalidProblem) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 SubscriptionBase (org.zalando.nakadi.domain.SubscriptionBase)1 NoSubscriptionException (org.zalando.nakadi.exceptions.runtime.NoSubscriptionException)1 TooManyPartitionsException (org.zalando.nakadi.exceptions.runtime.TooManyPartitionsException)1 TestUtils.invalidProblem (org.zalando.nakadi.utils.TestUtils.invalidProblem)1 Problem (org.zalando.problem.Problem)1