### Question:
ComponentRepoServiceImpl implements ComponentRepoService { @Override public Optional<ComponentRepo> findById(Integer componentRepoId) { return componentRepoDao.findById(componentRepoId); }  @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 find_by_id_no_data() { assertThat(componentRepoService.findById(1)).isEmpty(); }
@Test public void find_by_id_success() { 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()); ComponentRepo savedRepo = componentRepoDao.save(repo); assertThat(componentRepoService.findById(savedRepo.getId())).isPresent(); }