42
42
import org .hibernate .type .descriptor .java .OffsetTimeJavaType ;
43
43
import org .hibernate .type .descriptor .java .ZonedDateTimeJavaType ;
44
44
45
+ import org .hibernate .testing .orm .junit .DomainModel ;
46
+ import org .hibernate .testing .orm .junit .SessionFactory ;
47
+ import org .hibernate .testing .orm .junit .SessionFactoryScope ;
45
48
import org .junit .jupiter .api .Assertions ;
46
49
import org .junit .jupiter .api .Test ;
47
50
48
51
import static org .junit .jupiter .api .Assertions .assertInstanceOf ;
49
52
import static org .junit .jupiter .api .Assertions .assertThrows ;
50
53
54
+ @ DomainModel
55
+ @ SessionFactory
51
56
public class DateSubclassesUnwrapTest {
52
-
53
- private static final WrapperOptions wrapperOptions = new WrapperOptions () {
54
- @ Override
55
- public SharedSessionContractImplementor getSession () {
56
- return null ;
57
- }
58
-
59
- @ Override
60
- public SessionFactoryImplementor getSessionFactory () {
61
- return null ;
62
- }
63
-
64
- public boolean useStreamForLobBinding () {
65
- return false ;
66
- }
67
-
68
- @ Override
69
- public int getPreferredSqlTypeCodeForBoolean () {
70
- return 0 ;
71
- }
72
-
73
- public LobCreator getLobCreator () {
74
- return NonContextualLobCreator .INSTANCE ;
75
- }
76
-
77
- @ Override
78
- public TimeZone getJdbcTimeZone () {
79
- return null ;
80
- }
81
-
82
- private final Dialect dialect = new H2Dialect () {
83
- @ Override
84
- public boolean useConnectionToCreateLob () {
85
- return false ;
86
- }
87
- };
88
-
89
- @ Override
90
- public Dialect getDialect () {
91
- return dialect ;
92
- }
93
- };
94
-
95
57
@ Test
96
- void testJdbcTimestampJavaType () {
58
+ void testJdbcTimestampJavaType (SessionFactoryScope scope ) {
59
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
97
60
final JdbcTimestampJavaType javaType = JdbcTimestampJavaType .INSTANCE ;
98
61
final Date date = new Date ();
99
62
@@ -104,7 +67,8 @@ void testJdbcTimestampJavaType() {
104
67
}
105
68
106
69
@ Test
107
- void testJdbcDateJavaType () {
70
+ void testJdbcDateJavaType (SessionFactoryScope scope ) {
71
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
108
72
final JdbcDateJavaType javaType = JdbcDateJavaType .INSTANCE ;
109
73
final Date date = new Date ();
110
74
@@ -115,7 +79,8 @@ void testJdbcDateJavaType() {
115
79
}
116
80
117
81
@ Test
118
- void testJdbcTimeJavaType () {
82
+ void testJdbcTimeJavaType (SessionFactoryScope scope ) {
83
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
119
84
final JdbcTimeJavaType javaType = JdbcTimeJavaType .INSTANCE ;
120
85
final Date date = new Date ();
121
86
@@ -129,7 +94,8 @@ void testJdbcTimeJavaType() {
129
94
}
130
95
131
96
@ Test
132
- void testDateJavaType () {
97
+ void testDateJavaType (SessionFactoryScope scope ) {
98
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
133
99
final DateJavaType javaType = DateJavaType .INSTANCE ;
134
100
final Date date = new Date ();
135
101
@@ -140,7 +106,8 @@ void testDateJavaType() {
140
106
}
141
107
142
108
@ Test
143
- void testInstantJavaType () {
109
+ void testInstantJavaType (SessionFactoryScope scope ) {
110
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
144
111
final InstantJavaType javaType = InstantJavaType .INSTANCE ;
145
112
final Instant instant = Instant .now ();
146
113
@@ -151,7 +118,8 @@ void testInstantJavaType() {
151
118
}
152
119
153
120
@ Test
154
- void testLocalDateJavaType () {
121
+ void testLocalDateJavaType (SessionFactoryScope scope ) {
122
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
155
123
final LocalDateJavaType javaType = LocalDateJavaType .INSTANCE ;
156
124
final LocalDate date = LocalDate .now ();
157
125
@@ -162,7 +130,8 @@ void testLocalDateJavaType() {
162
130
}
163
131
164
132
@ Test
165
- void testLocalDateTimeJavaType () {
133
+ void testLocalDateTimeJavaType (SessionFactoryScope scope ) {
134
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
166
135
final LocalDateTimeJavaType javaType = LocalDateTimeJavaType .INSTANCE ;
167
136
final LocalDateTime dateTime = LocalDateTime .now ();
168
137
@@ -173,7 +142,8 @@ void testLocalDateTimeJavaType() {
173
142
}
174
143
175
144
@ Test
176
- void testLocalTimeJavaType () {
145
+ void testLocalTimeJavaType (SessionFactoryScope scope ) {
146
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
177
147
final LocalTimeJavaType javaType = LocalTimeJavaType .INSTANCE ;
178
148
final LocalTime time = LocalTime .now ();
179
149
@@ -184,7 +154,8 @@ void testLocalTimeJavaType() {
184
154
}
185
155
186
156
@ Test
187
- void testOffsetDateTimeJavaType () {
157
+ void testOffsetDateTimeJavaType (SessionFactoryScope scope ) {
158
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
188
159
final OffsetDateTimeJavaType javaType = OffsetDateTimeJavaType .INSTANCE ;
189
160
final OffsetDateTime dateTime = OffsetDateTime .now ();
190
161
@@ -195,7 +166,8 @@ void testOffsetDateTimeJavaType() {
195
166
}
196
167
197
168
@ Test
198
- void testOffsetTimeJavaType () {
169
+ void testOffsetTimeJavaType (SessionFactoryScope scope ) {
170
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
199
171
final OffsetTimeJavaType javaType = OffsetTimeJavaType .INSTANCE ;
200
172
final OffsetTime time = OffsetTime .now ();
201
173
@@ -207,7 +179,8 @@ void testOffsetTimeJavaType() {
207
179
}
208
180
209
181
@ Test
210
- void testZonedDateTimeJavaType () {
182
+ void testZonedDateTimeJavaType (SessionFactoryScope scope ) {
183
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
211
184
final ZonedDateTimeJavaType javaType = ZonedDateTimeJavaType .INSTANCE ;
212
185
final ZonedDateTime dateTime = ZonedDateTime .now ();
213
186
@@ -218,7 +191,8 @@ void testZonedDateTimeJavaType() {
218
191
}
219
192
220
193
@ Test
221
- void testCalendarDateJavaType () {
194
+ void testCalendarDateJavaType (SessionFactoryScope scope ) {
195
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
222
196
final CalendarDateJavaType javaType = CalendarDateJavaType .INSTANCE ;
223
197
final Calendar calendar = Calendar .getInstance ();
224
198
@@ -229,7 +203,8 @@ void testCalendarDateJavaType() {
229
203
}
230
204
231
205
@ Test
232
- void testCalendarJavaType () {
206
+ void testCalendarJavaType (SessionFactoryScope scope ) {
207
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
233
208
final CalendarJavaType javaType = CalendarJavaType .INSTANCE ;
234
209
final Calendar calendar = Calendar .getInstance ();
235
210
@@ -240,7 +215,8 @@ void testCalendarJavaType() {
240
215
}
241
216
242
217
@ Test
243
- void testCalendarTimeJavaType () {
218
+ void testCalendarTimeJavaType (SessionFactoryScope scope ) {
219
+ final WrapperOptions wrapperOptions = scope .getSessionFactory ().getWrapperOptions ();
244
220
final CalendarTimeJavaType javaType = CalendarTimeJavaType .INSTANCE ;
245
221
final Calendar calendar = Calendar .getInstance ();
246
222
0 commit comments