BasicTimelineFilter implements TimelineFilter { static String normalizeHashtag(String hashtag) { if (TextUtils.isEmpty(hashtag)) { return hashtag; } final char firstChar = hashtag.charAt(0); if (firstChar == '#' || firstChar == '\uFF03' || firstChar == '$') { hashtag = hashtag.substring(1, hashtag.length()); } return hashtag; } BasicTimelineFilter(FilterValues filterValues);  BasicTimelineFilter(FilterValues filterValues, Locale locale); @Override List<Tweet> filter(List<Tweet> tweets); @Override int totalFilters();  }
@Test public void testNormalizeHashtag() { String hashtag = "#twitter"; String normalizedHashtag = BasicTimelineFilter.normalizeHashtag(hashtag); assertEquals("twitter", normalizedHashtag); hashtag = "＃twitter"; normalizedHashtag = BasicTimelineFilter.normalizeHashtag(hashtag); assertEquals("twitter", normalizedHashtag); hashtag = "$TWTR"; normalizedHashtag = BasicTimelineFilter.normalizeHashtag(hashtag); assertEquals("TWTR", normalizedHashtag); }
@Test public void testNormalizeHashtagWithoutHashtag() { final String hashtag = "TWTR"; final String normalizedHashtag = BasicTimelineFilter.normalizeHashtag(hashtag); assertEquals(hashtag, normalizedHashtag); }