List<Long> IDList = new ArrayList<Long>();
try(Stream<TransactionEntity> retailRecordStram = retailRepository.streamAllShareRecords(currentDateTime.substring(0, 6) +"18")){
RecordCount = 0;
retailRecordStram.forEach(LambdaExceptionUtil.rethrowConsumer(Entity -> {
String Record = ReportUtil.generateRecord(Entity);
FileWriter.println(Record);
IDList.add(Entity.getRetailTransactionID());//fecting the records and adding in list
RecordCount++;
}));
FileWriter.flush();
有必要为流编写junit和mockito