### Question:
ComponentRepoVersionServiceImpl implements ComponentRepoVersionService { @Override public Optional<ComponentRepoVersion> findById(Integer componentRepoVersionId) { return componentRepoVersionDao.findById(componentRepoVersionId); }  @Override Optional<ComponentRepoVersion> findById(Integer componentRepoVersionId); @Override List<ComponentRepoVersion> findAllByComponentRepoId(Integer componentRepoId); @Override Optional<ComponentRepoVersion> findLatestVersion(Integer componentRepoId); @Override Optional<ComponentRepoVersion> findByComponentIdAndVersion(Integer componentRepoId, String version);  }### Answer:
@Test public void findById_no_data() { assertThat(componentRepoVersionService.findById(1)).isEmpty(); }
@Test public void findById_success() { ComponentRepoVersion version = new ComponentRepoVersion(); version.setApiRepoVersionId(1); version.setComponentRepoId(1); version.setName("a component repo"); version.setVersion("0.1.0"); version.setGitTagName("v0.1.0"); version.setAppType(AppType.WEB); version.setBuild("dojo"); version.setCreateUserId(1); version.setCreateTime(LocalDateTime.now()); version.setLastPublishTime(LocalDateTime.now()); ComponentRepoVersion savedVersion = componentRepoVersionDao.save(version); assertThat(componentRepoVersionService.findById(savedVersion.getId())).isPresent(); }