use of org.neo4j.kernel.impl.coreapi.TransactionImpl in project neo4j by neo4j.
the class TransactionImplTest method shouldThrowTransientExceptionOnTransientKernelException.
@Test
void shouldThrowTransientExceptionOnTransientKernelException() throws Exception {
// GIVEN
KernelTransaction kernelTransaction = mock(KernelTransaction.class);
when(kernelTransaction.isOpen()).thenReturn(true);
doThrow(new TransactionFailureException(Status.Transaction.ConstraintsChanged, "Proving that transaction does the right thing")).when(kernelTransaction).close();
TransactionImpl transaction = new TransactionImpl(tokenHolders, contextFactory, availabilityGuard, engine, kernelTransaction, null, null);
// WHEN
transaction.commit();
}
use of org.neo4j.kernel.impl.coreapi.TransactionImpl in project neo4j by neo4j.
the class TransactionImplTest method checkForIAE.
private void checkForIAE(Consumer<Transaction> consumer, String message) {
KernelTransaction kernelTransaction = mock(KernelTransaction.class);
when(kernelTransaction.tokenRead()).thenReturn(mock(TokenRead.class));
try (TransactionImpl tx = new TransactionImpl(tokenHolders, contextFactory, availabilityGuard, engine, kernelTransaction, null, null)) {
assertThatThrownBy(() -> consumer.accept(tx)).isInstanceOf(IllegalArgumentException.class).hasMessageContaining(message);
}
}
Aggregations