Changeset 7 for party/src/test
- Timestamp:
- 09/25/19 16:49:06 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
party/src/test/java/geniusweb/party/inform/NegotiationInfoTest.java
r1 r7 8 8 import java.util.Arrays; 9 9 import java.util.Date; 10 import java.util.HashMap; 10 11 import java.util.List; 12 import java.util.Map; 11 13 12 14 import org.junit.Before; … … 43 45 private Settings negoinfo4; 44 46 private final Date date = new Date(999); 47 private final static ObjectMapper jackson = new ObjectMapper(); 45 48 46 49 @Before … … 48 51 JsonMappingException, IOException { 49 52 // we can't mock because we want to test the serializer 50 ObjectMapper jackson = new ObjectMapper();51 53 ProfileRef profile1 = new ProfileRef(new URI("ws:profile1")); 52 54 // jackson.readValue(serialized, Profile.class); … … 98 100 @Test 99 101 public void testSerialize() throws JsonProcessingException { 100 ObjectMapper jackson = new ObjectMapper();101 102 102 103 String json = jackson.writeValueAsString(negoinfo1); … … 108 109 public void testDeserialize() 109 110 throws JsonParseException, JsonMappingException, IOException { 110 ObjectMapper jackson = new ObjectMapper();111 111 Settings p = (Settings) jackson.readValue(asJson, Inform.class); 112 112 System.out.println(p); 113 113 assertEquals(negoinfo1, p); 114 114 } 115 116 @Test 117 public void testGeneralDict() throws JsonParseException, JsonMappingException, IOException { 118 Map val = jackson.readValue("{\"a\":1,\"b\":{\"x\":3},\"c\":[1,2,3]}", HashMap.class); 119 System.out.println(val); 120 } 115 121 116 122 }
Note:
See TracChangeset
for help on using the changeset viewer.