aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-01-16 18:25:11 +0300
committerGravatar Vitaly Takmazov2016-01-16 18:25:11 +0300
commit9a50ad8dea5e9ebc5eb1c5efb19aa7a784283e14 (patch)
tree4edd3e1296c7369603fe0364f248a673de14cf5f /src/test/java/com/juick
parentee0e13e7243abecf242236c224551774195524a3 (diff)
date and tests
Diffstat (limited to 'src/test/java/com/juick')
-rw-r--r--src/test/java/com/juick/JsonTests.java30
1 files changed, 30 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 00000000..5d78a2d6
--- /dev/null
+++ b/src/test/java/com/juick/JsonTests.java
@@ -0,0 +1,30 @@
+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;
+
+public class JsonTests {
+ @Test
+ public void DateTest() {
+ Message msg = new Message();
+ SimpleDateFormat df= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ try {
+ msg.setDate(df.parse("2015-01-01 00:00:00"));
+ MessageSerializer serializer = new MessageSerializer();
+ String json = serializer.serialize(msg).toString();
+ assertEquals("{\"timestamp\":\"2015-01-01 00:00:00\"}", json);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+
+ }
+} \ No newline at end of file