NotesConverterService implements TrackerConverterService<Note, TrackedEntityComment> { @Override public TrackedEntityComment from( TrackerPreheat preheat, Note note ) { TrackedEntityComment comment = new TrackedEntityComment(); comment.setUid( note.getNote() ); comment.setAutoFields(); comment.setCommentText( note.getValue() ); return comment; }  @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 verifyConvertCommentToNote() { Note note = rnd.randomObject( Note.class ); final TrackedEntityComment comment = notesConverterService.from( preheat, note ); assertNoteValues( comment, note ); }
@Test public void verifyConvertCommentsToNotes() { List<Note> notes = rnd.randomObjects( Note.class, 10 ); final List<TrackedEntityComment> comments = notesConverterService.from( preheat, notes ); assertThat( comments, hasSize( 10 ) ); for ( Note note : notes ) { assertNoteValues( comments.stream().filter( c -> c.getUid().equals( note.getNote() ) ).findFirst().get(), note ); } }