aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Stewart <stewinsalot@gmail.com>2016-12-20 01:13:05 -0500
committerStewart Stewart <stewinsalot@gmail.com>2016-12-20 01:13:05 -0500
commitf0edf2510e2cf67afdf598824a02ff03e6726f62 (patch)
tree7b253c56a5da1308af3c6f24c54042465c65427a
parent0672ad697cbf2f66baabd8c2aa0e2de966240f88 (diff)
downloaddriver-core-f0edf2510e2cf67afdf598824a02ff03e6726f62.tar.gz
driver-core-f0edf2510e2cf67afdf598824a02ff03e6726f62.tar.bz2
driver-core-f0edf2510e2cf67afdf598824a02ff03e6726f62.zip
add tests for time/date conversions
-rw-r--r--src/test/scala/xyz/driver/core/CoreTest.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/scala/xyz/driver/core/CoreTest.scala b/src/test/scala/xyz/driver/core/CoreTest.scala
index da9fd9a..e210887 100644
--- a/src/test/scala/xyz/driver/core/CoreTest.scala
+++ b/src/test/scala/xyz/driver/core/CoreTest.scala
@@ -60,6 +60,24 @@ class CoreTest extends FlatSpec with Matchers with MockitoSugar {
(y2 === y) should be(true)
}
+ "Time" should "use TimeZone correctly when converting to Date" in {
+
+ import time._
+
+ val EST = java.util.TimeZone.getTimeZone("EST")
+ val PST = java.util.TimeZone.getTimeZone("PST")
+
+ val timestamp = {
+ import java.util.Calendar
+ val cal = Calendar.getInstance(EST)
+ cal.set(Calendar.HOUR_OF_DAY, 1)
+ Time(cal.getTime().getTime())
+ }
+
+ textualDate(EST)(timestamp) should not be textualDate(PST)(timestamp)
+ timestamp.toDate(EST) should not be timestamp.toDate(PST)
+ }
+
"Name" should "have equality and ordering working correctly" in {
(Name[String]("foo") === Name[String]("foo")) should be(true)