FeatureUtil { public static Set<String> getStopwords(String inputFile, boolean toLowerCase) throws IOException { Set<String> stopwords = new HashSet<String>(); if (inputFile != null) { URL stopUrl = ResourceUtils.resolveLocation(inputFile, null); InputStream is = stopUrl.openStream(); for (String stopword : IOUtils.readLines(is, "UTF-8")) { if (toLowerCase) { stopwords.add(stopword.toLowerCase()); } else { stopwords.add(stopword); } } } return stopwords; }  static String escapeFeatureName(String name); static Set<String> getStopwords(String inputFile, boolean toLowerCase); @SuppressWarnings("unchecked") static T createResource(Class<T> aClass, Object... aParam); @SuppressWarnings("unchecked") static T createResource(TcFeature feature);  }
@Test public void StopwordsListTest() throws Exception { Set<String> stopwords = FeatureUtil.getStopwords(stopwordFileLoc, false); assertEquals(stopwords.size(), 5); assertTrue(stopwords.contains("The")); assertTrue(stopwords.contains("I")); assertTrue(stopwords.contains("and")); assertTrue(stopwords.contains("ARE")); assertTrue(stopwords.contains("iS")); stopwords = FeatureUtil.getStopwords(stopwordFileLoc, true); assertEquals(stopwords.size(), 5); assertTrue(stopwords.contains("the")); assertTrue(stopwords.contains("i")); assertTrue(stopwords.contains("and")); assertTrue(stopwords.contains("are")); assertTrue(stopwords.contains("is")); }