AbstractDao implements CrudDao<T, ID> { protected Iterable<T> queryByField(Object ancestorKey, String fieldName, Object fieldValue) { Iterable values = supplier.queryIterable(getCurrentTransaction(), mapper, false, 0, -1, ancestorKey, null, null, false, null, false, Filter.equalsFilter(fieldName, fieldValue)); return new MappingIterable<T, ID>(mapper, values.iterator()); } protected  AbstractDao(Mapper<T, ID> mapper, Supplier<Object, Object, Object, Object> supplier); R withCommitTransaction(TransFunc<R> transFunc); R withRollbackTransaction(TransFunc<R> transFunc); R withTransaction(TransFunc<R> transFunc, boolean commit); static R withTransaction(TransFunc<R> transFunc, boolean commit, Supplier<Object, Object, Object, Object> supplier); int count(); @Override int count(Object parentKey); void delete(ID id); @Override void delete(Object parentKey, ID id); void delete(Iterable<ID> ids); T get(ID id); @Override T get(Object parentKey, ID id); @Override ID put(Object parentKey, ID id, T entity); ID put(T entity); @Override ID insert(Object parentKey, ID id, T entity); CursorPage<T> queryPage(int requestedPageSize, String cursorString); @Override CursorPage<T> queryPage(Object ancestorKey, int requestedPageSize, String cursorString); Future<T> getAsync(Object parentKey, ID id); Future<ID> putAsync(T entity); ID getId(Object key); Object getKey(ID id); Object getKey(Object parentKey, ID id); String getKind(); void setParentKey(T entity, Object parentKey); static void setPrincipalName(String name);  }
@Test public void testQueryByField() throws IOException { createQueryFixtures(); Iterable<DUser> users = userDao.queryByDisplayName("mod7_2"); int count = 0; for (DUser u : users) { count++; assertEquals("mod7_2", u.getDisplayName()); assertEquals(2, u.getId() % 7); } assertEquals(9, count); users = userDao.queryByDisplayName(null); assertFalse(users.iterator().hasNext()); }