### Question:
RepositoryServiceImpl implements RepositoryService { @Override public Optional<Repository> findById(Integer repositoryId) { return repositoryDao.findById(repositoryId); }  @Override Optional<Repository> find(String userName, String repositoryName); @Override Repository createRepository(UserInfo user, Repository project); @Override List<Repository> findCanAccessRepositoriesByUserId(Integer userId); @Override Optional<GitCommitInfo> findLatestCommitInfo(Repository repository, String relativeFilePath); @Override Optional<Repository> findById(Integer repositoryId);  }### Answer:
@Test public void find_by_id_no_data() { Optional<Repository> projectOption = repositoryService.findById(1); assertThat(projectOption).isEmpty(); }
@Test public void find_by_id_success() { Repository project = new Repository(); project.setName("project_name"); project.setIsPublic(true); project.setLastActiveTime(LocalDateTime.now()); project.setCreateUserId(1); project.setCreateTime(LocalDateTime.now()); Repository savedProject = repositoryDao.save(project); Optional<Repository> projectOption = repositoryService.findById(savedProject.getId()); assertThat(projectOption).isPresent(); }