PatternExtractor { public List<ReplacingPattern> getPatternsFromFileList(String filepar) throws MailetException, IOException { ImmutableList.Builder<ReplacingPattern> patternList = ImmutableList.builder(); for (String file : Splitter.on(",").split(filepar)) { FileNameWithCharset fileNameWithCharset = FileNameWithCharset.from(file); Optional<? extends InputStream> inputStream = retrieveInputStream(fileNameWithCharset.getFileName()); if (inputStream.isPresent()) { patternList.addAll(getPatternsFromStream(inputStream.get(), fileNameWithCharset.getCharset())); } } return patternList.build(); }  List<ReplacingPattern> getPatternsFromString(String pattern); List<ReplacingPattern> getPatternsFromFileList(String filepar);  }
@Test void getPatternsFromFileListShouldReturnValuesWhenMultiplePatterns() throws Exception { List<ReplacingPattern> patternsFromFileList = testee.getPatternsFromFileList("#/org/apache/james/mailet/standard/mailets/replaceSubject.patterns"); assertThat(patternsFromFileList).containsOnly( new ReplacingPattern(Pattern.compile("re:[ ]*"), false, "Re: "), new ReplacingPattern(Pattern.compile("ri:[ ]*"), false, "Re: "), new ReplacingPattern(Pattern.compile("r:[ ]*"), false, "Re: ")); }