### Question:
DefaultMentionsNotificationsObjectMapper implements MentionsNotificationsObjectMapper, Initializable { @Override public Optional<String> serialize(MentionEventParams params) { Optional<String> ret; try { StringWriter w = new StringWriter(); this.objectMapper.writeValue(w, params); ret = Optional.of(w.toString()); } catch (IOException e) { this.logger.warn("Failed to serialize [{}]. Cause [{}].", params, getRootCauseMessage(e)); ret = Optional.empty(); } return ret; }  @Override Optional<MentionEventParams> unserialize(String data); @Override Optional<String> serialize(MentionEventParams params); @Override void initialize();  }### Answer:
@Test void serialize() { Optional<String> actual = this.objectMapper.serialize( new MentionEventParams() .setLocation(MentionLocation.COMMENT) .setUserReference("xwiki:XWiki.User") .setDocumentReference("xwiki:XWiki.Doc") .setAnchor("anchor") .setQuote("quote @User ...")); assertTrue(actual.isPresent()); assertEquals( "{\"userReference\":\"xwiki:XWiki.User\"," + "\"documentReference\":\"xwiki:XWiki.Doc\"," + "\"location\":\"COMMENT\"," + "\"anchor\":\"anchor\"," + "\"quote\":\"quote @User ...\"}", actual.get()); }