@Test
public void testSetupOk() throws Exception {
doInTransaction(new InTransaction() {
@Override
public void process(EntityManager entityManager) throws Exception {
TestEntity entity = (TestEntity) entityManager.createQuery(
"from TestEntity where name='Test'").getSingleResult();
assertNotNull(entity);
assertEquals("Test", entity.getName());
assertEquals("descr", entity.getDescription());
}
});
swapClasses();
doInTransaction(new InTransaction() {
@Override
public void process(EntityManager entityManager) throws Exception {
TestEntity entity = (TestEntity) entityManager.createQuery(
"from TestEntity where name='Test'").getSingleResult();
assertNotNull(entity);
assertEquals("Test", entity.getName());
assertNull(entity.getDescription());
}
});
}