+ static class Builder {
+ private Class<?> expCanCommitType;
+ private Class<?> expCommitType;
+ private Class<?> expAbortType;
+ private Object canCommitReply;
+ private Object commitReply;
+ private Object abortReply;
+ private final TransactionIdentifier transactionId;
+
+ Builder(final TransactionIdentifier transactionId) {
+ this.transactionId = requireNonNull(transactionId);
+ }
+
+ Builder expectCanCommit(final Class<?> newExpCanCommitType, final Object newCanCommitReply) {
+ expCanCommitType = newExpCanCommitType;
+ canCommitReply = newCanCommitReply;
+ return this;
+ }
+
+ Builder expectCanCommit(final Object newCanCommitReply) {
+ return expectCanCommit(CanCommitTransaction.class, newCanCommitReply);
+ }
+
+ Builder expectCommit(final Class<?> newExpCommitType, final Object newCommitReply) {
+ expCommitType = newExpCommitType;
+ commitReply = newCommitReply;
+ return this;
+ }
+
+ Builder expectCommit(final Object newCommitReply) {
+ return expectCommit(CommitTransaction.class, newCommitReply);
+ }
+
+ Builder expectAbort(final Class<?> newExpAbortType, final Object newAbortReply) {
+ expAbortType = newExpAbortType;
+ abortReply = newAbortReply;
+ return this;
+ }
+
+ Builder expectAbort(final Object newAbortReply) {
+ return expectAbort(AbortTransaction.class, newAbortReply);
+ }
+
+ Props props() {
+ return Props.create(CohortActor.class, this);
+ }
+ }