ResultJsonUtil { public static ObjectMapper initJsonMapper() { return new ObjectMapper() .registerModule(new JavaTimeModule()) .enable(SerializationFeature.INDENT_OUTPUT) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); } private  ResultJsonUtil(); static ObjectMapper initJsonMapper();  }
@Test public void testTimestampFormat() throws JsonProcessingException { ObjectMapper mapper = ResultJsonUtil.initJsonMapper(); String s = mapper.writeValueAsString(new MyClass()); assertThat(s).contains("\"dateTime\" : \"2019-02-04T15:13:24.000000933\""); }