|
8 | 8 | import org.hibernate.boot.registry.StandardServiceRegistry; |
9 | 9 | import org.hibernate.boot.registry.StandardServiceRegistryBuilder; |
10 | 10 | import org.hibernate.boot.spi.MetadataImplementor; |
11 | | -import org.hibernate.mapping.PersistentClass; |
12 | | -import org.hibernate.mapping.Property; |
13 | 11 | import org.hibernate.testing.orm.junit.BaseUnitTest; |
14 | 12 | import org.hibernate.testing.util.ServiceRegistryUtil; |
15 | 13 | import org.hibernate.type.BasicType; |
16 | | -import org.hibernate.type.BasicTypeReference; |
17 | 14 | import org.hibernate.type.StandardBasicTypes; |
18 | 15 | import org.junit.jupiter.api.AfterAll; |
19 | 16 | import org.junit.jupiter.api.BeforeAll; |
@@ -49,26 +46,28 @@ public void tearDown() { |
49 | 46 | } |
50 | 47 |
|
51 | 48 | @Test |
52 | | - public void testTimestampSourceIsVM() throws Exception { |
53 | | - assertTimestampSource( VMTimestamped.class, StandardBasicTypes.TIMESTAMP ); |
| 49 | + public void testTimestampSourceIsVM() { |
| 50 | + assertTimestampSource( VMTimestamped.class ); |
54 | 51 | } |
55 | 52 |
|
56 | 53 | @Test |
57 | | - public void testTimestampSourceIsDB() throws Exception { |
58 | | - assertTimestampSource( DBTimestamped.class, StandardBasicTypes.TIMESTAMP ); |
| 54 | + public void testTimestampSourceIsDB() { |
| 55 | + assertTimestampSource( DBTimestamped.class ); |
59 | 56 | } |
60 | 57 |
|
61 | | - private void assertTimestampSource(Class<?> clazz, BasicTypeReference<?> typeReference) throws Exception { |
62 | | - assertTimestampSource( clazz, metadata.getTypeConfiguration().getBasicTypeRegistry().resolve( typeReference ) ); |
| 58 | + private void assertTimestampSource(Class<?> clazz ) { |
| 59 | + assertTimestampSource( clazz, |
| 60 | + metadata.getTypeConfiguration().getBasicTypeRegistry() |
| 61 | + .resolve( StandardBasicTypes.TIMESTAMP ) ); |
63 | 62 | } |
64 | 63 |
|
65 | | - private void assertTimestampSource(Class<?> clazz, BasicType<?> basicType) throws Exception { |
66 | | - PersistentClass persistentClass = metadata.getEntityBinding( clazz.getName() ); |
| 64 | + private void assertTimestampSource(Class<?> clazz, BasicType<?> basicType) { |
| 65 | + var persistentClass = metadata.getEntityBinding( clazz.getName() ); |
67 | 66 | assertThat( persistentClass ).isNotNull(); |
68 | | - Property versionProperty = persistentClass.getVersion(); |
| 67 | + var versionProperty = persistentClass.getVersion(); |
69 | 68 | assertThat( versionProperty ).isNotNull(); |
70 | | - assertThat( versionProperty.getType() ) |
| 69 | + assertThat( versionProperty.getType().getName() ) |
71 | 70 | .describedAs( "Wrong timestamp type" ) |
72 | | - .isEqualTo( basicType ); |
| 71 | + .isEqualTo( basicType.getName() ); |
73 | 72 | } |
74 | 73 | } |
0 commit comments