@Test public void mailboxIdShouldBeSerializableWhenKeyWithoutToString() throws Exception { ObjectMapperFactory testeeWithoutToString = new ObjectMapperFactory(new KeyWithoutToString.Factory(), new InMemoryMessageId.Factory()); MailboxIdKeyTestContainer container = new MailboxIdKeyTestContainer(ImmutableMap.of(new KeyWithoutToString("key"), "value")); String expectedJson = "{\"map\":{\"key\":\"value\"}}"; String actual = testeeWithoutToString.forWriting().writeValueAsString(container); assertThat(actual).isEqualTo(expectedJson); }
public ObjectMapper forWriting() { return new ObjectMapper() .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .registerModules(jacksonModules); }
ObjectMapperFactory { public ObjectMapper forWriting() { return new ObjectMapper() .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .registerModules(jacksonModules); } }
ObjectMapperFactory { public ObjectMapper forWriting() { return new ObjectMapper() .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .registerModules(jacksonModules); } @Inject  ObjectMapperFactory(MailboxId.Factory mailboxIdFactory, MessageId.Factory messageIdFactory); }
ObjectMapperFactory { public ObjectMapper forWriting() { return new ObjectMapper() .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .registerModules(jacksonModules); } @Inject  ObjectMapperFactory(MailboxId.Factory mailboxIdFactory, MessageId.Factory messageIdFactory); ObjectMapper forParsing(); ObjectMapper forWriting(); }
ObjectMapperFactory { public ObjectMapper forWriting() { return new ObjectMapper() .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .registerModules(jacksonModules); } @Inject  ObjectMapperFactory(MailboxId.Factory mailboxIdFactory, MessageId.Factory messageIdFactory); ObjectMapper forParsing(); ObjectMapper forWriting();  }