SendPaycheckProcessor implements ItemProcessor<TaxWebserviceCallResult, PayCheck> { @Override public PayCheck process(TaxWebserviceCallResult taxWebserviceCallResult) throws EmailSenderException, PDFGenerationException { Resource resource = resourceLoader.getResource(paycheckTemplateFileName); TaxCalculation taxCalculation = taxWebserviceCallResult.getTaxCalculation(); byte[] pdfBytes = pdfGeneratorService.generatePdfAsByteArray(resource, getPayCheckPdfContext(taxCalculation)); emailSenderService.send(getEmailTO(taxCalculation, pdfBytes)); return PayCheck.from(stepExecution.getJobExecutionId(), taxCalculation, pdfBytes); }  @Override PayCheck process(TaxWebserviceCallResult taxWebserviceCallResult); String getEmailBodyForEmployee(TaxCalculation taxCalculation);  }
@Test public void givenAnEmployee_whenProcessEmployee_thenJobExecutionIdIsSetOnPaycheck() throws Exception { PayCheck payCheck = sendPaycheckProcessor.process(taxWebserviceCallResult); assertThat(payCheck.getJobExecutionId()).isEqualTo(jobExecutionId); }