use of org.zalando.nakadi.service.CursorOperationsService in project nakadi by zalando.
the class PartitionsControllerTest method before.
@Before
public void before() throws InternalNakadiException, NoSuchEventTypeException {
eventTypeRepositoryMock = mock(EventTypeRepository.class);
topicRepositoryMock = mock(TopicRepository.class);
eventTypeCache = mock(EventTypeCache.class);
timelineService = Mockito.mock(TimelineService.class);
cursorOperationsService = Mockito.mock(CursorOperationsService.class);
when(timelineService.getActiveTimelinesOrdered(eq(UNKNOWN_EVENT_TYPE))).thenThrow(NoSuchEventTypeException.class);
when(timelineService.getActiveTimelinesOrdered(eq(TEST_EVENT_TYPE))).thenReturn(Collections.singletonList(TIMELINE));
when(timelineService.getAllTimelinesOrdered(eq(TEST_EVENT_TYPE))).thenReturn(Collections.singletonList(TIMELINE));
when(timelineService.getTopicRepository((Timeline) any())).thenReturn(topicRepositoryMock);
final CursorConverter cursorConverter = new CursorConverterImpl(eventTypeCache, timelineService);
final PartitionsController controller = new PartitionsController(timelineService, cursorConverter, cursorOperationsService, eventTypeRepositoryMock, authorizationValidator);
settings = mock(SecuritySettings.class);
final FeatureToggleService featureToggleService = Mockito.mock(FeatureToggleService.class);
mockMvc = standaloneSetup(controller).setMessageConverters(new StringHttpMessageConverter(), TestUtils.JACKSON_2_HTTP_MESSAGE_CONVERTER).setCustomArgumentResolvers(new ClientResolver(settings, featureToggleService)).setControllerAdvice(new ExceptionHandling()).build();
}
Aggregations