@Test public void convertTest() { EcoNews ecoNews = ModelUtils.getEcoNews(); EcoNewsDto expected = new EcoNewsDto(ecoNews.getCreationDate(), ecoNews.getImagePath(), ecoNews.getId(), ecoNews.getTitle(), ecoNews.getText(), ecoNews.getSource(), ModelUtils.getEcoNewsAuthorDto(), ecoNews.getTags().stream() .map(Tag::getName) .collect(Collectors.toList()) ); assertEquals(expected, ecoNewsDtoMapper.convert(ecoNews)); }
@Override public EcoNewsDto convert(EcoNews ecoNews) { User author = ecoNews.getAuthor(); EcoNewsAuthorDto ecoNewsAuthorDto = new EcoNewsAuthorDto(author.getId(), author.getName()); return new EcoNewsDto(ecoNews.getCreationDate(), ecoNews.getImagePath(), ecoNews.getId(), ecoNews.getTitle(), ecoNews.getText(), ecoNews.getSource(), ecoNewsAuthorDto, ecoNews.getTags() .stream() .map(Tag::getName) .collect(Collectors.toList())); }
EcoNewsDtoMapper extends AbstractConverter<EcoNews, EcoNewsDto> { @Override public EcoNewsDto convert(EcoNews ecoNews) { User author = ecoNews.getAuthor(); EcoNewsAuthorDto ecoNewsAuthorDto = new EcoNewsAuthorDto(author.getId(), author.getName()); return new EcoNewsDto(ecoNews.getCreationDate(), ecoNews.getImagePath(), ecoNews.getId(), ecoNews.getTitle(), ecoNews.getText(), ecoNews.getSource(), ecoNewsAuthorDto, ecoNews.getTags() .stream() .map(Tag::getName) .collect(Collectors.toList())); } }
EcoNewsDtoMapper extends AbstractConverter<EcoNews, EcoNewsDto> { @Override public EcoNewsDto convert(EcoNews ecoNews) { User author = ecoNews.getAuthor(); EcoNewsAuthorDto ecoNewsAuthorDto = new EcoNewsAuthorDto(author.getId(), author.getName()); return new EcoNewsDto(ecoNews.getCreationDate(), ecoNews.getImagePath(), ecoNews.getId(), ecoNews.getTitle(), ecoNews.getText(), ecoNews.getSource(), ecoNewsAuthorDto, ecoNews.getTags() .stream() .map(Tag::getName) .collect(Collectors.toList())); }  }
EcoNewsDtoMapper extends AbstractConverter<EcoNews, EcoNewsDto> { @Override public EcoNewsDto convert(EcoNews ecoNews) { User author = ecoNews.getAuthor(); EcoNewsAuthorDto ecoNewsAuthorDto = new EcoNewsAuthorDto(author.getId(), author.getName()); return new EcoNewsDto(ecoNews.getCreationDate(), ecoNews.getImagePath(), ecoNews.getId(), ecoNews.getTitle(), ecoNews.getText(), ecoNews.getSource(), ecoNewsAuthorDto, ecoNews.getTags() .stream() .map(Tag::getName) .collect(Collectors.toList())); }  @Override EcoNewsDto convert(EcoNews ecoNews); }
EcoNewsDtoMapper extends AbstractConverter<EcoNews, EcoNewsDto> { @Override public EcoNewsDto convert(EcoNews ecoNews) { User author = ecoNews.getAuthor(); EcoNewsAuthorDto ecoNewsAuthorDto = new EcoNewsAuthorDto(author.getId(), author.getName()); return new EcoNewsDto(ecoNews.getCreationDate(), ecoNews.getImagePath(), ecoNews.getId(), ecoNews.getTitle(), ecoNews.getText(), ecoNews.getSource(), ecoNewsAuthorDto, ecoNews.getTags() .stream() .map(Tag::getName) .collect(Collectors.toList())); }  @Override EcoNewsDto convert(EcoNews ecoNews);  }