aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick/tests
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-07 14:03:10 +0300
committerGravatar Vitaly Takmazov2016-07-07 14:03:10 +0300
commit7f6c01a9435fdaf35c804b97faca01242b439e70 (patch)
treef1dda5a80d1d61f56060b2f23c7c9c6a33d9491d /src/test/java/com/juick/tests
parent93cab67688630bbc4f6ace3c23d272828c2e47b3 (diff)
refactor
Diffstat (limited to 'src/test/java/com/juick/tests')
-rw-r--r--src/test/java/com/juick/tests/JsonTests.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/java/com/juick/tests/JsonTests.java b/src/test/java/com/juick/tests/JsonTests.java
new file mode 100644
index 00000000..babcc6c7
--- /dev/null
+++ b/src/test/java/com/juick/tests/JsonTests.java
@@ -0,0 +1,29 @@
+package com.juick.tests;
+
+import com.juick.Message;
+import com.juick.json.MessageSerializer;
+import org.junit.Test;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.TimeZone;
+
+import static org.junit.Assert.assertEquals;
+
+public class JsonTests {
+ @Test
+ public void DateTest() {
+ Message msg = new Message();
+ SimpleDateFormat df= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ df.setTimeZone(TimeZone.getTimeZone("UTC"));
+ try {
+ msg.setDate(df.parse("2015-01-01 05:02:10"));
+ MessageSerializer serializer = new MessageSerializer();
+ String json = serializer.serialize(msg).toString();
+ assertEquals("{\"timestamp\":\"2015-01-01 05:02:10\"}", json);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+
+ }
+} \ No newline at end of file