HHH-17576 fix tests to not demand that fractional seconds are stored for Times
This commit is contained in:
parent
6d64e854e2
commit
4a4c55f830
|
@ -35,8 +35,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
)
|
||||
public class LocalTimeTest {
|
||||
|
||||
private static final LocalTime LOCAL_TIME = DateTimeUtils.adjustToDefaultPrecision(
|
||||
LocalTime.now(),
|
||||
private static final LocalTime LOCAL_TIME = DateTimeUtils.adjustToPrecision(
|
||||
LocalTime.now(), 0,
|
||||
DialectContext.getDialect()
|
||||
);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ import jakarta.persistence.Table;
|
|||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hibernate.type.descriptor.DateTimeUtils.adjustToDefaultPrecision;
|
||||
import static org.hibernate.type.descriptor.DateTimeUtils.adjustToPrecision;
|
||||
|
||||
/**
|
||||
* Tests for "direct" JDBC handling of {@linkplain java.time Java Time} types.
|
||||
|
@ -177,7 +178,7 @@ public class GlobalJavaTimeJdbcTypeTests {
|
|||
@SkipForDialect(dialectClass = AltibaseDialect.class, reason = "Altibase drivers truncate fractional seconds from the LocalTime")
|
||||
void testLocalTime(SessionFactoryScope scope) {
|
||||
final Dialect dialect = scope.getSessionFactory().getJdbcServices().getDialect();
|
||||
final LocalTime startTime = adjustToDefaultPrecision( LocalTime.now(), dialect );
|
||||
final LocalTime startTime = adjustToPrecision( LocalTime.now(), 0, dialect );
|
||||
|
||||
scope.inTransaction( (session) -> {
|
||||
final EntityWithJavaTimeValues entity = new EntityWithJavaTimeValues();
|
||||
|
|
|
@ -46,6 +46,7 @@ import jakarta.persistence.Table;
|
|||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hibernate.type.descriptor.DateTimeUtils.adjustToDefaultPrecision;
|
||||
import static org.hibernate.type.descriptor.DateTimeUtils.adjustToPrecision;
|
||||
|
||||
/**
|
||||
* Tests for "direct" JDBC handling of {@linkplain java.time Java Time} types.
|
||||
|
@ -178,7 +179,7 @@ public class JavaTimeJdbcTypeTests {
|
|||
@SkipForDialect(dialectClass = AltibaseDialect.class, reason = "Altibase drivers truncate fractional seconds from the LocalTime")
|
||||
void testLocalTime(SessionFactoryScope scope) {
|
||||
final Dialect dialect = scope.getSessionFactory().getJdbcServices().getDialect();
|
||||
final LocalTime startTime = adjustToDefaultPrecision( LocalTime.now(), dialect );
|
||||
final LocalTime startTime = adjustToPrecision( LocalTime.now(), 0, dialect );
|
||||
|
||||
scope.inTransaction( (session) -> {
|
||||
final EntityWithJavaTimeValues entity = new EntityWithJavaTimeValues();
|
||||
|
|
|
@ -63,9 +63,9 @@ public class FractionalSecondsTests {
|
|||
final PersistentClass entityBinding = scope.getEntityBinding( TestEntity.class );
|
||||
checkPrecision( "theInstant", defaultPrecision, entityBinding, domainModel );
|
||||
checkPrecision( "theLocalDateTime", defaultPrecision, entityBinding, domainModel );
|
||||
checkPrecision( "theLocalTime", defaultPrecision, entityBinding, domainModel );
|
||||
checkPrecision( "theLocalTime", 0, entityBinding, domainModel );
|
||||
checkPrecision( "theOffsetDateTime", defaultPrecision, entityBinding, domainModel );
|
||||
checkPrecision( "theOffsetTime", defaultPrecision, entityBinding, domainModel );
|
||||
checkPrecision( "theOffsetTime", 0, entityBinding, domainModel );
|
||||
checkPrecision( "theZonedDateTime", defaultPrecision, entityBinding, domainModel );
|
||||
|
||||
final PersistentClass entityBinding0 = scope.getEntityBinding( TestEntity0.class );
|
||||
|
|
|
@ -65,9 +65,9 @@ public class JavaTimeFractionalSecondsTests {
|
|||
final PersistentClass entityBinding = scope.getEntityBinding( TestEntity.class );
|
||||
checkPrecision( "theInstant", defaultPrecision, entityBinding, domainModel );
|
||||
checkPrecision( "theLocalDateTime", defaultPrecision, entityBinding, domainModel );
|
||||
checkPrecision( "theLocalTime", defaultPrecision, entityBinding, domainModel );
|
||||
checkPrecision( "theLocalTime", 0, entityBinding, domainModel );
|
||||
checkPrecision( "theOffsetDateTime", defaultPrecision, entityBinding, domainModel );
|
||||
checkPrecision( "theOffsetTime", defaultPrecision, entityBinding, domainModel );
|
||||
checkPrecision( "theOffsetTime", 0, entityBinding, domainModel );
|
||||
checkPrecision( "theZonedDateTime", defaultPrecision, entityBinding, domainModel );
|
||||
|
||||
final PersistentClass entityBinding0 = scope.getEntityBinding( TestEntity0.class );
|
||||
|
|
Loading…
Reference in New Issue