@Test public void userHasBookmarkReturnsTrueWhenBookmarkExists() { given(userMock.getId()).willReturn(USER_ID); given(userRepository.existsByIdAndBookmarksContaining(USER_ID, projectMock)).willReturn(true); boolean actualHasBookmarked = bookmarkService.userHasBookmark(userMock, projectMock); assertThat(actualHasBookmarked).isTrue(); }
@Override @Transactional(readOnly = true) public boolean userHasBookmark(User user, Project project) { return userRepo.existsByIdAndBookmarksContaining(user.getId(), project); }
RepositoryBookmarkService implements BookmarkService { @Override @Transactional(readOnly = true) public boolean userHasBookmark(User user, Project project) { return userRepo.existsByIdAndBookmarksContaining(user.getId(), project); } }
RepositoryBookmarkService implements BookmarkService { @Override @Transactional(readOnly = true) public boolean userHasBookmark(User user, Project project) { return userRepo.existsByIdAndBookmarksContaining(user.getId(), project); } @Autowired  RepositoryBookmarkService(UserRepository userRepo); }
RepositoryBookmarkService implements BookmarkService { @Override @Transactional(readOnly = true) public boolean userHasBookmark(User user, Project project) { return userRepo.existsByIdAndBookmarksContaining(user.getId(), 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); }
RepositoryBookmarkService implements BookmarkService { @Override @Transactional(readOnly = true) public boolean userHasBookmark(User user, Project project) { return userRepo.existsByIdAndBookmarksContaining(user.getId(), 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);  }