NotesConverterService implements TrackerConverterService<Note, TrackedEntityComment> { @Override public Note to( TrackedEntityComment trackedEntityComment ) { Note note = new Note(); note.setNote( trackedEntityComment.getUid() ); note.setValue( trackedEntityComment.getCommentText() ); note.setStoredAt( DateUtils.getIso8601NoTz( trackedEntityComment.getCreated() ) ); note.setStoredBy( trackedEntityComment.getCreator() ); return note; }  @Override Note to( TrackedEntityComment trackedEntityComment ); @Override List<Note> to( List<TrackedEntityComment> trackedEntityComments ); @Override TrackedEntityComment from( TrackerPreheat preheat, Note note ); @Override List<TrackedEntityComment> from( TrackerPreheat preheat, List<Note> notes ); @Override TrackedEntityComment fromForRuleEngine( TrackerPreheat preheat, Note object );  }
@Test public void verifyConvertNoteToComment() { TrackedEntityComment comment = rnd.randomObject( TrackedEntityComment.class ); final Note note = notesConverterService.to( comment ); assertCommentValues( note, comment ); }
@Test public void verifyConvertNotesToComments() { List<TrackedEntityComment> comments = rnd.randomObjects( TrackedEntityComment.class, 10 ); final List<Note> notes = notesConverterService.to( comments ); for ( TrackedEntityComment comment : comments ) { assertCommentValues( notes.stream().filter( n -> n.getNote().equals( comment.getUid() ) ).findFirst().get(), comment ); } }