UnitOfWork implements TransactionalSession<Transaction> { public static void end() { currentWork().doEnd(); } private  UnitOfWork(final UnitOfWork parent, final TransactionalStore<?> store, final Scope scope); static void begin(final Supplier<? extends TransactionalSession<?>> db); static void beginBatch(final Supplier<? extends TransactionalSession<?>> db); static void beginBatch(final TransactionalSession<?> session); static void end(); @SuppressWarnings("unchecked") static S currentSession(); @SuppressWarnings("unchecked") static T currentTx(); @Nullable static UnitOfWork pause(); static void resume(@Nullable final UnitOfWork pausedWork); @Override Transaction getTransaction(); @Override void close();  }
@Test(expected = IllegalStateException.class) public void testCannotEndNoWork() { UnitOfWork.end(); }