You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by ot...@apache.org on 2018/11/18 18:15:24 UTC
[11/52] [abbrv] metron git commit: METRON-1864 Stellar date format
test fails after daylight saving (ottobackwards) closes apache/metron#1258
METRON-1864 Stellar date format test fails after daylight saving (ottobackwards) closes apache/metron#1258
Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/c6b1b3cc
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/c6b1b3cc
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/c6b1b3cc
Branch: refs/heads/feature/METRON-1090-stellar-assignment
Commit: c6b1b3ccd7f937342c5723ca0a952a4900efc5cf
Parents: 7bba8be
Author: ottobackwards <ot...@gmail.com>
Authored: Thu Nov 8 13:51:38 2018 -0500
Committer: otto <ot...@apache.org>
Committed: Thu Nov 8 13:51:38 2018 -0500
----------------------------------------------------------------------
.../metron/stellar/dsl/functions/DateFunctionsTest.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/metron/blob/c6b1b3cc/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/DateFunctionsTest.java
----------------------------------------------------------------------
diff --git a/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/DateFunctionsTest.java b/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/DateFunctionsTest.java
index 959e7ea..48b2995 100644
--- a/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/DateFunctionsTest.java
+++ b/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/DateFunctionsTest.java
@@ -28,6 +28,8 @@ import org.apache.metron.stellar.dsl.StellarFunctions;
import org.junit.Before;
import org.junit.Test;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
@@ -233,10 +235,16 @@ public class DateFunctionsTest {
assertEquals("Thu Aug 25 2016 08:27:10 EST", result);
}
+ /**
+ * Test that the String returned is formatted as specified.
+ * LocalDate.parse will throw if it is not.
+ * @throws Exception
+ */
@Test
- public void testDateFormatDefault() {
+ public void testDateFormatDefault() throws Exception {
Object result = run("DATE_FORMAT('EEE MMM dd yyyy hh:mm:ss zzzz')");
- assertTrue(result.toString().endsWith(TimeZone.getDefault().getDisplayName(true, 1)));
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE MMM dd yyyy hh:mm:ss zzzz");
+ LocalDate.parse(result.toString(), formatter);
}
@Test