public void assertCanBeReloadedWithSameState(final Object original) throws Exception { perform( new UnitOfWork() { public void work(Session session) throws Exception { Object loaded = session.get(original.getClass(), idOf(original)); assertThat("entity", loaded, samePersistentFieldsAs(original)); } }); }
public void persist(final Object... entities) throws Exception { for (final Object entity : entities) { perform( new UnitOfWork() { public void work(Session session) throws Exception { session.save(entity); } }); } makeSureSubsequentLoadOperationsHitTheDatabase(); }