public static ObjectMapper createObjectMapper() {
        final ObjectMapper objectMapper = new ObjectMapper();
        registerModules(objectMapper);
        return objectMapper;
    }
@Test
    void testObjectMapperOptionalSupportedEnabled() throws Exception {
        final ObjectMapper mapper = JacksonMapperFactory.createObjectMapper();

        assertThat(mapper.writeValueAsString(new TypeWithOptional(Optional.of("value"))))
                .isEqualTo("{\"data\":\"value\"}");
        assertThat(mapper.writeValueAsString(new TypeWithOptional(Optional.empty())))
                .isEqualTo("{\"data\":null}");

        assertThat(mapper.readValue("{\"data\":\"value\"}", TypeWithOptional.class).data)
                .contains("value");
        assertThat(mapper.readValue("{\"data\":null}", TypeWithOptional.class).data).isEmpty();
        assertThat(mapper.readValue("{}", TypeWithOptional.class).data).isEmpty();
    }