LoadingRunnable implements Runnable { public synchronized void setFilter(Optional<AcceptCondition> acceptCondition) { filteringLogDataCollector.setAcceptCondition(acceptCondition); } LoadingRunnable(Source source, LogImporter logImporter, LogDataCollector logDataCollector, long sleepTime, Optional<Long> bufferingTime, StatsService statsService);  LoadingRunnable(Source source, LogImporter logImporter, LogDataCollector logDataCollector, long sleepTime, Optional<Long> bufferingTime, Optional<AcceptCondition> withAcceptCondition, StatsService statsService); @Override void run(); synchronized LoadStatistic getLoadStatistic(); synchronized void pause(); synchronized void resume(); synchronized void stop(); synchronized void setFilter(Optional<AcceptCondition> acceptCondition);  }
@Test(invocationCount = 5) public void testLoadingWithFilterSetDuringLoadWithLogParser() throws IOException { saveLines(Range.closed(0, 1000), julSimpleLogLines, outputStream); underTest = createLoadingRunnable(getJulLogParser()); executorService.submit(underTest); await().until(() -> collector.getCount() == 500); underTest.setFilter(Optional.of(acceptCondition99)); saveLines(Range.closed(1000, julSimpleLogLines.size()), julSimpleLogLines, outputStream); await().until(() -> collector.getCount() == 505); }