HHH-17975 add testcase for retrieving revision by an Instant

This commit is contained in:
Florian Heck 2024-04-18 16:56:09 +02:00 committed by Christian Beikov
parent e8f743993f
commit 42eadbc93b
1 changed files with 16 additions and 0 deletions

View File

@ -121,4 +121,20 @@ public class RevisionForDate extends BaseEnversJPAFunctionalTestCase {
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp4 ) ) ).getTime() <= timestamp4;
}
@Test
@SkipForDialect(value = CockroachDialect.class, comment = "Fails because of int size")
public void testRevisionsForInstant() {
AuditReader vr = getAuditReader();
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp2 ).toInstant() ) ).getTime() <= timestamp2;
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp2 ).toInstant() ).intValue() + 1 )
.getTime() > timestamp2;
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp3 ).toInstant() ) ).getTime() <= timestamp3;
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp3 ).toInstant() ).intValue() + 1 )
.getTime() > timestamp3;
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp4 ).toInstant() ) ).getTime() <= timestamp4;
}
}