HHH-11573 - Fix non-deterministic result ordering & test validation.

This commit is contained in:
Chris Cranford 2018-05-14 13:43:27 -04:00 committed by Chris Cranford
parent 8d7562a314
commit a408fa4597
1 changed files with 2 additions and 0 deletions

View File

@ -104,6 +104,7 @@ public class EntityTypeQueryTest extends BaseEnversJPAFunctionalTestCase {
List<?> list = getAuditReader().createQuery().forEntitiesAtRevision( EntityA.class, 1 ) List<?> list = getAuditReader().createQuery().forEntitiesAtRevision( EntityA.class, 1 )
.add( AuditEntity.entityType( EntityB.class ) ) .add( AuditEntity.entityType( EntityB.class ) )
.addProjection( AuditEntity.property( "name" ) ) .addProjection( AuditEntity.property( "name" ) )
.addOrder( AuditEntity.property( "name" ).asc() )
.getResultList(); .getResultList();
assertEquals( "Expected only entities of type EntityB to be selected", list( "b1", "b2" ), list ); assertEquals( "Expected only entities of type EntityB to be selected", list( "b1", "b2" ), list );
} }
@ -113,6 +114,7 @@ public class EntityTypeQueryTest extends BaseEnversJPAFunctionalTestCase {
List<?> list = getAuditReader().createQuery().forEntitiesAtRevision( EntityA.class, 1 ) List<?> list = getAuditReader().createQuery().forEntitiesAtRevision( EntityA.class, 1 )
.add( AuditEntity.entityType( EntityA.class ) ) .add( AuditEntity.entityType( EntityA.class ) )
.addProjection( AuditEntity.property( "name" ) ) .addProjection( AuditEntity.property( "name" ) )
.addOrder( AuditEntity.property( "name" ).asc() )
.getResultList(); .getResultList();
assertEquals( "Expected only entities of type EntityA to be selected", list( "a1", "a2" ), list ); assertEquals( "Expected only entities of type EntityA to be selected", list( "a1", "a2" ), list );
} }