Skip to content

Commit 670b917

Browse files
committed
Added "noon-buffer" for less time-zone errors
1 parent 133e05b commit 670b917

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/test/java/de/imi/mopat/dao/impl/StatisticDaoImplTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,17 @@ public class StatisticDaoImplTest {
5353
@WithUserDetails(value = "admin", userDetailsServiceBeanName = "MoPatUserDetailsService")
5454
public void testGetEarliestDate() {
5555
clearTable();
56-
java.util.Date expectedDate = java.sql.Date.valueOf(LocalDate.of(2025, 11, 28));
56+
57+
LocalDate base = LocalDate.of(2025, 11, 28);
58+
java.util.Date expectedDate = java.sql.Timestamp.valueOf(base.atTime(12, 0));
5759

5860
Statistic earliest = new Statistic();
5961
earliest.setDate(expectedDate);
6062
testStatisticDao.merge(earliest);
6163

6264
for (int i = 1; i <= 5; i++) {
6365
Statistic s = new Statistic();
64-
s.setDate(java.sql.Date.valueOf(LocalDate.of(2025, 11, 28).plusDays(i)));
66+
s.setDate(java.sql.Timestamp.valueOf(base.plusDays(i).atTime(12, 0)));
6567
testStatisticDao.merge(s);
6668
}
6769

@@ -80,15 +82,17 @@ public void testGetEarliestDate() {
8082
@WithUserDetails(value = "admin", userDetailsServiceBeanName = "MoPatUserDetailsService")
8183
public void testGetLatestDate() {
8284
clearTable();
83-
java.util.Date expectedDate = java.sql.Date.valueOf(LocalDate.of(2025, 11, 28));
85+
86+
LocalDate base = LocalDate.of(2025, 11, 28);
87+
java.util.Date expectedDate = java.sql.Timestamp.valueOf(base.atTime(12, 0));
8488

8589
Statistic earliest = new Statistic();
8690
earliest.setDate(expectedDate);
8791
testStatisticDao.merge(earliest);
8892

8993
for (int i = 1; i <= 5; i++) {
9094
Statistic s = new Statistic();
91-
s.setDate(java.sql.Date.valueOf(LocalDate.of(2025, 11, 28).minusDays(i)));
95+
s.setDate(java.sql.Timestamp.valueOf(base.minusDays(i).atTime(12, 0)));
9296
testStatisticDao.merge(s);
9397
}
9498

0 commit comments

Comments
 (0)