@Test public void shouldNotProcessRecordIfPeriodDateDoesNotBelongToAnyPeriod() throws Exception { when(listReader.read()).thenReturn(csvRow).thenReturn(null); when(listReader.getRowNumber()).thenReturn(1).thenReturn(2); configuration.setHeaderInFile(true); BudgetLineItemDTO lineItemDTO = mock(BudgetLineItemDTO.class); mockStatic(BudgetLineItemDTO.class); when(BudgetLineItemDTO.populate(csvRow, ediFileTemplate.getColumns())).thenReturn(lineItemDTO); Facility facility = new Facility(); facility.setCode("F10"); when(lineItemDTO.getFacilityCode()).thenReturn("F10'"); when(facilityService.getByCode(facility)).thenReturn(facility); Program program = new Program(); when(programService.getByCode("HIV")).thenReturn(program); BudgetLineItem budgetLineItem = new BudgetLineItem(); budgetLineItem.setPeriodDate(new Date()); when(transformer.transform(lineItemDTO, dateFormat, 1)).thenReturn(budgetLineItem); when(processingScheduleService.getPeriodForDate(facility, program, budgetLineItem.getPeriodDate())).thenReturn(null); budgetFileProcessor.process(message); verify(lineItemDTO).checkMandatoryFields(); assertThat(budgetLineItem.getPeriodId(), is(nullValue())); }
public void process(Message message) throws Exception { File budgetFile = (File) message.getPayload(); logger.debug("processing Budget File " + budgetFile.getName()); BudgetFileInfo budgetFileInfo = saveBudgetFile(budgetFile, false); Boolean processingError = getSpringProxy().processBudgetFile(budgetFile, budgetFileInfo); budgetFileInfo.setProcessingError(processingError); budgetFilePostProcessHandler.process(budgetFileInfo, budgetFile); }
BudgetFileProcessor { public void process(Message message) throws Exception { File budgetFile = (File) message.getPayload(); logger.debug("processing Budget File " + budgetFile.getName()); BudgetFileInfo budgetFileInfo = saveBudgetFile(budgetFile, false); Boolean processingError = getSpringProxy().processBudgetFile(budgetFile, budgetFileInfo); budgetFileInfo.setProcessingError(processingError); budgetFilePostProcessHandler.process(budgetFileInfo, budgetFile); } }
BudgetFileProcessor { public void process(Message message) throws Exception { File budgetFile = (File) message.getPayload(); logger.debug("processing Budget File " + budgetFile.getName()); BudgetFileInfo budgetFileInfo = saveBudgetFile(budgetFile, false); Boolean processingError = getSpringProxy().processBudgetFile(budgetFile, budgetFileInfo); budgetFileInfo.setProcessingError(processingError); budgetFilePostProcessHandler.process(budgetFileInfo, budgetFile); }  }
BudgetFileProcessor { public void process(Message message) throws Exception { File budgetFile = (File) message.getPayload(); logger.debug("processing Budget File " + budgetFile.getName()); BudgetFileInfo budgetFileInfo = saveBudgetFile(budgetFile, false); Boolean processingError = getSpringProxy().processBudgetFile(budgetFile, budgetFileInfo); budgetFileInfo.setProcessingError(processingError); budgetFilePostProcessHandler.process(budgetFileInfo, budgetFile); }  void process(Message message); @Transactional Boolean processBudgetFile(File budgetFile, BudgetFileInfo budgetFileInfo); }
BudgetFileProcessor { public void process(Message message) throws Exception { File budgetFile = (File) message.getPayload(); logger.debug("processing Budget File " + budgetFile.getName()); BudgetFileInfo budgetFileInfo = saveBudgetFile(budgetFile, false); Boolean processingError = getSpringProxy().processBudgetFile(budgetFile, budgetFileInfo); budgetFileInfo.setProcessingError(processingError); budgetFilePostProcessHandler.process(budgetFileInfo, budgetFile); }  void process(Message message); @Transactional Boolean processBudgetFile(File budgetFile, BudgetFileInfo budgetFileInfo);  }