TextUtils { public static Set<String> readStopwordsInputStream(InputStream inputStream, boolean lowercase) { return readStream(new BufferedReader(new InputStreamReader(inputStream)).lines(), lowercase); }  static Set<String> readStopwordsFile(File file, boolean lowercase); static Set<String> readStopwordsFile(String location, boolean lowercase); static Set<String> readStopwordsInputStream(InputStream inputStream, boolean lowercase); static Set<String> readStopwordsPath(Path path, boolean lowercase); static Set<String> readStopwordsURL(URL url, boolean lowercase);  }
@Test public void testReadStopwordsInputStream() throws Exception { InputStream stopwordsFile = Files.newInputStream(new File(STOPWORDS_LOCATION).toPath()); Set<String> stopwords = TextUtils.readStopwordsInputStream(stopwordsFile, false); assertEquals(EXPECTED_STOPWORDS, stopwords); }