@Test public void testRecommendFriends() throws Exception { ObjectMapper mapper = new ObjectMapper(); this.webClient.get().uri("/v1/users/1/commands/recommendFriends") .accept(MediaType.APPLICATION_JSON) .exchange().expectBody() .json(mapper.writeValueAsString(friendRepository.recommendedFriends(1L).toList().toArray())); }
@GetMapping(path = "/users/{userId}/commands/recommendFriends") public Flux<RankedUser> recommendFriends(@PathVariable Long userId) { return Flux.fromIterable(friendRepository.recommendedFriends(userId)); }
UserController { @GetMapping(path = "/users/{userId}/commands/recommendFriends") public Flux<RankedUser> recommendFriends(@PathVariable Long userId) { return Flux.fromIterable(friendRepository.recommendedFriends(userId)); } }
UserController { @GetMapping(path = "/users/{userId}/commands/recommendFriends") public Flux<RankedUser> recommendFriends(@PathVariable Long userId) { return Flux.fromIterable(friendRepository.recommendedFriends(userId)); } UserController(FriendRepository friendRepository); }
UserController { @GetMapping(path = "/users/{userId}/commands/recommendFriends") public Flux<RankedUser> recommendFriends(@PathVariable Long userId) { return Flux.fromIterable(friendRepository.recommendedFriends(userId)); } UserController(FriendRepository friendRepository); @GetMapping(path = "/users/{userId}/commands/findMutualFriends") Flux<User> getMutualFriends(@PathVariable Long userId, @RequestParam Long friendId); @GetMapping(path = "/users/{userId}/commands/recommendFriends") Flux<RankedUser> recommendFriends(@PathVariable Long userId); }
UserController { @GetMapping(path = "/users/{userId}/commands/recommendFriends") public Flux<RankedUser> recommendFriends(@PathVariable Long userId) { return Flux.fromIterable(friendRepository.recommendedFriends(userId)); } UserController(FriendRepository friendRepository); @GetMapping(path = "/users/{userId}/commands/findMutualFriends") Flux<User> getMutualFriends(@PathVariable Long userId, @RequestParam Long friendId); @GetMapping(path = "/users/{userId}/commands/recommendFriends") Flux<RankedUser> recommendFriends(@PathVariable Long userId);  }