### Question:
QueryTermFilter { public BytesRefHash getTerms(String field) { BytesRefHash existing = termsHash.get(field); if (existing != null) return existing; return new BytesRefHash(); } QueryTermFilter(IndexReader reader); BytesRefHash getTerms(String field);  }### Answer:
@Test public void testFiltersAreRemoved() throws IOException { QueryIndex qi = new QueryIndex(); qi.commit(indexable("1", "term")); assertThat(qi.termFilters).hasSize(1); qi.commit(indexable("2", "term2")); assertThat(qi.termFilters).hasSize(1); QueryTermFilter tf = Iterables.getFirst(qi.termFilters.values(), null); assertThat(tf).isNotNull(); assertThat(tf.getTerms(FIELD).size()).isEqualTo(2); }