|
37 | 37 |
|
38 | 38 | import org.junit.jupiter.api.BeforeEach;
|
39 | 39 | import org.junit.jupiter.api.Test;
|
40 |
| -import org.springframework.dao.DataIntegrityViolationException; |
41 | 40 | import org.springframework.dao.DuplicateKeyException;
|
| 41 | +import org.springframework.dao.OptimisticLockingFailureException; |
42 | 42 | import org.springframework.data.couchbase.core.ReactiveFindByIdOperation.ReactiveFindById;
|
43 | 43 | import org.springframework.data.couchbase.core.ReactiveRemoveByIdOperation.ReactiveRemoveById;
|
44 | 44 | import org.springframework.data.couchbase.core.ReactiveReplaceByIdOperation.ReactiveReplaceById;
|
@@ -130,7 +130,7 @@ void upsertAndFindById() {
|
130 | 130 |
|
131 | 131 | User badUser = new User(user.getId(), user.getFirstname(), user.getLastname());
|
132 | 132 | badUser.setVersion(12345678);
|
133 |
| - assertThrows(DataIntegrityViolationException.class, |
| 133 | + assertThrows(OptimisticLockingFailureException.class, |
134 | 134 | () -> reactiveCouchbaseTemplate.replaceById(User.class).one(badUser).block());
|
135 | 135 |
|
136 | 136 | User found = reactiveCouchbaseTemplate.findById(User.class).one(user.getId()).block();
|
@@ -285,7 +285,7 @@ void upsertAndRemoveById() {
|
285 | 285 | // careful now - user and modified are the same object. The object has the new cas (@Version version)
|
286 | 286 | Long savedCas = modified.getVersion();
|
287 | 287 | modified.setVersion(123);
|
288 |
| - assertThrows(DataIntegrityViolationException.class, () -> reactiveCouchbaseTemplate.removeById() |
| 288 | + assertThrows(OptimisticLockingFailureException.class, () -> reactiveCouchbaseTemplate.removeById() |
289 | 289 | .withCas(reactiveCouchbaseTemplate.support().getCas(modified)).one(modified.getId()).block());
|
290 | 290 | modified.setVersion(savedCas);
|
291 | 291 | reactiveCouchbaseTemplate.removeById().withCas(reactiveCouchbaseTemplate.support().getCas(modified))
|
|
0 commit comments