### Question:
AppServiceImpl implements AppService { @Override public Optional<App> findById(int appId) { return appDao.findById(appId); }  @Override Optional<App> findById(int appId); @Override Optional<App> findByAppName(String appName); @Override Optional<App> findByProjectId(Integer projectId);  }### Answer:
@Test public void find_by_id_no_data() { Optional<App> appOption = appService.findById(9999); assertThat(appOption.isEmpty()).isTrue(); App app = new App(); app.setAppName("app"); app.setCreateUserId(1); app.setCreateTime(LocalDateTime.now()); appDao.save(app); appOption = appService.findById(app.getId() + 1); assertThat(appOption).isEmpty(); }
@Test public void find_by_id_success() { App app = new App(); app.setAppName("app"); app.setCreateUserId(1); app.setCreateTime(LocalDateTime.now()); Optional<App> appOption = appService.findById(appDao.save(app).getId()); assertThat(appOption).isPresent(); }