DATACMNS-35 - Added implementation and test for newly introduced Repository.delete(ID id) method.
This commit is contained in:
@@ -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)
|
||||
*
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user