### Question:
MongoRoleDao extends MongoDao<Role, String> implements RoleDao { @Override public Role findByName(String name) { return query().field("name").equal(name).get(); } @Inject  MongoRoleDao(Datastore datastore); @Override List<Role> findAll(); @Override Role findByName(String name);  }### Answer:
@Test public void findRoleByName() { Role validRole = roleDao.findByName("First Role"); assertNotNull("The returned role should not be null with valid query values", validRole); Role invalidRole = roleDao.findByName("Invalid Role"); assertNull("The returned role should be null with invalid query values", invalidRole); }