19
19
20
20
package org .apache .cayenne .access .types ;
21
21
22
- import java .sql .SQLException ;
23
- import java .time .Duration ;
24
- import java .time .LocalDate ;
25
- import java .time .LocalDateTime ;
26
- import java .time .LocalTime ;
27
- import java .time .Period ;
28
- import java .time .temporal .ChronoField ;
29
- import java .time .temporal .TemporalField ;
30
-
31
22
import org .apache .cayenne .access .DataContext ;
32
23
import org .apache .cayenne .di .Inject ;
33
24
import org .apache .cayenne .query .ObjectSelect ;
34
25
import org .apache .cayenne .test .jdbc .DBHelper ;
35
- import org .apache .cayenne .testdo .java8 .DurationTestEntity ;
36
- import org .apache .cayenne .testdo .java8 .LocalDateTestEntity ;
37
- import org .apache .cayenne .testdo .java8 .LocalDateTimeTestEntity ;
38
- import org .apache .cayenne .testdo .java8 .LocalTimeTestEntity ;
39
- import org .apache .cayenne .testdo .java8 .PeriodTestEntity ;
26
+ import org .apache .cayenne .testdo .datetime .DurationTestEntity ;
27
+ import org .apache .cayenne .testdo .datetime .LocalDateTestEntity ;
28
+ import org .apache .cayenne .testdo .datetime .LocalDateTimeTestEntity ;
29
+ import org .apache .cayenne .testdo .datetime .LocalTimeTestEntity ;
30
+ import org .apache .cayenne .testdo .datetime .PeriodTestEntity ;
40
31
import org .apache .cayenne .unit .UnitDbAdapter ;
41
32
import org .apache .cayenne .unit .di .runtime .CayenneProjects ;
42
33
import org .apache .cayenne .unit .di .runtime .RuntimeCase ;
43
34
import org .apache .cayenne .unit .di .runtime .UseCayenneRuntime ;
44
35
import org .junit .Before ;
45
36
import org .junit .Test ;
46
37
47
- import static org .junit .Assert .assertEquals ;
48
- import static org .junit .Assert .assertNotNull ;
49
- import static org .junit .Assert .assertNull ;
38
+ import java .sql .SQLException ;
39
+ import java .time .Duration ;
40
+ import java .time .LocalDate ;
41
+ import java .time .LocalDateTime ;
42
+ import java .time .LocalTime ;
43
+ import java .time .Period ;
44
+ import java .time .temporal .ChronoField ;
45
+ import java .time .temporal .TemporalField ;
46
+
47
+ import static org .junit .Assert .*;
50
48
51
- @ UseCayenneRuntime (CayenneProjects .JAVA8 )
52
- public class Java8TimeIT extends RuntimeCase {
49
+ @ UseCayenneRuntime (CayenneProjects .DATE_TIME_PROJECT )
50
+ public class DateTimeIT extends RuntimeCase {
53
51
54
52
@ Inject
55
53
private DataContext context ;
@@ -70,7 +68,7 @@ public void before() throws SQLException {
70
68
}
71
69
72
70
@ Test
73
- public void testJava8LocalDate_Null () {
71
+ public void testLocalDate_Null () {
74
72
LocalDateTestEntity localDateTestEntity = context .newObject (LocalDateTestEntity .class );
75
73
localDateTestEntity .setDate (null );
76
74
@@ -82,7 +80,7 @@ public void testJava8LocalDate_Null() {
82
80
}
83
81
84
82
@ Test
85
- public void testJava8LocalDate () {
83
+ public void testLocalDate () {
86
84
LocalDateTestEntity localDateTestEntity = context .newObject (LocalDateTestEntity .class );
87
85
LocalDate localDate = LocalDate .now ();
88
86
localDateTestEntity .setDate (localDate );
@@ -97,7 +95,7 @@ public void testJava8LocalDate() {
97
95
}
98
96
99
97
@ Test
100
- public void testJava8LocalTime () {
98
+ public void testLocalTime () {
101
99
LocalTimeTestEntity localTimeTestEntity = context .newObject (LocalTimeTestEntity .class );
102
100
LocalTime localTime = LocalTime .now ();
103
101
localTimeTestEntity .setTime (localTime );
@@ -117,7 +115,7 @@ public void testJava8LocalTime() {
117
115
}
118
116
119
117
@ Test
120
- public void testJava8LocalDateTime () {
118
+ public void testLocalDateTime () {
121
119
LocalDateTimeTestEntity localDateTimeTestEntity = context .newObject (LocalDateTimeTestEntity .class );
122
120
// round up seconds fraction
123
121
// reason: on MySQL field should be defined as TIMESTAMP(fractionSecondsPrecision) to support it
@@ -135,7 +133,7 @@ public void testJava8LocalDateTime() {
135
133
}
136
134
137
135
@ Test
138
- public void columnSelectWithJava8Type () {
136
+ public void columnSelectWithLocalDateTime () {
139
137
// round up seconds fraction
140
138
// reason: on MySQL field should be defined as TIMESTAMP(fractionSecondsPrecision) to support it
141
139
LocalDateTime localDateTime = LocalDateTime .now ().with (ChronoField .NANO_OF_SECOND , 0 );
@@ -157,7 +155,7 @@ public void columnSelectWithJava8Type() {
157
155
}
158
156
159
157
@ Test
160
- public void testJava8Duration () {
158
+ public void testDuration () {
161
159
DurationTestEntity durationTestEntity = context .newObject (DurationTestEntity .class );
162
160
Duration duration = Duration .ofDays (10 );
163
161
durationTestEntity .setDurationBigInt (duration );
@@ -197,7 +195,7 @@ public void testJava8Duration() {
197
195
}
198
196
199
197
@ Test
200
- public void testJava8Period () {
198
+ public void testPeriod () {
201
199
PeriodTestEntity periodTestEntity = context .newObject (PeriodTestEntity .class );
202
200
Period period = Period .of (100 , 10 , 5 );
203
201
periodTestEntity .setPeriodField (period );
0 commit comments