SpringRestJobsService extends RestJobsService { @Override public String scheduleProcessInstanceJob(ProcessInstanceJobDescription description) { String callback = getCallbackEndpoint(description); LOGGER.debug("Job to be scheduled {} with callback URL {}", description, callback); Job job = JobBuilder.builder() .id(description.id()) .expirationTime(description.expirationTime().get()) .repeatInterval(description.expirationTime().repeatInterval()) .repeatLimit(description.expirationTime().repeatLimit()) .priority(0) .callbackEndpoint(callback) .processId(description.processId()) .processInstanceId(description.processInstanceId()) .rootProcessId(description.rootProcessId()) .rootProcessInstanceId(description.rootProcessInstanceId()) .build(); ResponseEntity<String> result = restTemplate.postForEntity(getJobsServiceUri(), job, String.class); if (result.getStatusCode().ordinal() == 200) { LOGGER.debug("Creating of the job {} done with status code {} ", job, result.getStatusCode()); } return job.getId(); } @Autowired  SpringRestJobsService(
            @Value("${kogito.jobs-service.url}") String jobServiceUrl,
            @Value("${kogito.service.url}") String callbackEndpoint,
            @Autowired(required=false) RestTemplate restTemplate);   SpringRestJobsService(); @PostConstruct void initialize(); @Override String scheduleProcessJob(ProcessJobDescription description); @Override String scheduleProcessInstanceJob(ProcessInstanceJobDescription description); @Override boolean cancelJob(String id); @Override ZonedDateTime getScheduledTime(String id);  }
@Test void testScheduleProcessInstanceJob() { when(restTemplate.postForEntity(any(URI.class), any(Job.class), eq(String.class))).thenReturn(ResponseEntity.ok().build()); ProcessInstanceJobDescription processInstanceJobDescription = ProcessInstanceJobDescription.of(123, ExactExpirationTime.now(), "processInstanceId", "processId"); tested.scheduleProcessInstanceJob(processInstanceJobDescription); ArgumentCaptor<Job> jobArgumentCaptor = forClass(Job.class); verify(restTemplate).postForEntity(eq(tested.getJobsServiceUri()), jobArgumentCaptor.capture(), eq(String.class)); Job job = jobArgumentCaptor.getValue(); assertThat(job.getId()).isEqualTo(processInstanceJobDescription.id()); }