### Question:
MongoTopologyDao extends MongoDao<Topology, String> implements TopologyDao { @Override public List<Topology> findAll(String userId) { return query().field("userId").equal(userId).order("name").asList(); } @Inject  MongoTopologyDao(Datastore datastore); @Override boolean exists(String id, String userId); @Override List<Topology> findAll(String userId); @Override Topology findById(String id, String userId); @Override Topology findByName(String name, String userId); @Override Topology save(Topology topology, String userId); @Override Topology update(Topology topology, String userId); @Override void delete(Topology topology, String userId); @Override void deleteById(String id, String userId);  }### Answer:
@Test public void findAllTopologiesForUser() { List<Topology> topologies = topologyDao.findAll("user1"); assertEquals("There should be 2 topologies for the user", 2, topologies.size()); assertEquals("The first item in the topology list should have and id of \"first\"", "first", topologies.get(0).getId()); assertEquals("The second item in the topology list should have and id of \"third\"", "third", topologies.get(1).getId()); }
@Test public void findAllTopologiesForAnonymous() { List<Topology> topologies = topologyDao.findAll(null); assertEquals("There should be 1 topologies for the anonymous user", 1, topologies.size()); assertEquals("The only item in the topology list should have and id of \"fourth\"", "fourth", topologies.get(0).getId()); }