DocumentFieldsProvider implements IDataProvider<DocumentField> { @Override public long size() { return getFields().size(); } DocumentFieldsProvider(IModel<SolrDocument> documentModel, FieldFilter fieldFilter, List<String> fieldOrder); @Override Iterator<? extends DocumentField> iterator(long first, long count); @Override long size(); @Override IModel<DocumentField> model(DocumentField object); @Override void detach();  }
@Test public void testSize() { context.checking(new Expectations() { { oneOf(filter).allowField("field1"); will(returnValue(true)); oneOf(filter).allowField("field2"); will(returnValue(false)); oneOf(filter).allowField("field3"); will(returnValue(true)); oneOf(filter).allowField("field4"); will(returnValue(true)); } }); assertEquals(3, instance.size()); }