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 {
|
public class LocalTimeTest {
|
||||||
|
|
||||||
private static final LocalTime LOCAL_TIME = DateTimeUtils.adjustToDefaultPrecision(
|
private static final LocalTime LOCAL_TIME = DateTimeUtils.adjustToPrecision(
|
||||||
LocalTime.now(),
|
LocalTime.now(), 0,
|
||||||
DialectContext.getDialect()
|
DialectContext.getDialect()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ import jakarta.persistence.Table;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.hibernate.type.descriptor.DateTimeUtils.adjustToDefaultPrecision;
|
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.
|
* 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")
|
@SkipForDialect(dialectClass = AltibaseDialect.class, reason = "Altibase drivers truncate fractional seconds from the LocalTime")
|
||||||
void testLocalTime(SessionFactoryScope scope) {
|
void testLocalTime(SessionFactoryScope scope) {
|
||||||
final Dialect dialect = scope.getSessionFactory().getJdbcServices().getDialect();
|
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) -> {
|
scope.inTransaction( (session) -> {
|
||||||
final EntityWithJavaTimeValues entity = new EntityWithJavaTimeValues();
|
final EntityWithJavaTimeValues entity = new EntityWithJavaTimeValues();
|
||||||
|
|
|
@ -46,6 +46,7 @@ import jakarta.persistence.Table;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.hibernate.type.descriptor.DateTimeUtils.adjustToDefaultPrecision;
|
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.
|
* 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")
|
@SkipForDialect(dialectClass = AltibaseDialect.class, reason = "Altibase drivers truncate fractional seconds from the LocalTime")
|
||||||
void testLocalTime(SessionFactoryScope scope) {
|
void testLocalTime(SessionFactoryScope scope) {
|
||||||
final Dialect dialect = scope.getSessionFactory().getJdbcServices().getDialect();
|
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) -> {
|
scope.inTransaction( (session) -> {
|
||||||
final EntityWithJavaTimeValues entity = new EntityWithJavaTimeValues();
|
final EntityWithJavaTimeValues entity = new EntityWithJavaTimeValues();
|
||||||
|
|
|
@ -63,9 +63,9 @@ public class FractionalSecondsTests {
|
||||||
final PersistentClass entityBinding = scope.getEntityBinding( TestEntity.class );
|
final PersistentClass entityBinding = scope.getEntityBinding( TestEntity.class );
|
||||||
checkPrecision( "theInstant", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theInstant", defaultPrecision, entityBinding, domainModel );
|
||||||
checkPrecision( "theLocalDateTime", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theLocalDateTime", defaultPrecision, entityBinding, domainModel );
|
||||||
checkPrecision( "theLocalTime", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theLocalTime", 0, entityBinding, domainModel );
|
||||||
checkPrecision( "theOffsetDateTime", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theOffsetDateTime", defaultPrecision, entityBinding, domainModel );
|
||||||
checkPrecision( "theOffsetTime", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theOffsetTime", 0, entityBinding, domainModel );
|
||||||
checkPrecision( "theZonedDateTime", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theZonedDateTime", defaultPrecision, entityBinding, domainModel );
|
||||||
|
|
||||||
final PersistentClass entityBinding0 = scope.getEntityBinding( TestEntity0.class );
|
final PersistentClass entityBinding0 = scope.getEntityBinding( TestEntity0.class );
|
||||||
|
|
|
@ -65,9 +65,9 @@ public class JavaTimeFractionalSecondsTests {
|
||||||
final PersistentClass entityBinding = scope.getEntityBinding( TestEntity.class );
|
final PersistentClass entityBinding = scope.getEntityBinding( TestEntity.class );
|
||||||
checkPrecision( "theInstant", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theInstant", defaultPrecision, entityBinding, domainModel );
|
||||||
checkPrecision( "theLocalDateTime", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theLocalDateTime", defaultPrecision, entityBinding, domainModel );
|
||||||
checkPrecision( "theLocalTime", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theLocalTime", 0, entityBinding, domainModel );
|
||||||
checkPrecision( "theOffsetDateTime", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theOffsetDateTime", defaultPrecision, entityBinding, domainModel );
|
||||||
checkPrecision( "theOffsetTime", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theOffsetTime", 0, entityBinding, domainModel );
|
||||||
checkPrecision( "theZonedDateTime", defaultPrecision, entityBinding, domainModel );
|
checkPrecision( "theZonedDateTime", defaultPrecision, entityBinding, domainModel );
|
||||||
|
|
||||||
final PersistentClass entityBinding0 = scope.getEntityBinding( TestEntity0.class );
|
final PersistentClass entityBinding0 = scope.getEntityBinding( TestEntity0.class );
|
||||||
|
|
Loading…
Reference in New Issue