test showing selecting enum value causes NPE

This commit is contained in:
Gavin King 2022-01-08 12:32:01 +01:00 committed by Steve Ebersole
parent 9e7a091d67
commit 53d38262ba
1 changed files with 16 additions and 1 deletions

View File

@ -34,7 +34,7 @@ import static org.hamcrest.Matchers.is;
*/
@SuppressWarnings({"deprecation","WeakerAccess"})
@ServiceRegistry
@DomainModel( standardModels = StandardDomainModel.GAMBIT )
@DomainModel( standardModels = {StandardDomainModel.GAMBIT, StandardDomainModel.ANIMAL} )
@SessionFactory
public class LiteralTests {
@ -265,4 +265,19 @@ public class LiteralTests {
}
);
}
@Test
public void testEnums(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
session.createQuery( "from Zoo where classification=COOL" ).getResultList();
session.createQuery( "from Zoo where classification=org.hibernate.testing.orm.domain.animal.Classification.COOL" ).getResultList();
assertThat( session.createQuery( "select org.hibernate.testing.orm.domain.animal.Classification.LAME" )
.getSingleResult(), is( org.hibernate.testing.orm.domain.animal.Classification.LAME ) );
assertThat( session.createQuery( "select org.hibernate.testing.orm.domain.gambit.EntityOfBasics$Gender.MALE" )
.getSingleResult(), is( org.hibernate.testing.orm.domain.gambit.EntityOfBasics.Gender.MALE ) );
}
);
}
}