### Question:
ComponentRepoServiceImpl implements ComponentRepoService { @Override public boolean existsByCreateUserIdAndGitRepoUrl(Integer userId, String gitRepoUrl) { return componentRepoDao.existsByCreateUserIdAndGitRepoUrl(userId, gitRepoUrl); }  @Override Page<ComponentRepoInfo> findAllByGitRepoName(String queryGitRepoName, Pageable page); @Override List<ComponentRepoInfo> findUserComponentRepos(Integer userId); @Override boolean existsByCreateUserIdAndGitRepoUrl(Integer userId, String gitRepoUrl); @Override Optional<ComponentRepo> findById(Integer componentRepoId);  }### Answer:
@Test public void existsByCreateUserIdAndGitRepoUrl_not_exist() { assertThat(componentRepoService.existsByCreateUserIdAndGitRepoUrl(1, "git-url")).isFalse(); }
@Test public void existsByCreateUserIdAndGitRepoUrl_exist() { Integer createUserId = 1; String gitRepoUrl = "https: ComponentRepo repo = new ComponentRepo(); repo.setGitRepoUrl(gitRepoUrl); repo.setGitRepoWebsite("github.com"); repo.setGitRepoOwner("you"); repo.setGitRepoName("you-repo"); repo.setRepoType(RepoType.IDE); repo.setCategory(RepoCategory.WIDGET); repo.setCreateUserId(createUserId); repo.setCreateTime(LocalDateTime.now()); repo.setLastPublishTime(LocalDateTime.now()); componentRepoDao.save(repo); assertThat(componentRepoService.existsByCreateUserIdAndGitRepoUrl(createUserId, gitRepoUrl)).isTrue(); }