DATACMNS-35 - Added implementation and test for newly introduced Repository.delete(ID id) method.

This commit is contained in:
Oliver Gierke
2011-05-11 18:37:59 +02:00
parent 12ddfcc9f9
commit d7f33774e0
2 changed files with 19 additions and 0 deletions

View File

@@ -129,6 +129,14 @@ public class SimpleMongoRepository<T, ID extends Serializable> implements Paging
return template.getCollection(entityInformation.getCollectionName()).count();
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.Repository#delete(java.io.Serializable)
*/
public void delete(ID id) {
delete(findOne(id));
}
/*
* (non-Javadoc)
*

View File

@@ -73,6 +73,17 @@ public abstract class AbstractPersonRepositoryIntegrationTests {
assertThat(result.size(), is(4));
assertThat(result, not(hasItem(dave)));
}
@Test
public void deletesPersonByIdCorrectly() {
repository.delete(dave.getId());
List<Person> result = repository.findAll();
assertThat(result.size(), is(4));
assertThat(result, not(hasItem(dave)));
}
@Test
public void findsPersonsByLastname() throws Exception {