@Test public void testCreateRepository() { List<String> fileList = Arrays.asList(FILE_1, FILE_2); DiagnosRepositoryImpl repository = (DiagnosRepositoryImpl) factory.createAndInitDiagnosRepository(fileList, StandardCharsets.UTF_8); assertNotNull(repository); assertEquals(11652, repository.nbrOfDiagosis()); }
public DiagnosRepository createAndInitDiagnosRepository(List<String> filesList, Charset fileEncoding) { try { DiagnosRepositoryImpl diagnosRepository = new DiagnosRepositoryImpl(); LOG.info("Creating DiagnosRepository from {} files using encoding '{}'", filesList.size(), fileEncoding); for (String file : filesList) { populateRepoFromDiagnosisCodeFile(file, diagnosRepository, fileEncoding); } diagnosRepository.openLuceneIndexReader(); LOG.info("Created DiagnosRepository containing {} diagnoses", diagnosRepository.nbrOfDiagosis()); return diagnosRepository; } catch (IOException e) { LOG.error("Exception occured when initiating DiagnosRepository"); throw new RuntimeException("Exception occured when initiating repo", e); } }
DiagnosRepositoryFactory { public DiagnosRepository createAndInitDiagnosRepository(List<String> filesList, Charset fileEncoding) { try { DiagnosRepositoryImpl diagnosRepository = new DiagnosRepositoryImpl(); LOG.info("Creating DiagnosRepository from {} files using encoding '{}'", filesList.size(), fileEncoding); for (String file : filesList) { populateRepoFromDiagnosisCodeFile(file, diagnosRepository, fileEncoding); } diagnosRepository.openLuceneIndexReader(); LOG.info("Created DiagnosRepository containing {} diagnoses", diagnosRepository.nbrOfDiagosis()); return diagnosRepository; } catch (IOException e) { LOG.error("Exception occured when initiating DiagnosRepository"); throw new RuntimeException("Exception occured when initiating repo", e); } } }
DiagnosRepositoryFactory { public DiagnosRepository createAndInitDiagnosRepository(List<String> filesList, Charset fileEncoding) { try { DiagnosRepositoryImpl diagnosRepository = new DiagnosRepositoryImpl(); LOG.info("Creating DiagnosRepository from {} files using encoding '{}'", filesList.size(), fileEncoding); for (String file : filesList) { populateRepoFromDiagnosisCodeFile(file, diagnosRepository, fileEncoding); } diagnosRepository.openLuceneIndexReader(); LOG.info("Created DiagnosRepository containing {} diagnoses", diagnosRepository.nbrOfDiagosis()); return diagnosRepository; } catch (IOException e) { LOG.error("Exception occured when initiating DiagnosRepository"); throw new RuntimeException("Exception occured when initiating repo", e); } }  }
DiagnosRepositoryFactory { public DiagnosRepository createAndInitDiagnosRepository(List<String> filesList, Charset fileEncoding) { try { DiagnosRepositoryImpl diagnosRepository = new DiagnosRepositoryImpl(); LOG.info("Creating DiagnosRepository from {} files using encoding '{}'", filesList.size(), fileEncoding); for (String file : filesList) { populateRepoFromDiagnosisCodeFile(file, diagnosRepository, fileEncoding); } diagnosRepository.openLuceneIndexReader(); LOG.info("Created DiagnosRepository containing {} diagnoses", diagnosRepository.nbrOfDiagosis()); return diagnosRepository; } catch (IOException e) { LOG.error("Exception occured when initiating DiagnosRepository"); throw new RuntimeException("Exception occured when initiating repo", e); } }  DiagnosRepository createAndInitDiagnosRepository(List<String> filesList, Charset fileEncoding); void populateRepoFromDiagnosisCodeFile(String fileUrl, DiagnosRepositoryImpl diagnosRepository,
                                                  Charset fileEncoding); Diagnos createDiagnosFromString(String line, boolean firstLineInFile); }
DiagnosRepositoryFactory { public DiagnosRepository createAndInitDiagnosRepository(List<String> filesList, Charset fileEncoding) { try { DiagnosRepositoryImpl diagnosRepository = new DiagnosRepositoryImpl(); LOG.info("Creating DiagnosRepository from {} files using encoding '{}'", filesList.size(), fileEncoding); for (String file : filesList) { populateRepoFromDiagnosisCodeFile(file, diagnosRepository, fileEncoding); } diagnosRepository.openLuceneIndexReader(); LOG.info("Created DiagnosRepository containing {} diagnoses", diagnosRepository.nbrOfDiagosis()); return diagnosRepository; } catch (IOException e) { LOG.error("Exception occured when initiating DiagnosRepository"); throw new RuntimeException("Exception occured when initiating repo", e); } }  DiagnosRepository createAndInitDiagnosRepository(List<String> filesList, Charset fileEncoding); void populateRepoFromDiagnosisCodeFile(String fileUrl, DiagnosRepositoryImpl diagnosRepository,
                                                  Charset fileEncoding); Diagnos createDiagnosFromString(String line, boolean firstLineInFile);  }