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