class 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;
    }

}

class PlanetConverterTest {

    @Mock
    private RestTemplate restTemplate;
    @Autowired
    @InjectMocks
    private PlanetConverter converter;
    private PeopleDTO lukeSkywalker;
    private FilmDTO attackOfTheClones;
    private Planet tatooine;

    @Test
    public void converterTest() {

        PlanetDTO planet = converter.convertPlanet(tatooine);

        assertThat(planet, matchesSnapshot());
    }

}