@Test public void converterTest() { PlanetDTO planet = converter.convertPlanet(tatooine); assertThat(planet, matchesSnapshot()); }
public PlanetDTO convertPlanet(Planet planet) { PlanetDTO dto = objectMapper.convertValue(planet, PlanetDTO.class); dto.films = planet.filmsUrls.stream() .map(filmUrl -> restTemplate.getForObject(filmUrl, FilmDTO.class)) .collect(Collectors.toList()); dto.residents = planet.residentsUrls.stream() .map(filmUrl -> restTemplate.getForObject(filmUrl, PeopleDTO.class)) .collect(Collectors.toList()); return dto; }
PlanetConverter { public PlanetDTO convertPlanet(Planet planet) { PlanetDTO dto = objectMapper.convertValue(planet, PlanetDTO.class); dto.films = planet.filmsUrls.stream() .map(filmUrl -> restTemplate.getForObject(filmUrl, FilmDTO.class)) .collect(Collectors.toList()); dto.residents = planet.residentsUrls.stream() .map(filmUrl -> restTemplate.getForObject(filmUrl, PeopleDTO.class)) .collect(Collectors.toList()); return dto; } }
PlanetConverter { public PlanetDTO convertPlanet(Planet planet) { PlanetDTO dto = objectMapper.convertValue(planet, PlanetDTO.class); dto.films = planet.filmsUrls.stream() .map(filmUrl -> restTemplate.getForObject(filmUrl, FilmDTO.class)) .collect(Collectors.toList()); dto.residents = planet.residentsUrls.stream() .map(filmUrl -> restTemplate.getForObject(filmUrl, PeopleDTO.class)) .collect(Collectors.toList()); return dto; }  }
PlanetConverter { public PlanetDTO convertPlanet(Planet planet) { PlanetDTO dto = objectMapper.convertValue(planet, PlanetDTO.class); dto.films = planet.filmsUrls.stream() .map(filmUrl -> restTemplate.getForObject(filmUrl, FilmDTO.class)) .collect(Collectors.toList()); dto.residents = planet.residentsUrls.stream() .map(filmUrl -> restTemplate.getForObject(filmUrl, PeopleDTO.class)) .collect(Collectors.toList()); return dto; }  PlanetDTO convertPlanet(Planet planet); }
PlanetConverter { public PlanetDTO convertPlanet(Planet planet) { PlanetDTO dto = objectMapper.convertValue(planet, PlanetDTO.class); dto.films = planet.filmsUrls.stream() .map(filmUrl -> restTemplate.getForObject(filmUrl, FilmDTO.class)) .collect(Collectors.toList()); dto.residents = planet.residentsUrls.stream() .map(filmUrl -> restTemplate.getForObject(filmUrl, PeopleDTO.class)) .collect(Collectors.toList()); return dto; }  PlanetDTO convertPlanet(Planet planet);  }