Skip to content

Commit

Permalink
Merge pull request #36802 from yrodiere/fix-orm-5.6-timezone
Browse files Browse the repository at this point in the history
Fix assertions in Hibernate ORM 5.6 compatibility tests
  • Loading branch information
rsvoboda authored Oct 31, 2023
2 parents e6423a4 + bedb7b1 commit 72e99a3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public int run(String... args) {
checkEqual(createdEntity.duration, loadedEntity.duration);
checkEqual(createdEntity.uuid, loadedEntity.uuid);
checkEqual(createdEntity.instant, loadedEntity.instant);
checkEqual(createdEntity.offsetTime.withOffsetSameInstant(ZoneId.systemDefault().getRules().getOffset(Instant.now())),
checkEqual(createdEntity.offsetTime.toLocalTime().atOffset(ZoneId.systemDefault().getRules().getOffset(Instant.now())),
loadedEntity.offsetTime);
checkEqual(createdEntity.offsetDateTime.atZoneSameInstant(ZoneId.systemDefault()).toOffsetDateTime(),
loadedEntity.offsetDateTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ public void instant() {
public void offsetTime() {
assertThat(findOld().offsetTime)
.isEqualTo(LocalTime.of(12, 58, 30, 0)
.atOffset(ZoneOffset.ofHours(2))
// Hibernate ORM 5 used to normalize these values to the JVM TZ
.withOffsetSameInstant(ZoneId.systemDefault().getRules().getOffset(Instant.now())));
.atOffset(ZoneId.systemDefault().getRules().getOffset(Instant.now())));
}

// https://github.com/hibernate/hibernate-orm/blob/6.2/migration-guide.adoc#timezone-and-offset-storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ public void instant() {
public void offsetTime() {
assertThat(findOld().offsetTime)
.isEqualTo(LocalTime.of(12, 58, 30, 0)
.atOffset(ZoneOffset.ofHours(2))
// Hibernate ORM 5 used to normalize these values to the JVM TZ
.withOffsetSameInstant(ZoneId.systemDefault().getRules().getOffset(Instant.now())));
.atOffset(ZoneId.systemDefault().getRules().getOffset(Instant.now())));
}

// https://github.com/hibernate/hibernate-orm/blob/6.2/migration-guide.adoc#timezone-and-offset-storage
Expand Down

0 comments on commit 72e99a3

Please sign in to comment.