@Test public void test1() { TrackFilter f = null; String q = "a b, c"; String t = "b a"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + true +")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, true , f.test(t)); q = "\"a b\", c"; t = "b a"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + false + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, false , f.test(t)); q = "\"a b\" c"; t = "c a b"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + true + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, true , f.test(t)); q = "\"a b\" c"; t = "d a b"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + false + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, false , f.test(t)); q = "\"a, b\" c"; t = "a b c"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + false + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, false , f.test(t)); q = "\"a, b\" c"; t = "a, b c"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + true + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, true , f.test(t)); q = "#a"; t = "a"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + false + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, false , f.test(t)); q = "a"; t = "#a"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + true + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, true , f.test(t)); q = "aa bb"; t = "naa bbm"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + false + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, false , f.test(t)); q = "naa bbm"; t = "naa bbm"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + true + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, true , f.test(t)); q = "a,b"; t = "#a#b"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + false + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, false , f.test(t)); q = "a,b"; t = "#a##b"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + false + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, false , f.test(t)); q = "a,b"; t = "#a #b"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + true + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, true , f.test(t)); q = "a b"; t = "#a #b"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + true + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, true , f.test(t)); q = "a,b"; t = "#a ##b"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + true + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, true , f.test(t)); q = "a,b"; t = "##a ##b"; f = new TrackFilter(q); System.out.println("Comparing q = " + q + " with t = " + t + ": result = " + f.test(t) + " (" + false + ")"); assertEquals("Failed on test with <q> = " + q + " <t> = " + t, false , f.test(t)); }
@Override public boolean test(JsonObject t) { if (null == toTrack) return true; String tweetText = t.get("text").toString(); if (null == tweetText) { return false; } boolean result = hasKeyWords(tweetText); return result; }
TrackFilter implements Predicate<JsonObject> { @Override public boolean test(JsonObject t) { if (null == toTrack) return true; String tweetText = t.get("text").toString(); if (null == tweetText) { return false; } boolean result = hasKeyWords(tweetText); return result; } }
TrackFilter implements Predicate<JsonObject> { @Override public boolean test(JsonObject t) { if (null == toTrack) return true; String tweetText = t.get("text").toString(); if (null == tweetText) { return false; } boolean result = hasKeyWords(tweetText); return result; } TrackFilter();  TrackFilter(CollectionTask task);  TrackFilter(String keywords); }
TrackFilter implements Predicate<JsonObject> { @Override public boolean test(JsonObject t) { if (null == toTrack) return true; String tweetText = t.get("text").toString(); if (null == tweetText) { return false; } boolean result = hasKeyWords(tweetText); return result; } TrackFilter();  TrackFilter(CollectionTask task);  TrackFilter(String keywords); String[] getToTrack(); void setToTrack(final String keywords); @Override boolean test(JsonObject t); boolean test(String text); static void main(String args[]); @Override String getFilterName(); }
TrackFilter implements Predicate<JsonObject> { @Override public boolean test(JsonObject t) { if (null == toTrack) return true; String tweetText = t.get("text").toString(); if (null == tweetText) { return false; } boolean result = hasKeyWords(tweetText); return result; } TrackFilter();  TrackFilter(CollectionTask task);  TrackFilter(String keywords); String[] getToTrack(); void setToTrack(final String keywords); @Override boolean test(JsonObject t); boolean test(String text); static void main(String args[]); @Override String getFilterName();  }