AppMapper { public List<Integer> toSpeakersIds(@Nullable List<Speaker> speakers) { if (speakers == null) { return null; } return stream(speakers).map(Speaker::getId).collect(Collectors.toList()); } @Inject  AppMapper(); Map<Integer, Speaker> speakersToMap(@NonNull List<Speaker> from); List<Speaker> toSpeakersList(@Nullable List<Integer> speakerIds, @NonNull Map<Integer, Speaker> speakersMap); List<Integer> toSpeakersIds(@Nullable List<Speaker> speakers); Schedule toSchedule(@NonNull List<Session> sessions);  }
@Test public void should_return_list_of_ids() { List<Speaker> speakers = Arrays.asList(speaker3, speaker5); List<Integer> result = appMapper.toSpeakersIds(speakers); assertThat(result).hasSize(2); assertThat(result).containsAllOf(30, 50); }