@Test public void findUserByEmail() { User validUser = userDao.findByEmail("john.smith@email.com"); assertNotNull("The returned user should not be null with valid query values", validUser); User invalidUser = userDao.findByEmail("jane.smith@email.com"); assertNull("The returned user should be null with invalid query values", invalidUser); }
@Override public User findByEmail(String email) { return query().field("email").equal(email).get(); }
MongoUserDao extends MongoDao<User, String> implements UserDao { @Override public User findByEmail(String email) { return query().field("email").equal(email).get(); } }
MongoUserDao extends MongoDao<User, String> implements UserDao { @Override public User findByEmail(String email) { return query().field("email").equal(email).get(); } @Inject  MongoUserDao(Datastore datastore); }
MongoUserDao extends MongoDao<User, String> implements UserDao { @Override public User findByEmail(String email) { return query().field("email").equal(email).get(); } @Inject  MongoUserDao(Datastore datastore); @Override List<User> findAll(); @Override User findByUsername(String username); @Override User findByEmail(String email); }
MongoUserDao extends MongoDao<User, String> implements UserDao { @Override public User findByEmail(String email) { return query().field("email").equal(email).get(); } @Inject  MongoUserDao(Datastore datastore); @Override List<User> findAll(); @Override User findByUsername(String username); @Override User findByEmail(String email);  }