aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick/tests/MessageTests.java
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-12-07 18:53:37 +0700
committerGravatar Vitaly Takmazov2016-12-07 22:37:17 +0300
commitbad2718b1b85d806221fce52c76fa1d388993396 (patch)
tree8788b2b128012c3688fe9d56f295039c8d86f7b3 /src/test/java/com/juick/tests/MessageTests.java
parent3f0229dd0c0d07286604c77980ca578c1b3b8cbc (diff)
singleton java 8 date formatters
Diffstat (limited to 'src/test/java/com/juick/tests/MessageTests.java')
-rw-r--r--src/test/java/com/juick/tests/MessageTests.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/java/com/juick/tests/MessageTests.java b/src/test/java/com/juick/tests/MessageTests.java
index 45575ded..a0cfd444 100644
--- a/src/test/java/com/juick/tests/MessageTests.java
+++ b/src/test/java/com/juick/tests/MessageTests.java
@@ -3,6 +3,7 @@ package com.juick.tests;
import static org.junit.Assert.assertEquals;
import com.juick.json.MessageSerializer;
+import com.juick.util.DateFormattersHolder;
import com.juick.xmpp.extensions.JuickMessage;
import org.json.JSONObject;
import org.junit.Test;
@@ -33,7 +34,7 @@ public class MessageTests {
msg.setDate(currentDate);
MessageSerializer serializer = new MessageSerializer();
JSONObject jsonMessage = serializer.serialize(msg);
- assertEquals("date should be in timestamp field", serializer.getDf().format(currentDate),
+ assertEquals("date should be in timestamp field", DateFormattersHolder.getMessageFormatterInstance().format(currentDate),
jsonMessage.getString("timestamp"));
JuickMessage xmppMessage = new JuickMessage(msg);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
@@ -42,7 +43,7 @@ public class MessageTests {
Document doc = db.parse(new ByteArrayInputStream(xmppMessage.toString().getBytes("UTF-8")));
Node juickNode = doc.getElementsByTagName("juick").item(0);
NamedNodeMap attrs = juickNode.getAttributes();
- assertEquals("date should be in ts field", serializer.getDf().format(currentDate),
+ assertEquals("date should be in ts field", DateFormattersHolder.getMessageFormatterInstance().format(currentDate),
attrs.getNamedItem("ts").getNodeValue());
}
} \ No newline at end of file