### Question:
QuotationFixer { public List<Optional<List<QuotationUnit>>> checkCounterSplit(List<Stock> loadShares, double deltaUnit) { List<Optional<List<QuotationUnit>>> collected = loadShares.stream().map(stock -> { List<QuotationUnit> collect = null; try { Quotations quotations = QuotationsFactories.getFactory().getRawQuotationsInstance(stock, DateFactory.dateAtZero(), new Date(), true, Currency.NAN, 0, ValidityFilter.CLOSE); collect = IntStream .range(1, quotations.size()) .mapToObj(i -> { QuotationUnit qIm1 = quotations.get(i-1); QuotationUnit qI = quotations.get(i); SplitData counterSplitData = Quotations.calculateSplit(qI.getDate(), qI.getCloseRaw().doubleValue(), qIm1.getDate(), qIm1.getCloseRaw().doubleValue()); double counterSplit = counterSplitData.getSplit(); List<QuotationUnit> adjacents = new ArrayList<>(); if ( counterSplit > 1 ) { int iPrim = i; while(iPrim < quotations.size() && (counterSplit > 1)) { adjacents.add(quotations.get(iPrim)); iPrim++; } } return adjacents; }) .flatMap(adj -> adj.stream()) .distinct() .collect(Collectors.toList()); if (!collect.isEmpty()) LOGGER.warn("Anti split detected qU for " + stock + " :\n" + collect.stream().map(qU -> qU.toString()).reduce((r, e) -> r + "\n" + e).orElse("None")); } catch (NoQuotationsException e) { LOGGER.warn(e); } catch (Exception e) { LOGGER.error(e); } return Optional.ofNullable(collect); }) .collect(Collectors.toList()); LOGGER.info("Affected stocks: " + collected.stream().filter(qL -> qL.isPresent() && qL.get().size() > 0).count() + " out of " + loadShares.size()); String counterSplitedStocks = collected.stream() .flatMap(qL -> (qL.isPresent())?qL.get().stream():Stream.empty()) .map(qU -> qU.getStock().toString()) .distinct() .reduce((r, e) -> r + "\n" + e) .orElse("None"); LOGGER.info("Affected stocks: \n" + counterSplitedStocks); try (FileWriter fileWriter = new FileWriter(new File(System.getProperty("installdir") + File.separator + "tmp" + File.separator + UUID.randomUUID() + "_counterSplitedStocks.txt"))) { fileWriter.write(counterSplitedStocks+"\n"); } catch (IOException e) { LOGGER.error(e, e); } return collected; }  List<Optional<List<QuotationUnit>>> checkPennyPound(List<Stock> loadShares); void fixPennyPound(List<Stock> loadShares); List<Optional<List<QuotationUnit>>> checkCounterSplit(List<Stock> loadShares, double deltaUnit); List<Optional<List<QuotationUnit>>> checkCounterSplitFailFast(List<Stock> loadShares, double deltaUnit); @Deprecated //This won't work? <= instead we exclude these from calculations void fixCounterSplit(List<Stock> loadShares);  }### Answer:
@Test public void testCheckCounterSplit() { List<Stock> loadShares = ((PortfolioDAO) springContext.getBean("portfolioDAO")).loadPortfolioSharesExUnknown().stream().map(ps -> ps.getStock()).collect(Collectors.toList()); currencyFixer.checkCounterSplitFailFast(loadShares, 0.5); }