aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-07 11:32:44 +0300
committerGravatar Vitaly Takmazov2016-07-07 11:32:44 +0300
commitfe8cf8c0093bbbfb053f52a53daea9145705b62e (patch)
tree3515f5d254016f73287696e2a08ba6e7fd824714 /src/test/java/com/juick
parenta8b38ca23e9b43527e85b0dbf5c9267401fd3c69 (diff)
parentfc46d9c1f8c9967f9c648f09a3714e8c3a4ed75a (diff)
merge json
Diffstat (limited to 'src/test/java/com/juick')
-rw-r--r--src/test/java/com/juick/JsonTests.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/java/com/juick/JsonTests.java b/src/test/java/com/juick/JsonTests.java
new file mode 100644
index 000000000..ba01e80c4
--- /dev/null
+++ b/src/test/java/com/juick/JsonTests.java
@@ -0,0 +1,32 @@
+package com.juick;
+
+import static org.junit.Assert.assertEquals;
+
+import com.juick.json.MessageSerializer;
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.juick.Message;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+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