DbMapper { public List<com.nilhcem.devoxxfr.data.app.model.Speaker> toAppSpeakers(@Nullable List<Speaker> from) { if (from == null) { return null; } return stream(from).map(speaker -> new com.nilhcem.devoxxfr.data.app.model.Speaker(speaker.id, speaker.name, speaker.title, speaker.bio, speaker.website, speaker.twitter, speaker.github, speaker.photo) ).collect(Collectors.toList()); } @Inject  DbMapper(Moshi moshi, AppMapper appMapper, LocalDateTimeAdapter localDateTimeAdapter); List<com.nilhcem.devoxxfr.data.app.model.Session> toAppSessions(@NonNull List<Session> from, @NonNull Map<Integer, com.nilhcem.devoxxfr.data.app.model.Speaker> speakersMap); Session fromAppSession(@Nullable com.nilhcem.devoxxfr.data.app.model.Session from); Speaker fromAppSpeaker(@Nullable com.nilhcem.devoxxfr.data.app.model.Speaker from); List<com.nilhcem.devoxxfr.data.app.model.Speaker> toAppSpeakers(@Nullable List<Speaker> from);  }
@Test public void should_convert_db_speakers_to_app_speakers() { com.nilhcem.devoxxfr.data.database.model.Speaker speaker = new com.nilhcem.devoxxfr.data.database.model.Speaker(58, "nilh", "dev", "bio", "nilhcem.com", "Nilhcem", "nilhcem", "photo"); List<Speaker> result = dbMapper.toAppSpeakers(singletonList(speaker)); assertThat(result).hasSize(1); assertThat(result.get(0).getId()).isEqualTo(58); assertThat(result.get(0).getName()).isEqualTo("nilh"); assertThat(result.get(0).getTitle()).isEqualTo("dev"); assertThat(result.get(0).getBio()).isEqualTo("bio"); assertThat(result.get(0).getWebsite()).isEqualTo("nilhcem.com"); assertThat(result.get(0).getTwitter()).isEqualTo("Nilhcem"); assertThat(result.get(0).getGithub()).isEqualTo("nilhcem"); assertThat(result.get(0).getPhoto()).isEqualTo("photo"); }