HHH-7800: added unit test to demonstrate broken behavior ("between"
does not work inside an AuditDisjunction)
This commit is contained in:
parent
0118819133
commit
54760bb61e
|
@ -34,6 +34,7 @@ import org.junit.Test;
|
|||
import org.hibernate.envers.enhanced.SequenceIdRevisionEntity;
|
||||
import org.hibernate.envers.RevisionType;
|
||||
import org.hibernate.envers.query.AuditEntity;
|
||||
import org.hibernate.envers.query.criteria.AuditDisjunction;
|
||||
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
||||
import org.hibernate.envers.test.Priority;
|
||||
import org.hibernate.envers.test.entities.StrIntTestEntity;
|
||||
|
@ -325,4 +326,20 @@ public class SimpleQuery extends BaseEnversJPAFunctionalTestCase {
|
|||
List result = getAuditReader().createQuery().forEntitiesModifiedAtRevision(StrIntTestEntity.class, 5).getResultList();
|
||||
Assert.assertTrue(result.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBetweenInsideDisjunction() {
|
||||
List result = getAuditReader().createQuery()
|
||||
.forRevisionsOfEntity(StrIntTestEntity.class, true, true)
|
||||
.add(AuditEntity.disjunction()
|
||||
.add(AuditEntity.property("number").between(0, 5))
|
||||
.add(AuditEntity.property("number").between(20, 100)))
|
||||
.getResultList();
|
||||
|
||||
for (Object o : result) {
|
||||
StrIntTestEntity entity = (StrIntTestEntity)o;
|
||||
int number = entity.getNumber();
|
||||
assert ( number >= 0 && number <= 5) || ( number >= 20 && number <= 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue