use of org.hibernate.testing.orm.junit.ExpectedException in project hibernate-orm by hibernate.
the class AbstractPathImplTest method testGetNonExistingAttributeViaName.
@ExpectedException(value = IllegalArgumentException.class)
@Test
public void testGetNonExistingAttributeViaName() {
EntityManager em = getOrCreateEntityManager();
try {
CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<Order> criteria = criteriaBuilder.createQuery(Order.class);
Root<Order> orderRoot = criteria.from(Order.class);
orderRoot.get("nonExistingAttribute");
} finally {
em.close();
}
}
Aggregations