### Question:
GitRepoPublishTaskServiceImpl implements GitRepoPublishTaskService { @Override public GitRepoPublishTask save(GitRepoPublishTask task) { Integer maxSeq = gitRepoPublishTaskDao .findFirstByGitUrlAndCreateUserIdOrderBySeqDesc(task.getGitUrl(), task.getCreateUserId()) .map(GitRepoPublishTask::getSeq) .orElse(0); task.setSeq(maxSeq + 1); return gitRepoPublishTaskDao.save(task); }  @Override GitRepoPublishTask save(GitRepoPublishTask task); @Override List<GitRepoPublishTask> findUserPublishingTasks(Integer userId); @Override Optional<GitRepoPublishTask> findById(Integer taskId);  }### Answer:
@Test public void save_success() { GitRepoPublishTask task = new GitRepoPublishTask(); task.setGitUrl("https: task.setStartTime(LocalDateTime.now()); task.setPublishResult(ReleaseResult.STARTED); task.setCreateTime(LocalDateTime.now()); task.setCreateUserId(1); GitRepoPublishTask savedTask = gitRepoPublishTaskService.save(task); assertThat(savedTask.getId()).isNotNull(); assertThat(savedTask.getSeq()).isEqualTo(1); }
@Test public void save_seq_increase() { GitRepoPublishTask task = new GitRepoPublishTask(); task.setGitUrl("https: task.setStartTime(LocalDateTime.now()); task.setPublishResult(ReleaseResult.STARTED); task.setCreateTime(LocalDateTime.now()); task.setCreateUserId(1); GitRepoPublishTask savedTask = gitRepoPublishTaskService.save(task); task = new GitRepoPublishTask(); task.setGitUrl("https: task.setStartTime(LocalDateTime.now()); task.setPublishType(PublishType.UPGRADE); task.setPublishResult(ReleaseResult.STARTED); task.setCreateTime(LocalDateTime.now()); task.setCreateUserId(1); savedTask = gitRepoPublishTaskService.save(task); assertThat(savedTask.getId()).isNotNull(); assertThat(savedTask.getSeq()).isEqualTo(2); }
@Test public void save_seq_start_from_1() { GitRepoPublishTask task = new GitRepoPublishTask(); task.setGitUrl("https: task.setStartTime(LocalDateTime.now()); task.setPublishResult(ReleaseResult.STARTED); task.setCreateTime(LocalDateTime.now()); task.setCreateUserId(1); GitRepoPublishTask savedTask = gitRepoPublishTaskService.save(task); assertThat(savedTask.getSeq()).isEqualTo(1); task = new GitRepoPublishTask(); task.setGitUrl("https: task.setStartTime(LocalDateTime.now()); task.setPublishResult(ReleaseResult.STARTED); task.setCreateTime(LocalDateTime.now()); task.setCreateUserId(1); savedTask = gitRepoPublishTaskService.save(task); assertThat(savedTask.getSeq()).isEqualTo(1); }