@Test public void findEntityById() { TestEntity validEntity = mongoDao.findById(mockedEntity.getId()); assertEquals("The mocked entity should match the response entity with a valid ID", mockedEntity, validEntity); TestEntity invalidEntity = mongoDao.findById("id-should-not-exist"); assertNull("Response entity with an invalid ID shoudl return null", invalidEntity); }
@Override public T findById(ID id) { return datastore.get(persistentClass, id); }
MongoDao implements GenericDao<T, ID> { @Override public T findById(ID id) { return datastore.get(persistentClass, id); } }
MongoDao implements GenericDao<T, ID> { @Override public T findById(ID id) { return datastore.get(persistentClass, id); } @Inject  MongoDao(Datastore datastore, Class<T> persistentClass); }
MongoDao implements GenericDao<T, ID> { @Override public T findById(ID id) { return datastore.get(persistentClass, id); } @Inject  MongoDao(Datastore datastore, Class<T> persistentClass); @Override boolean exists(ID id); @Override List<T> findAll(); @Override T findById(ID id); @Override T save(T entity); @Override T update(T entity); @Override void delete(T entity); @Override void deleteById(ID id); Query<T> query(); }
MongoDao implements GenericDao<T, ID> { @Override public T findById(ID id) { return datastore.get(persistentClass, id); } @Inject  MongoDao(Datastore datastore, Class<T> persistentClass); @Override boolean exists(ID id); @Override List<T> findAll(); @Override T findById(ID id); @Override T save(T entity); @Override T update(T entity); @Override void delete(T entity); @Override void deleteById(ID id); Query<T> query();  }