Fix ConfigurationTest

This commit is contained in:
Andrea Boriero 2016-04-22 21:06:56 +01:00 committed by Steve Ebersole
parent a0da5fe677
commit 34b439223e
1 changed files with 6 additions and 1 deletions

View File

@ -8,6 +8,8 @@
//$Id$ //$Id$
package org.hibernate.test.annotations; package org.hibernate.test.annotations;
import javax.persistence.PersistenceException;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.Query; import org.hibernate.Query;
import org.hibernate.Session; import org.hibernate.Session;
@ -15,9 +17,11 @@ import org.hibernate.SessionFactory;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.hql.internal.ast.QuerySyntaxException;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@ -59,7 +63,8 @@ public class ConfigurationTest {
s.createQuery( "from Boat" ).list(); s.createQuery( "from Boat" ).list();
fail( "Boat should not be mapped" ); fail( "Boat should not be mapped" );
} }
catch (HibernateException e) { catch (IllegalArgumentException e) {
assertTyping( QuerySyntaxException.class, e.getCause());
//all good //all good
} }
q = s.createQuery( "from Plane" ); q = s.createQuery( "from Plane" );