SpringRestJobsService extends RestJobsService { @Override public ZonedDateTime getScheduledTime(String id) { try { return restTemplate.getForObject(getJobsServiceUri() + "/{id}", Job.class, id).getExpirationTime(); } catch (NotFound e) { throw new JobNotFoundException(id); } catch (RestClientException e) { throw new RuntimeException(e); } } @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 testGetScheduleTime() { Job job = new Job(); job.setId("123"); job.setExpirationTime(ZonedDateTime.now()); when(restTemplate.getForObject(any(), any(), anyString())).thenReturn(job); ZonedDateTime scheduledTime = tested.getScheduledTime("123"); assertThat(scheduledTime).isEqualTo(job.getExpirationTime()); verify(restTemplate).getForObject(tested.getJobsServiceUri() + "/{id}", Job.class, "123"); }
@Test void testGetScheduleTimeJobNotFound() { when(restTemplate.getForObject(any(), any(), anyString())).thenThrow(NotFound.class); assertThatThrownBy(() -> tested.getScheduledTime("123")).isInstanceOf(JobNotFoundException.class); verify(restTemplate).getForObject(tested.getJobsServiceUri() + "/{id}", Job.class, "123"); }