### Question:
RepositoryFileServiceImpl implements RepositoryFileService { @Override public Optional<RepositoryFile> findReadme(Integer projectId) { return repositoryResourceDao.findByRepositoryIdAndParentIdAndResourceTypeAndAppTypeAndKeyIgnoreCase( projectId, Constant.TREE_ROOT_ID, RepositoryResourceType.FILE, AppType.UNKNOWN, RepositoryResource.README_KEY) .flatMap(resource -> { return repositoryFileDao.findByRepositoryResourceId(resource.getId()); }); }  @Override Optional<RepositoryFile> findReadme(Integer projectId);  }### Answer:
@Test public void find_readme_no_data() { Optional<RepositoryFile> fileOption = repositoryFileService.findReadme(9999); assertThat(fileOption).isEmpty(); }
@Test public void find_readme_success() { RepositoryResource resource = new RepositoryResource(); resource.setRepositoryId(9999); resource.setKey(RepositoryResource.README_KEY); resource.setName(RepositoryResource.README_NAME); resource.setAppType(AppType.UNKNOWN); resource.setResourceType(RepositoryResourceType.FILE); resource.setParentId(Constant.TREE_ROOT_ID); resource.setSeq(1); resource.setCreateUserId(1); resource.setCreateTime(LocalDateTime.now()); Integer savedProjectResourceId = repositorytResourceDao.save(resource).getId(); RepositoryFile file = new RepositoryFile(); file.setRepositoryResourceId(savedProjectResourceId); file.setContent("# Readme"); file.setFileType(FileType.MARKDOWN); repositoryFileDao.save(file); Optional<RepositoryFile> fileOption = repositoryFileService.findReadme(9999); assertThat(fileOption).isPresent(); }