HeaderParserObject { public String getFilterName() { if (isLoggedIn()) { return mHeader.select("form#filter-quick-form").first() .select("option[selected]").first().text(); } else { String filter = mHeader.select("a[href=\"/filters\"]").text(); Matcher m = PATTERN_FILTER_NAME.matcher(filter); m.find(); return m.group(1); } } HeaderParserObject(Document doc); boolean isLoggedIn(); String getFilterName(); String getAvatarUrl();  }
@Test public void testFilterName() { assertThat(loggedInBox.getFilterName(), is("Some Long Filter Name")); assertThat(loggedOutBox.getFilterName(), is("Some Long Filter Name")); }