JobBuildService { public boolean isStopped(Long id) { JobBuild jobBuild = jobBuildDao.findOne(id); return jobBuild == null || jobBuild.isStopped(); }  @Transactional void prepareJobs(Build build, Dickfile dickfile); @Transactional void buildStage(Build build, Dickfile dickfile, Stage stage); @Transactional Optional<BuildOrder> peekBuildFor(String workerName); boolean isStopped(Long id); @Transactional void reportProgress(Long id, String partialLog); @Transactional void reportFailure(Long id, String fullLog); @Transactional void reportSuccess(Long id, String fullLog); Build.Status updateBuildStatus(Build build); @Transactional void stop(Build build); @Transactional List<LogChunkModel> getLogChunks(Long id, Date creationDate); @Transactional OutputModel getOutput(Long id); @Transactional void deleteJobBuilds(Build build);  }
@Test public void shouldReturnStoppedStatus() { Worker worker = produceWorker(Worker.Status.BUSY); Build build = produceBuild(); JobBuild jobBuild = produceJobBuild(worker, build, JobBuild.Status.STOPPED); boolean stopped = jobBuildService.isStopped(jobBuild.getId()); assertThat(stopped).isTrue(); }
@Test public void shouldReturnNotStoppedStatus() { Worker worker = produceWorker(Worker.Status.BUSY); Build build = produceBuild(); JobBuild jobBuild = produceJobBuild(worker, build, JobBuild.Status.IN_PROGRESS); boolean stopped = jobBuildService.isStopped(jobBuild.getId()); assertThat(stopped).isFalse(); }