WorkerService { public String registerWorker() { log.info("Registering new worker"); String workerName = nameGenerator.next(); log.info("Selected name for new worker: {}", workerName); Worker worker = new Worker(); worker.setName(workerName); workerDao.save(worker); return workerName; }  String registerWorker(); @Transactional void onHeartbeat(String name); void scheduleJobBuild(Build build, String stageName, Job job); @Transactional void assignJobBuildToWorker(JobBuild jobBuild); List<WorkerModel> getWorkers(int page, int size); WorkerModel getWorker(String name); @Transactional void deleteWorker(String name); @Transactional void readyWorker(Optional<Worker> workerOptional);  }
@Test public void shouldRegisterNewWorker() { String workerName = workerService.registerWorker(); Worker worker = workerDao.findByName(workerName).get(); assertThat(workerName).isNotEmpty(); assertThat(worker).isNotNull(); }