DATACMNS-35 - Added implementation and test for newly introduced Repository.delete(ID id) method.
This commit is contained in:
@@ -98,6 +98,17 @@ public interface JpaRepository<T, ID extends Serializable> extends
|
||||
long count();
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.data.repository.Repository#delete(java.io.Serializable
|
||||
* )
|
||||
*/
|
||||
@Transactional
|
||||
public void delete(ID id);
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -112,6 +112,19 @@ public class SimpleJpaRepository<T, ID extends Serializable> implements
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.data.jpa.repository.JpaRepository#delete(java.io.
|
||||
* Serializable)
|
||||
*/
|
||||
public void delete(ID id) {
|
||||
|
||||
delete(findOne(id));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -187,6 +187,16 @@ public class UserRepositoryTests {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void deletesAUserById() {
|
||||
|
||||
flushTestUsers();
|
||||
|
||||
repository.delete(firstUser.getId());
|
||||
assertNull(repository.findOne(firstUser.getId()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests deleting a user.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user