use of org.zalando.problem.Problem in project nakadi by zalando.
the class PostSubscriptionControllerTest method whenEventTypesIsNullThenUnprocessableEntity.
@Test
public void whenEventTypesIsNullThenUnprocessableEntity() throws Exception {
final String subscription = "{\"owning_application\":\"app\",\"consumer_group\":\"myGroup\"}";
final Problem expectedProblem = invalidProblem("event_types", "may not be null");
checkForProblem(postSubscriptionAsJson(subscription), expectedProblem);
}
use of org.zalando.problem.Problem in project nakadi by zalando.
the class SubscriptionControllerTest method whenListSubscriptionsWithNegativeOffsetThenBadRequest.
@Test
public void whenListSubscriptionsWithNegativeOffsetThenBadRequest() throws Exception {
final Problem expectedProblem = Problem.valueOf(BAD_REQUEST, "'offset' parameter can't be lower than 0");
checkForProblem(getSubscriptions(ImmutableSet.of("et"), "app", -5, 10), expectedProblem);
}
use of org.zalando.problem.Problem in project nakadi by zalando.
the class SubscriptionControllerTest method whenListSubscriptionsWithIncorrectLimitThenBadRequest.
@Test
public void whenListSubscriptionsWithIncorrectLimitThenBadRequest() throws Exception {
final Problem expectedProblem = Problem.valueOf(BAD_REQUEST, "'limit' parameter should have value from 1 to 1000");
checkForProblem(getSubscriptions(ImmutableSet.of("et"), "app", 0, -5), expectedProblem);
}
use of org.zalando.problem.Problem in project nakadi by zalando.
the class SubscriptionControllerTest method whenListSubscriptionsAndExceptionThenServiceUnavailable.
@Test
public void whenListSubscriptionsAndExceptionThenServiceUnavailable() throws Exception {
when(subscriptionRepository.listSubscriptions(any(), any(), anyInt(), anyInt())).thenThrow(new ServiceUnavailableException("dummy message"));
final Problem expectedProblem = Problem.valueOf(SERVICE_UNAVAILABLE, "dummy message");
checkForProblem(getSubscriptions(), expectedProblem);
}
use of org.zalando.problem.Problem in project nakadi by zalando.
the class SubscriptionControllerTest method whenGetSubscriptionAndExceptionThenServiceUnavailable.
@Test
public void whenGetSubscriptionAndExceptionThenServiceUnavailable() throws Exception {
when(subscriptionRepository.getSubscription(any())).thenThrow(new ServiceUnavailableException("dummy message"));
final Problem expectedProblem = Problem.valueOf(SERVICE_UNAVAILABLE, "dummy message");
checkForProblem(getSubscription("dummyId"), expectedProblem);
}
Aggregations