From f1e36a73e111d021ce893f670f5fb249f4a33e1a Mon Sep 17 00:00:00 2001 From: Jens Schauder Date: Tue, 15 May 2018 10:33:19 +0200 Subject: [PATCH] DATAJDBC-209 - Polishing. Added a comment to explain why we have to use a Timestamp for the comparison. Original pull request: #66. --- .../repository/query/QueryAnnotationHsqlIntegrationTests.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/java/org/springframework/data/jdbc/repository/query/QueryAnnotationHsqlIntegrationTests.java b/src/test/java/org/springframework/data/jdbc/repository/query/QueryAnnotationHsqlIntegrationTests.java index dc297cb89..50dabf46f 100644 --- a/src/test/java/org/springframework/data/jdbc/repository/query/QueryAnnotationHsqlIntegrationTests.java +++ b/src/test/java/org/springframework/data/jdbc/repository/query/QueryAnnotationHsqlIntegrationTests.java @@ -196,6 +196,9 @@ public class QueryAnnotationHsqlIntegrationTests { @Test // DATAJDBC-175 public void 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. Date now = new Timestamp(System.currentTimeMillis()); assertThat(repository.nowWithDate()).isAfterOrEqualsTo(now);