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