### Question:
DocFreqCommand extends TableReadCommand<Long> { @Override public Long execute(IndexContext context) throws IOException { return new Long(context.getIndexReader().docFreq(new Term(fieldName, term))); } DocFreqCommand();  DocFreqCommand(String fieldName, String term); @Override Long execute(IndexContext context); @Override Long combine(CombiningContext context, Iterable<Long> results); @Override String getName(); String getFieldName(); void setFieldName(String fieldName); String getTerm(); void setValue(String term);  }### Answer:
@Test public void termInAllDocsShouldBeCorrect() throws IOException { Long returned = new DocFreqCommand("val", "val").execute(ctx); Long expected = 26l; assertEquals(expected, returned); }
@Test public void singleDocFreq() throws IOException { Long returned = new DocFreqCommand("alpha", "aa").execute(ctx); Long expected = 1l; assertEquals(expected, returned); }