ObjectMapperUtil { public static ObjectMapper createStandardObjectMapper() { return createStandardObjectMapper(null); }  static ObjectMapper createStandardObjectMapper(); static ObjectMapper createStandardObjectMapper(ApiSerializationConfig config);  }
@Test public void createStandardObjectMapper_base64Variant() throws Exception { byte[] bytes = new byte[] {(byte) 0xff, (byte) 0xef}; ObjectMapper mapper = ObjectMapperUtil.createStandardObjectMapper(); assertThat(mapper.writeValueAsString(bytes)).isEqualTo("\"_-8\""); assertThat(mapper.readValue("\"_-8\"", byte[].class)).isEqualTo(bytes); }
@Test public void createStandardObjectMapper_useJacksonAnnotations() throws Exception { ObjectMapper mapper = ObjectMapperUtil.createStandardObjectMapper(); assertThat(mapper.writeValueAsString(new TestObject())).contains("test"); }
@Test public void createStandardObjectMapper_disableJacksonAnnotations() throws Exception { System.setProperty(EndpointsFlag.JSON_USE_JACKSON_ANNOTATIONS.systemPropertyName, "false"); try { ObjectMapper mapper = ObjectMapperUtil.createStandardObjectMapper(); assertThat(mapper.writeValueAsString(new TestObject())).contains("TEST"); } finally { System.clearProperty(EndpointsFlag.JSON_USE_JACKSON_ANNOTATIONS.systemPropertyName); } }