diff options
Diffstat (limited to 'juick-server/src/test/java/com/juick/server/tests')
-rw-r--r-- | juick-server/src/test/java/com/juick/server/tests/ServerTests.java | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java index 840bebbb..9a78b0a2 100644 --- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java +++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java @@ -19,8 +19,7 @@ package com.juick.server.tests; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.jayway.jsonpath.JsonPath; import com.juick.*; import com.juick.server.*; import com.juick.server.component.MessageEvent; @@ -35,8 +34,6 @@ import com.juick.util.MessageUtils; import org.apache.commons.codec.CharEncoding; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.json.JSONException; -import org.json.JSONObject; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -967,7 +964,7 @@ public class ServerTests { } @Test public void messageParserSerializer() throws ParserConfigurationException, - IOException, SAXException, JAXBException, JSONException { + IOException, SAXException, JAXBException { Message msg = new Message(); msg.setTags(MessageUtils.parseTags("test test" + (char) 0xA0 + "2 test3")); assertEquals("First tag must be", "test", msg.getTags().get(0).getName()); @@ -975,13 +972,9 @@ public class ServerTests { assertEquals("Count of tags must be", 3, msg.getTags().size()); Instant currentDate = Instant.now(); msg.setTimestamp(currentDate); - ObjectMapper serializer = new ObjectMapper(); - serializer.registerModule(new Jdk8Module()); - serializer.registerModule(new JavaTimeModule()); - String jsonMessage = serializer.writeValueAsString(msg); - JSONObject jsonObject = new JSONObject(jsonMessage); + String jsonMessage = jsonMapper.writeValueAsString(msg); assertEquals("date should be in timestamp field", DateFormattersHolder.getMessageFormatterInstance().format(currentDate), - jsonObject.getString("timestamp")); + JsonPath.read(jsonMessage, "$.timestamp")); JAXBContext context = JAXBContext |