@Test void shouldRetrieveMovieTitles(@Autowired MoviesService moviesService) { assertThat(moviesService.getMovieTitles()) .hasSize(3) .contains("The Matrix"); }
public List<String> getMovieTitles() { try (var session = driver.session()) { return session.run("MATCH (m:Movie) RETURN m ORDER BY m.name ASC").stream() .map(r -> r.get("m").asNode()) .map(n -> n.get("title").asString()) .collect(Collectors.toList()); } }
MoviesService { public List<String> getMovieTitles() { try (var session = driver.session()) { return session.run("MATCH (m:Movie) RETURN m ORDER BY m.name ASC").stream() .map(r -> r.get("m").asNode()) .map(n -> n.get("title").asString()) .collect(Collectors.toList()); } } }
MoviesService { public List<String> getMovieTitles() { try (var session = driver.session()) { return session.run("MATCH (m:Movie) RETURN m ORDER BY m.name ASC").stream() .map(r -> r.get("m").asNode()) .map(n -> n.get("title").asString()) .collect(Collectors.toList()); } } MoviesService(Driver driver); }
MoviesService { public List<String> getMovieTitles() { try (var session = driver.session()) { return session.run("MATCH (m:Movie) RETURN m ORDER BY m.name ASC").stream() .map(r -> r.get("m").asNode()) .map(n -> n.get("title").asString()) .collect(Collectors.toList()); } } MoviesService(Driver driver); List<String> getMovieTitles(); }
MoviesService { public List<String> getMovieTitles() { try (var session = driver.session()) { return session.run("MATCH (m:Movie) RETURN m ORDER BY m.name ASC").stream() .map(r -> r.get("m").asNode()) .map(n -> n.get("title").asString()) .collect(Collectors.toList()); } } MoviesService(Driver driver); List<String> getMovieTitles();  }