use of com.palantir.atlasdb.transaction.api.TransactionFailedNonRetriableException in project atlasdb by palantir.
the class SnapshotTransactionTest method runWithRetryFailsOnNonRetriableException.
@Test
public void runWithRetryFailsOnNonRetriableException() {
PreCommitCondition nonRetriableFailure = new PreCommitCondition() {
@Override
public void throwIfConditionInvalid(long timestamp) {
throw new TransactionFailedNonRetriableException("Condition failed");
}
@Override
public void cleanup() {
}
};
Supplier<PreCommitCondition> conditionSupplier = Suppliers.ofInstance(nonRetriableFailure);
try {
serializableTxManager.runTaskWithConditionWithRetry(conditionSupplier, (tx, condition) -> {
tx.put(TABLE, ImmutableMap.of(TEST_CELL, PtBytes.toBytes("value")));
return null;
});
fail();
} catch (TransactionFailedNonRetriableException e) {
assertThat(e.getMessage(), containsString("Condition failed"));
}
}
Aggregations