### Question:
ProjectDeployServiceImpl implements ProjectDeployService { @Override public Optional<ProjectDeploy> findByRegistrationToken(String registrationToken) { return projectDeployDao.findByRegistrationToken(registrationToken); }  @Override Optional<ProjectDeploy> findOrCreate(Integer projectId, Integer userId); @Override Optional<ProjectDeploy> findByRegistrationToken(String registrationToken);  }### Answer:
@Test public void find_by_registration_token_no_data() { assertThat(projectDeployService.findByRegistrationToken("not-exist-registration-token")).isEmpty(); ProjectDeploy deploy = new ProjectDeploy(); deploy.setUserId(1); deploy.setProjectId(1); deploy.setRegistrationToken("registration-token"); deploy.setDeployState(DeployState.UNDEPLOY); deploy.setCreateTime(LocalDateTime.now()); deploy.setCreateUserId(1); projectDeployDao.save(deploy); assertThat(projectDeployService.findByRegistrationToken("not-exist-registration-token")).isEmpty(); }
@Test public void find_by_registration_token_success() { ProjectDeploy deploy = new ProjectDeploy(); deploy.setRegistrationToken("registration-token"); deploy.setUserId(1); deploy.setProjectId(2); deploy.setCreateTime(LocalDateTime.now()); deploy.setCreateUserId(1); deploy.setDeployState(DeployState.UNDEPLOY); projectDeployDao.save(deploy); Optional<ProjectDeploy> deployOption = projectDeployService.findByRegistrationToken("registration-token"); assertThat(deployOption).isPresent(); }