HHH-12802 : Fix test case to recover from exception properly

(cherry picked from commit 9202a5a11d)
This commit is contained in:
Gail Badner 2018-07-13 15:51:39 -07:00
parent fc25c0fc01
commit 4dcd460669
1 changed files with 11 additions and 11 deletions

View File

@ -57,18 +57,18 @@ public class NonUniqueIdTest extends BaseNonConfigCoreFunctionalTestCase {
@Test
@TestForIssue( jiraKey = "HHH-12802" )
public void testLoadEntityWithNonUniqueId() {
doInHibernate(
this::sessionFactory,
session -> {
try {
session.get( Category.class, 1 );
fail( "should have failed because there are 2 entities with id == 1" );
try {
doInHibernate(
this::sessionFactory,
session -> {
session.get( Category.class, 1 );
fail( "should have failed because there are 2 entities with id == 1" );
}
catch ( HibernateException ex) {
// expected
}
}
);
);
}
catch ( HibernateException ex) {
// expected
}
}
@Entity