### Question:
MentionsRecordableEventConverter implements RecordableEventConverter { @Override public Event convert(RecordableEvent recordableEvent, String source, Object data) { MentionEvent mentionEvent = (MentionEvent) recordableEvent; MentionEventParams params = mentionEvent.getParams(); DocumentReference userDocument = this.documentReferenceResolver.resolve(params.getUserReference()); DocumentReference document = this.documentReferenceResolver.resolve(params.getDocumentReference()); Optional<String> serialize = this.objectMapper.serialize(mentionEvent.getParams()); return serialize.map(json -> { try { Event convertedEvent = this.defaultConverter.convert(recordableEvent, source, data); convertedEvent.setUser(userDocument); convertedEvent.setDocument(document); convertedEvent.setType(EVENT_TYPE); convertedEvent.setWiki(document.getWikiReference()); Map<String, String> parameters = initializeParameters(json); convertedEvent.setParameters(parameters); return convertedEvent; } catch (Exception e) { this.logger.warn("Failed to convert the recordable event [{}]. Cause [{}].", recordableEvent, getRootCauseMessage(e)); return null; } }).orElse(null); }  @Override Event convert(RecordableEvent recordableEvent, String source, Object data); @Override List<RecordableEvent> getSupportedEvents(); static final String MENTIONS_PARAMETER_KEY; }### Answer:
@Test void convert() throws Exception { MentionEventParams params = new MentionEventParams() .setDocumentReference("xwiki:XWiki.Doc") .setUserReference("xwiki:XWiki.U1"); MentionEvent recordableEvent = new MentionEvent(new HashSet<>(), params); DocumentReference document = new DocumentReference("xwiki", "XWiki", "Doc"); when(this.documentReferenceResolver.resolve("xwiki:XWiki.Doc")) .thenReturn(document); DocumentReference userDocument = new DocumentReference("xwiki", "XWiki", "U1"); when(this.documentReferenceResolver.resolve("xwiki:XWiki.U1")) .thenReturn(userDocument); Event event = mock(Event.class); when(this.defaultConverter.convert(recordableEvent, "aa", null)).thenReturn(event); when(this.objectMapper.serialize(params)).thenReturn( Optional.of("{\"userReference\":\"xwiki:XWiki.U1\",\"documentReference\":\"xwiki:XWiki.Doc\"}")); Event actual = this.converter.convert(recordableEvent, "aa", null); assertNotNull(actual); verify(event).setUser(userDocument); verify(event).setDocument(document); verify(event).setType(MentionEvent.EVENT_TYPE); HashMap<String, String> parameters = new HashMap<>(); parameters.put(MentionsRecordableEventConverter.MENTIONS_PARAMETER_KEY, "{\"userReference\":\"xwiki:XWiki.U1\",\"documentReference\":\"xwiki:XWiki.Doc\"}"); verify(event).setParameters(parameters); }