### Question:
JSON implements ContextResolver<ObjectMapper> { @Override public ObjectMapper getContext(Class<?> type) { return mapper; } JSON(); void setDateFormat(DateFormat dateFormat); @Override ObjectMapper getContext(Class<?> type); ObjectMapper getMapper(); static Class<?> getClassForElement(JsonNode node, Class<?> modelClass); static boolean isInstanceOf(Class<?> modelClass, Object inst, Set<Class<?>> visitedClasses); static void registerDiscriminator(Class<?> modelClass, String discriminatorPropertyName, Map<String, Class<?>> mappings); static void registerDescendants(Class<?> modelClass, Map<String, GenericType> descendants); static JSON getDefault(); static void setDefault(JSON json);  }### Answer:
@Test public void testDefaultDate() throws Exception { final DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME; final String dateStr = "2015-11-07T14:11:05.267Z"; order.setShipDate(dateFormat.parse(dateStr, OffsetDateTime::from)); String str = json.getContext(null).writeValueAsString(order); Order o = json.getContext(null).readValue(str, Order.class); assertEquals(dateStr, dateFormat.format(o.getShipDate())); }
@Test public void testCustomDate() throws Exception { final DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("Etc/GMT+2")); final String dateStr = "2015-11-07T14:11:05-02:00"; order.setShipDate(dateFormat.parse(dateStr, OffsetDateTime::from)); String str = json.getContext(null).writeValueAsString(order); Order o = json.getContext(null).readValue(str, Order.class); assertEquals(dateStr, dateFormat.format(o.getShipDate())); }
@Test public void testSchemaWithSpecialCharacters() throws Exception { String str = "{ \"$special[property.name]\": 12345 }"; SpecialModelName o = json.getContext(null).readValue(str, SpecialModelName.class); assertNotNull(o); assertEquals((long)12345, (long)o.get$SpecialPropertyName()); }