Source:
public void init() throws Exception { final NakadiSettings nakadiSettings = new NakadiSettings(0, 0, 0, TOPIC_RETENTION_TIME_MS, 0, 60, NAKADI_POLL_TIMEOUT, NAKADI_SEND_TIMEOUT, 0, NAKADI_EVENT_MAX_BYTES, NAKADI_SUBSCRIPTION_MAX_PARTITIONS, "service", "nakadi"); final PartitionsCalculator partitionsCalculator = new KafkaConfig().createPartitionsCalculator( "t2.large", TestUtils.OBJECT_MAPPER, nakadiSettings); when(timelineService.getTopicRepository((Timeline) any())).thenReturn(topicRepository); when(timelineService.getTopicRepository((EventTypeBase) any())).thenReturn(topicRepository); when(transactionTemplate.execute(any())).thenAnswer(invocation -> { final TransactionCallback callback = (TransactionCallback) invocation.getArguments()[0]; return callback.doInTransaction(null); }); final EventTypeService eventTypeService = new EventTypeService(eventTypeRepository, timelineService, partitionResolver, enrichment, subscriptionRepository, schemaEvolutionService, partitionsCalculator, featureToggleService, authorizationValidator, timelineSync, transactionTemplate, nakadiSettings, nakadiKpiPublisher, ""); final EventTypeOptionsValidator eventTypeOptionsValidator = new EventTypeOptionsValidator(TOPIC_RETENTION_MIN_MS, TOPIC_RETENTION_MAX_MS); final EventTypeController controller = new EventTypeController(eventTypeService, featureToggleService, eventTypeOptionsValidator, applicationService, adminService); doReturn(randomUUID).when(uuid).randomUUID(); doReturn(true).when(applicationService).exists(any()); doReturn(true).when(featureToggleService).isFeatureEnabled(CHECK_PARTITIONS_KEYS); mockMvc = standaloneSetup(controller) .setMessageConverters(new StringHttpMessageConverter(), TestUtils.JACKSON_2_HTTP_MESSAGE_CONVERTER) .setCustomArgumentResolvers(new ClientResolver(settings, featureToggleService)) .setControllerAdvice(new ExceptionHandling()) .build(); }

Target:
public void init() throws Exception { final NakadiSettings nakadiSettings = new NakadiSettings(0, 0, 0, TOPIC_RETENTION_TIME_MS, 0, 60, NAKADI_POLL_TIMEOUT, NAKADI_SEND_TIMEOUT, 0, NAKADI_EVENT_MAX_BYTES, NAKADI_SUBSCRIPTION_MAX_PARTITIONS, "service", "nakadi"); final PartitionsCalculator partitionsCalculator = new KafkaConfig().createPartitionsCalculator( "t2.large", TestUtils.OBJECT_MAPPER, nakadiSettings); when(timelineService.getTopicRepository((Timeline) any())).thenReturn(topicRepository); when(timelineService.getTopicRepository((EventTypeBase) any())).thenReturn(topicRepository); when(transactionTemplate.execute(any())).thenAnswer(invocation -> { final TransactionCallback callback = (TransactionCallback) invocation.getArguments()[0]; return callback.doInTransaction(null); }); final EventTypeService eventTypeService = new EventTypeService(eventTypeRepository, timelineService, partitionResolver, enrichment, subscriptionRepository, schemaEvolutionService, partitionsCalculator, featureToggleService, authorizationValidator, timelineSync, transactionTemplate, nakadiSettings, nakadiKpiPublisher, "et-log-event-type"); final EventTypeOptionsValidator eventTypeOptionsValidator = new EventTypeOptionsValidator(TOPIC_RETENTION_MIN_MS, TOPIC_RETENTION_MAX_MS); final EventTypeController controller = new EventTypeController(eventTypeService, featureToggleService, eventTypeOptionsValidator, applicationService, adminService); doReturn(randomUUID).when(uuid).randomUUID(); doReturn(true).when(applicationService).exists(any()); doReturn(true).when(featureToggleService).isFeatureEnabled(CHECK_PARTITIONS_KEYS); mockMvc = standaloneSetup(controller) .setMessageConverters(new StringHttpMessageConverter(), TestUtils.JACKSON_2_HTTP_MESSAGE_CONVERTER) .setCustomArgumentResolvers(new ClientResolver(settings, featureToggleService)) .setControllerAdvice(new ExceptionHandling()) .build(); }