### Question:
JobResource extends AbstractJobResource { List<JobCompletionModel.FhirExtension> buildJobExtension(List<JobQueueBatch> batches) { final var submitTime = batches.stream() .map(b -> b.getSubmitTime().orElse(OffsetDateTime.MIN)) .min(OffsetDateTime::compareTo) .orElse(OffsetDateTime.MIN); final var completeTime = batches.stream() .map(b -> b.getCompleteTime().orElse(OffsetDateTime.MIN)) .max(OffsetDateTime::compareTo) .orElse(OffsetDateTime.MIN); if (submitTime.isEqual(OffsetDateTime.MIN) || completeTime.isEqual(OffsetDateTime.MIN)) { return Collections.emptyList(); } return List.of( new JobCompletionModel.FhirExtension(JobCompletionModel.SUBMIT_TIME_URL, submitTime), new JobCompletionModel.FhirExtension(JobCompletionModel.COMPLETE_TIME_URL, completeTime)); } @Inject  JobResource(IJobQueue queue, @APIV1 String baseURL); @Override @Path("/{jobID}") @GET @Timed @ExceptionMetered @ApiOperation(value = "Check export job status", notes = "This endpoint is used to query the status of a given Export operation. " + "When the job is in progress, the API returns a 202 status." + "When completed, an output response is returned, which contains the necessary metadata for retrieving any output files.") @ApiResponses({ @ApiResponse(code = 200, message = "Export job has completed. Any failures are listed in the response body", response = JobCompletionModel.class), @ApiResponse(code = 202, message = "Export job is in progress. X-Progress header is present with the format \"<STATUS>: <50.00%>\""), @ApiResponse(code = 404, message = "Export job cannot be found"), @ApiResponse(code = 410, message = "Job has expired"), @ApiResponse(code = 500, message = "Export job has failed with no results") }) Response checkJobStatus(@Auth OrganizationPrincipal organizationPrincipal, @PathParam("jobID") @NoHtml String jobID); static OffsetDateTime getLatestBatchCompleteTime(List<JobQueueBatch> batches); static final int JOB_EXPIRATION_HOURS; static final DateTimeFormatter HTTP_DATE_FORMAT; }### Answer:
@Test public void testBuildJobExtension() { final var resource = new JobResource(null, ""); final var batch = new JobQueueBatch( UUID.randomUUID(), UUID.randomUUID(), "1", Collections.emptyList(), Collections.emptyList(), null, OffsetDateTime.now()); final var aggregatorId = UUID.randomUUID(); batch.setRunningStatus(aggregatorId); batch.setCompletedStatus(aggregatorId); List<JobCompletionModel.FhirExtension> extension = resource.buildJobExtension(Collections.singletonList(batch)); assertAll( () -> assertEquals(JobCompletionModel.SUBMIT_TIME_URL, extension.get(0).getUrl()), () -> assertEquals(batch.getSubmitTime().orElseThrow(), extension.get(0).getValueDateTime()), () -> assertEquals(JobCompletionModel.COMPLETE_TIME_URL, extension.get(1).getUrl()), () -> assertEquals(batch.getCompleteTime().orElseThrow(), extension.get(1).getValueDateTime())); }