Skip to content

Commit 8edd766

Browse files
committed
changed testOffsetDateTime test to check Zone values of entity & system default
1 parent 3e4ecc0 commit 8edd766

File tree

1 file changed

+12
-3
lines changed
  • hibernate-reactive-core/src/test/java/org/hibernate/reactive

1 file changed

+12
-3
lines changed

hibernate-reactive-core/src/test/java/org/hibernate/reactive/UTCTest.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.time.LocalTime;
1111
import java.time.OffsetDateTime;
1212
import java.time.OffsetTime;
13+
import java.time.ZoneId;
1314
import java.time.ZoneOffset;
1415
import java.time.ZonedDateTime;
1516
import java.time.temporal.ChronoUnit;
@@ -115,9 +116,17 @@ public void testOffsetDateTime(TestContext context) {
115116
"offsetDateTimeType",
116117
thing::getOffsetDateTime,
117118
entity -> {
118-
context.assertEquals( entity.offsetDateTime.getOffset(), ZoneOffset.UTC );
119-
context.assertEquals( thing.offsetDateTime,
120-
entity.offsetDateTime.toInstant().atZone( zoneOffset ).toOffsetDateTime() );
119+
// ORM's OffsetDateTimeJavaDescriptor.wrap() method processes this offsetDateTime as a Timestamp
120+
// object and returns: OffsetDateTime.ofInstant( ts.toInstant(), ZoneId.systemDefault() )
121+
// The assertion below uses the systemDefault() to check that entity & default Zones are equal
122+
context.assertEquals(
123+
entity.offsetDateTime.toZonedDateTime().getZone(),
124+
OffsetDateTime.now( ZoneId.systemDefault() ).toZonedDateTime().getZone()
125+
);
126+
context.assertEquals(
127+
thing.offsetDateTime,
128+
entity.offsetDateTime.toInstant().atZone( zoneOffset ).toOffsetDateTime()
129+
);
121130
}
122131
);
123132
}

0 commit comments

Comments
 (0)