@Test public void entityExists() { assertTrue("Exists should return true for an entity with a valid ID", mongoDao.exists(mockedEntity.getId())); assertFalse("Exists should return false for an entity with a invalid ID", mongoDao.exists("id-should-not-exist")); }
@Override public boolean exists(ID id) { return datastore.get(persistentClass, id) != null; }
MongoDao implements GenericDao<T, ID> { @Override public boolean exists(ID id) { return datastore.get(persistentClass, id) != null; } }
MongoDao implements GenericDao<T, ID> { @Override public boolean exists(ID id) { return datastore.get(persistentClass, id) != null; } @Inject  MongoDao(Datastore datastore, Class<T> persistentClass); }
MongoDao implements GenericDao<T, ID> { @Override public boolean exists(ID id) { return datastore.get(persistentClass, id) != null; } @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 boolean exists(ID id) { return datastore.get(persistentClass, id) != null; } @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();  }