DATACMNS-800 - Add deleteAllById to CoroutineCrudRepository.

Original pull request: #476.
This commit is contained in:
Mark Paluch
2020-11-26 09:21:03 +01:00
parent ae4f0361af
commit c4d2bd5d58
2 changed files with 21 additions and 0 deletions

View File

@@ -132,6 +132,15 @@ interface CoroutineCrudRepository<T, ID> : Repository<T, ID> {
*/
suspend fun delete(entity: T)
/**
* Deletes all instances of the type `T` with the given IDs.
*
* @param ids must not be null nor contain any null values.
* @throws IllegalArgumentException in case the given [ids][Iterable] or one of its items is null.
* @since 2.5
*/
suspend fun deleteAllById(ids: Iterable<ID>)
/**
* Deletes the given entities.
*

View File

@@ -140,6 +140,18 @@ class CoroutineCrudRepositoryUnitTests {
assertThat(result).isTrue()
}
@Test // DATACMNS-800
fun shouldInvokeDeleteAllById() {
every { backingRepository.deleteAllById(listOf("foo", "bar")) } returns Mono.empty()
runBlocking {
coRepository.deleteAllById(listOf("foo", "bar"))
}
verify { backingRepository.deleteAllById(listOf("foo", "bar")) }
}
@Test // DATACMNS-1508
fun shouldInvokeDeleteAll() {