Transactional { public Transactional<O> onComplete(Listener listener) { this.onCommit(listener); this.onRollback(listener); return this; } Transactional(EntityManager entityManager); Transactional<O> wrap(Action<O> action); Transactional<O> onCommit(Listener listener); Transactional<O> onRollback(Listener listener); Transactional<O> onComplete(Listener listener); Transactional<O> commitIf(Validator<O> validator); Transactional<O> rollbackIf(Validator<O> validator); Transactional<O> commitOnException(); Transactional<O> allowExistingTransactions(); O execute(Object... args);  }
@Test public void testSetMultipleOnCompleteListeners() throws Exception { Transactional transactional = this.buildTransactional(); transactional.onComplete(status -> { }); transactional.onComplete(status -> { }); }
@Test public void testSetSameOnCompleteListenerRepeatedly() throws Exception { Transactional transactional = this.buildTransactional(); Transactional.Listener listener = status -> { }; transactional.onComplete(listener); transactional.onComplete(listener); }
@Test public void testCannotSetNullCompleteListener() { Transactional transactional = this.buildTransactional(); assertThrows(IllegalArgumentException.class, () -> transactional.onComplete(null)); }