DefaultWorldpayCronJobSupportInformationService implements WorldpayCronJobSupportInformationService { @Override public Set<PaymentTransactionType> getPaymentTransactionType() { final OrderModificationCronJobModel exampleOrderModificationCronJobModel = new OrderModificationCronJobModel(); exampleOrderModificationCronJobModel.setActive(true); final List<OrderModificationCronJobModel> orderNotificationCronJobModels = flexibleSearchService.getModelsByExample(exampleOrderModificationCronJobModel); final Set<PaymentTransactionType> paymentTransactionTypes = new HashSet<>(); for (final OrderModificationCronJobModel orderNotificationCronJobModel : orderNotificationCronJobModels) { paymentTransactionTypes.addAll(orderNotificationCronJobModel.getPaymentTransactionTypes()); } return paymentTransactionTypes; }  @Override Set<PaymentTransactionType> getPaymentTransactionType(); @Required void setFlexibleSearchService(FlexibleSearchService flexibleSearchService);  }
@Test public void shouldReturnPaymentTypesCheckedByAllOrderModificationCronjobs() { when(flexibleSearchServiceMock.getModelsByExample(any(OrderModificationCronJobModel.class))).thenReturn(asList(orderModificationCronJobModelForAuthMock, orderModificationCronJobModelForCaptureMock)); when(orderModificationCronJobModelForAuthMock.getPaymentTransactionTypes()).thenReturn(singleton(AUTHORIZATION)); when(orderModificationCronJobModelForCaptureMock.getPaymentTransactionTypes()).thenReturn(singleton(CAPTURE)); final Set<PaymentTransactionType> result = testObj.getPaymentTransactionType(); assertCollection(result, asList(AUTHORIZATION, CAPTURE)); }