use of com.palantir.atlasdb.transaction.api.LockAwareTransactionManager in project atlasdb by palantir.
the class SweeperTestSetup method mockTxManager.
public static LockAwareTransactionManager mockTxManager() {
LockAwareTransactionManager txManager = mock(LockAwareTransactionManager.class);
Answer runTaskAnswer = inv -> {
Object[] args = inv.getArguments();
TransactionTask<?, ?> task = (TransactionTask<?, ?>) args[0];
return task.execute(mock(Transaction.class));
};
doAnswer(runTaskAnswer).when(txManager).runTaskReadOnly(any());
doAnswer(runTaskAnswer).when(txManager).runTaskWithRetry(any());
return txManager;
}
Aggregations