@Test public void shouldNotProcessTheRecordIfProgramCodeIsInvalid() throws Exception { configuration.setHeaderInFile(true); when(listReader.getRowNumber()).thenReturn(1).thenReturn(2); BudgetLineItemDTO lineItemDTO = mock(BudgetLineItemDTO.class); mockStatic(BudgetLineItemDTO.class); when(BudgetLineItemDTO.populate(csvRow, ediFileTemplate.getColumns())).thenReturn(lineItemDTO); when(lineItemDTO.getProgramCode()).thenReturn("P12345"); when(lineItemDTO.getFacilityCode()).thenReturn("F11"); Facility facility = new Facility(); facility.setCode("F11"); when(facilityService.getByCode(facility)).thenReturn(facility); when(programService.getByCode("P12345")).thenReturn(null); budgetFileProcessor.process(message); verify(lineItemDTO).checkMandatoryFields(); verify(transformer, never()).transform(lineItemDTO, null, 1); verify(BudgetLineItemDTO.populate(csvRow, ediFileTemplate.getColumns())); }
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);  }