Skip to content

Commit e459eb2

Browse files
fheckbeikov
authored andcommitted
HHH-17975 add testcase for retrieving revision by an Instant
1 parent ac49021 commit e459eb2

File tree

1 file changed

+16
-0
lines changed
  • hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/revfordate

1 file changed

+16
-0
lines changed

hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/revfordate/RevisionForDate.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,20 @@ public void testRevisionsForDates() {
121121

122122
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp4 ) ) ).getTime() <= timestamp4;
123123
}
124+
125+
@Test
126+
@SkipForDialect(value = CockroachDialect.class, comment = "Fails because of int size")
127+
public void testRevisionsForInstant() {
128+
AuditReader vr = getAuditReader();
129+
130+
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp2 ).toInstant() ) ).getTime() <= timestamp2;
131+
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp2 ).toInstant() ).intValue() + 1 )
132+
.getTime() > timestamp2;
133+
134+
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp3 ).toInstant() ) ).getTime() <= timestamp3;
135+
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp3 ).toInstant() ).intValue() + 1 )
136+
.getTime() > timestamp3;
137+
138+
assert vr.getRevisionDate( vr.getRevisionNumberForDate( new Date( timestamp4 ).toInstant() ) ).getTime() <= timestamp4;
139+
}
124140
}

0 commit comments

Comments
 (0)