@Test public void convertTest() { EcoNews ecoNews = ModelUtils.getEcoNews(); AddEcoNewsDtoResponse expected = ModelUtils.getAddEcoNewsDtoResponse(); expected.setCreationDate(ecoNews.getCreationDate()); assertEquals(expected, mapper.convert(ecoNews)); }
@Override protected AddEcoNewsDtoResponse convert(EcoNews ecoNews) { return AddEcoNewsDtoResponse.builder() .id(ecoNews.getId()) .text(ecoNews.getText()) .title(ecoNews.getTitle()) .source(ecoNews.getSource()) .imagePath(ecoNews.getImagePath()) .creationDate(ecoNews.getCreationDate()) .ecoNewsAuthorDto(EcoNewsAuthorDto.builder() .id(ecoNews.getAuthor().getId()) .name(ecoNews.getAuthor().getName()) .build()) .tags(ecoNews.getTags() .stream() .map(Tag::getName) .collect(Collectors.toList())) .build(); }
AddEcoNewsDtoResponseMapper extends AbstractConverter<EcoNews, AddEcoNewsDtoResponse> { @Override protected AddEcoNewsDtoResponse convert(EcoNews ecoNews) { return AddEcoNewsDtoResponse.builder() .id(ecoNews.getId()) .text(ecoNews.getText()) .title(ecoNews.getTitle()) .source(ecoNews.getSource()) .imagePath(ecoNews.getImagePath()) .creationDate(ecoNews.getCreationDate()) .ecoNewsAuthorDto(EcoNewsAuthorDto.builder() .id(ecoNews.getAuthor().getId()) .name(ecoNews.getAuthor().getName()) .build()) .tags(ecoNews.getTags() .stream() .map(Tag::getName) .collect(Collectors.toList())) .build(); } }
AddEcoNewsDtoResponseMapper extends AbstractConverter<EcoNews, AddEcoNewsDtoResponse> { @Override protected AddEcoNewsDtoResponse convert(EcoNews ecoNews) { return AddEcoNewsDtoResponse.builder() .id(ecoNews.getId()) .text(ecoNews.getText()) .title(ecoNews.getTitle()) .source(ecoNews.getSource()) .imagePath(ecoNews.getImagePath()) .creationDate(ecoNews.getCreationDate()) .ecoNewsAuthorDto(EcoNewsAuthorDto.builder() .id(ecoNews.getAuthor().getId()) .name(ecoNews.getAuthor().getName()) .build()) .tags(ecoNews.getTags() .stream() .map(Tag::getName) .collect(Collectors.toList())) .build(); }  }
AddEcoNewsDtoResponseMapper extends AbstractConverter<EcoNews, AddEcoNewsDtoResponse> { @Override protected AddEcoNewsDtoResponse convert(EcoNews ecoNews) { return AddEcoNewsDtoResponse.builder() .id(ecoNews.getId()) .text(ecoNews.getText()) .title(ecoNews.getTitle()) .source(ecoNews.getSource()) .imagePath(ecoNews.getImagePath()) .creationDate(ecoNews.getCreationDate()) .ecoNewsAuthorDto(EcoNewsAuthorDto.builder() .id(ecoNews.getAuthor().getId()) .name(ecoNews.getAuthor().getName()) .build()) .tags(ecoNews.getTags() .stream() .map(Tag::getName) .collect(Collectors.toList())) .build(); }   }
AddEcoNewsDtoResponseMapper extends AbstractConverter<EcoNews, AddEcoNewsDtoResponse> { @Override protected AddEcoNewsDtoResponse convert(EcoNews ecoNews) { return AddEcoNewsDtoResponse.builder() .id(ecoNews.getId()) .text(ecoNews.getText()) .title(ecoNews.getTitle()) .source(ecoNews.getSource()) .imagePath(ecoNews.getImagePath()) .creationDate(ecoNews.getCreationDate()) .ecoNewsAuthorDto(EcoNewsAuthorDto.builder() .id(ecoNews.getAuthor().getId()) .name(ecoNews.getAuthor().getName()) .build()) .tags(ecoNews.getTags() .stream() .map(Tag::getName) .collect(Collectors.toList())) .build(); }    }