RepositoryBookmarkService implements BookmarkService { @Override public Project addBookmarkToUser(User user, Project project) { user.addBookmark(project); userRepo.save(user); return project; } @Autowired  RepositoryBookmarkService(UserRepository userRepo); @Override Project addBookmarkToUser(User user, Project project); @Override void removeBookmarkOfUser(User user, Project project); @Override @Transactional(readOnly = true) List<Project> getBookmarksOfUser(User user); @Override @Transactional(readOnly = true) boolean userHasBookmark(User user, Project project); @Override void removeAllBookmarksOfUser(User user);  }
@Test public void addBookmarkToUserAddsBookmark() { Project actualProject = bookmarkService.addBookmarkToUser(userMock, projectMock); assertThat(actualProject).isEqualTo(projectMock); verify(userMock).addBookmark(projectMock); verify(userRepository).save(userMock); }