FilterWritable implements Writable { @Override public boolean equals(Object obj) { if (getClass() != obj.getClass()) { return false; } Filter other = ((FilterWritable) obj).getFilter(); return _filter.equals(other); } FilterWritable();  FilterWritable(Filter filter); @Override void readFields(DataInput input); @Override void write(DataOutput output); Filter getFilter(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testSerializeFilter() throws Exception { TermQuery termQuery = new TermQuery(new Term("katta")); QueryWrapperFilter filter = new QueryWrapperFilter(termQuery); FilterWritable writable = new FilterWritable(filter); DataOutputBuffer buffer = writeWritable(writable); FilterWritable writable2 = new FilterWritable(); readWritable(buffer, writable2); assertTrue(writable.equals(writable2)); }