### Question:
MongoDao implements GenericDao<T, ID> { @Override public T save(T entity) { Key<T> key = datastore.save(entity); return datastore.getByKey(persistentClass, key); } @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();  }### Answer:
@Test public void saveEntity() { TestEntity requestEntity = new TestEntity(); requestEntity.setId(UUID.randomUUID().toString()); TestEntity responseEntity = mongoDao.save(requestEntity); assertNotNull("A newly created entity should be returned after saving", responseEntity); assertEquals("The response and request entities should be equal", requestEntity, responseEntity); assertEquals("The datastore should have one new entity", 2, fongoRule.getDB("streamflow").getCollection("test").count()); }