use of org.springframework.cloud.gcp.data.firestore.FirestoreTemplate in project spring-cloud-gcp by spring-cloud.
the class ReactiveFirestoreTransactionManagerTest method triggerRollbackCorrectly.
@Test
public void triggerRollbackCorrectly() {
FirestoreTemplate template = getFirestoreTemplate();
ReactiveFirestoreTransactionManager txManager = new ReactiveFirestoreTransactionManager(this.firestoreStub, this.parent);
TransactionalOperator operator = TransactionalOperator.create(txManager);
template.findById(Mono.defer(() -> {
throw new FirestoreDataException("BOOM!");
}), FirestoreTemplateTests.TestEntity.class).as(operator::transactional).as(StepVerifier::create).expectError().verify();
verify(this.firestoreStub, times(1)).beginTransaction(any(), any());
verify(this.firestoreStub, times(0)).commit(any(), any());
verify(this.firestoreStub, times(1)).rollback(any(), any());
}
Aggregations