Skip to content

Commit 52a8daf

Browse files
kazuki43zooschauder
authored andcommitted
DATAJDBC-209 - Improve assertion on The QueryAnnotationHsqlIntegrationTests#executeCustomQueryWithReturnTypeIsDate
Since Timestamp extends Date the repository returns the Timestamp as it comes from the database. Trying to compare that to an actual Date results in non determistic results, so we have to use an actual Timestamp. Original pull request: #66.
1 parent 41e31b1 commit 52a8daf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/test/java/org/springframework/data/jdbc/repository/query/QueryAnnotationHsqlIntegrationTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import static org.assertj.core.api.Assertions.*;
1919

20+
import java.sql.Timestamp;
2021
import java.time.LocalDateTime;
2122
import java.util.Date;
2223
import java.util.List;
@@ -195,7 +196,7 @@ public void executeCustomQueryWithReturnTypeIsBoolean() {
195196
@Test // DATAJDBC-175
196197
public void executeCustomQueryWithReturnTypeIsDate() {
197198

198-
Date now = new Date();
199+
Date now = new Timestamp(System.currentTimeMillis());
199200
assertThat(repository.nowWithDate()).isAfterOrEqualsTo(now);
200201

201202
}

0 commit comments

Comments
 (0)