@Test public void generateLinks() { List<Link> links = new ArrayList<>(testSubject.generateLinks(createUser())); assertThat(links.size()).isEqualTo(2); assertThat(links.get(0).getRel()).isEqualTo("self"); assertThat(links.get(0).getHref()).isEqualTo("/users/1"); assertThat(links.get(1).getRel()).isEqualTo("users"); assertThat(links.get(1).getHref()).isEqualTo("/users"); }
@Override public Collection<Link> generateLinks(User entity) { Link self = linkTo(methodOn(UserController.class).get(entity.getId())).withSelfRel(); Link users = linkTo(methodOn(UserController.class).list()).withRel("users"); return Arrays.asList(self, users); }
UserControllerUserLinks extends ResourceLinks<User> { @Override public Collection<Link> generateLinks(User entity) { Link self = linkTo(methodOn(UserController.class).get(entity.getId())).withSelfRel(); Link users = linkTo(methodOn(UserController.class).list()).withRel("users"); return Arrays.asList(self, users); } }
UserControllerUserLinks extends ResourceLinks<User> { @Override public Collection<Link> generateLinks(User entity) { Link self = linkTo(methodOn(UserController.class).get(entity.getId())).withSelfRel(); Link users = linkTo(methodOn(UserController.class).list()).withRel("users"); return Arrays.asList(self, users); } UserControllerUserLinks(); }
UserControllerUserLinks extends ResourceLinks<User> { @Override public Collection<Link> generateLinks(User entity) { Link self = linkTo(methodOn(UserController.class).get(entity.getId())).withSelfRel(); Link users = linkTo(methodOn(UserController.class).list()).withRel("users"); return Arrays.asList(self, users); } UserControllerUserLinks(); @Override Collection<Link> generateLinks(User entity); }
UserControllerUserLinks extends ResourceLinks<User> { @Override public Collection<Link> generateLinks(User entity) { Link self = linkTo(methodOn(UserController.class).get(entity.getId())).withSelfRel(); Link users = linkTo(methodOn(UserController.class).list()).withRel("users"); return Arrays.asList(self, users); } UserControllerUserLinks(); @Override Collection<Link> generateLinks(User entity);  }