diff --git a/src/test/java/org/springframework/data/aerospike/core/sync/AerospikeTemplateSaveWithDuplicatesTests.java b/src/test/java/org/springframework/data/aerospike/core/sync/AerospikeTemplateSaveWithDuplicatesTests.java index 32616697..ed46c80a 100644 --- a/src/test/java/org/springframework/data/aerospike/core/sync/AerospikeTemplateSaveWithDuplicatesTests.java +++ b/src/test/java/org/springframework/data/aerospike/core/sync/AerospikeTemplateSaveWithDuplicatesTests.java @@ -57,7 +57,12 @@ public void shouldSaveAllVersionedDocumentsAndSetVersionAndThrowExceptionIfDupli assertThat(second.getVersion()).isSameAs(0); // An attempt to save the same versioned documents in one batch results in getting an exception - assertThatThrownBy(() -> template.saveAll(List.of(first, first, second, second))) + assertThatThrownBy(() -> template.saveAll(List.of(first, first))) + .isInstanceOf(OptimisticLockingFailureException.class) + .hasMessageFindingMatch("Failed to save the record with ID .* due to versions mismatch"); + + // An attempt to save the same versioned documents in one batch results in getting an exception + assertThatThrownBy(() -> template.saveAll(List.of(second, second))) .isInstanceOf(OptimisticLockingFailureException.class) .hasMessageFindingMatch("Failed to save the record with ID .* due to versions mismatch");