@Test public void shouldSaveOrderFileColumnsWithConfiguration() throws Exception { OrderConfiguration orderConfiguration = new OrderConfiguration(); List<OrderFileColumn> orderFileColumns = new ArrayList<>(); OrderFileTemplateDTO orderFileTemplateDTO = new OrderFileTemplateDTO(orderConfiguration, orderFileColumns); Long userId = 1L; orderService.saveOrderFileTemplate(orderFileTemplateDTO, userId); verify(orderConfigurationRepository).update(orderConfiguration); verify(orderRepository).saveOrderFileColumns(orderFileColumns, userId); }
@Transactional public void saveOrderFileTemplate(OrderFileTemplateDTO orderFileTemplateDTO, Long userId) { OrderConfiguration orderConfiguration = orderFileTemplateDTO.getOrderConfiguration(); orderConfiguration.setModifiedBy(userId); orderConfigurationRepository.update(orderConfiguration); orderRepository.saveOrderFileColumns(orderFileTemplateDTO.getOrderFileColumns(), userId); }
OrderService { @Transactional public void saveOrderFileTemplate(OrderFileTemplateDTO orderFileTemplateDTO, Long userId) { OrderConfiguration orderConfiguration = orderFileTemplateDTO.getOrderConfiguration(); orderConfiguration.setModifiedBy(userId); orderConfigurationRepository.update(orderConfiguration); orderRepository.saveOrderFileColumns(orderFileTemplateDTO.getOrderFileColumns(), userId); } }
OrderService { @Transactional public void saveOrderFileTemplate(OrderFileTemplateDTO orderFileTemplateDTO, Long userId) { OrderConfiguration orderConfiguration = orderFileTemplateDTO.getOrderConfiguration(); orderConfiguration.setModifiedBy(userId); orderConfigurationRepository.update(orderConfiguration); orderRepository.saveOrderFileColumns(orderFileTemplateDTO.getOrderFileColumns(), userId); }  }
OrderService { @Transactional public void saveOrderFileTemplate(OrderFileTemplateDTO orderFileTemplateDTO, Long userId) { OrderConfiguration orderConfiguration = orderFileTemplateDTO.getOrderConfiguration(); orderConfiguration.setModifiedBy(userId); orderConfigurationRepository.update(orderConfiguration); orderRepository.saveOrderFileColumns(orderFileTemplateDTO.getOrderFileColumns(), userId); }  @Autowired void setPageSize(@Value("${order.page.size}") String pageSize); @Transactional void convertToOrder(List<Rnr> rnrList, Long userId); List<Order> getOrdersForPage(int page, Long userId, String rightName); List<Order> getOrdersForPage(int page, Long userId, String right, Long supplyDepot, Long program, Long period); Order getOrder(Long id); void updateStatusAndShipmentIdForOrders(Set<String> orderNumbers, ShipmentFileInfo shipmentFileInfo); OrderFileTemplateDTO getOrderFileTemplateDTO(); @Transactional void saveOrderFileTemplate(OrderFileTemplateDTO orderFileTemplateDTO, Long userId); OrderNumberConfiguration getOrderNumberConfiguration(); @Transactional void updateOrderNumberConfiguration(OrderNumberConfiguration orderNumberConfiguration); Set<DateFormat> getAllDateFormats(); void updateOrderStatus(Order order); boolean isShippable(String orderNumber); Integer getNumberOfPages(); Integer getNumberOfPages(Long supplyDepot, Long program, Long period); Integer getPageSize(); List<Order> searchByStatusAndRight(Long userId, String rightName, List<OrderStatus> statuses, Long programId, Long facilityId); boolean hasStatus(String orderNumber, OrderStatus... statuses); Order getByOrderNumber(String orderNumber); }
OrderService { @Transactional public void saveOrderFileTemplate(OrderFileTemplateDTO orderFileTemplateDTO, Long userId) { OrderConfiguration orderConfiguration = orderFileTemplateDTO.getOrderConfiguration(); orderConfiguration.setModifiedBy(userId); orderConfigurationRepository.update(orderConfiguration); orderRepository.saveOrderFileColumns(orderFileTemplateDTO.getOrderFileColumns(), userId); }  @Autowired void setPageSize(@Value("${order.page.size}") String pageSize); @Transactional void convertToOrder(List<Rnr> rnrList, Long userId); List<Order> getOrdersForPage(int page, Long userId, String rightName); List<Order> getOrdersForPage(int page, Long userId, String right, Long supplyDepot, Long program, Long period); Order getOrder(Long id); void updateStatusAndShipmentIdForOrders(Set<String> orderNumbers, ShipmentFileInfo shipmentFileInfo); OrderFileTemplateDTO getOrderFileTemplateDTO(); @Transactional void saveOrderFileTemplate(OrderFileTemplateDTO orderFileTemplateDTO, Long userId); OrderNumberConfiguration getOrderNumberConfiguration(); @Transactional void updateOrderNumberConfiguration(OrderNumberConfiguration orderNumberConfiguration); Set<DateFormat> getAllDateFormats(); void updateOrderStatus(Order order); boolean isShippable(String orderNumber); Integer getNumberOfPages(); Integer getNumberOfPages(Long supplyDepot, Long program, Long period); Integer getPageSize(); List<Order> searchByStatusAndRight(Long userId, String rightName, List<OrderStatus> statuses, Long programId, Long facilityId); boolean hasStatus(String orderNumber, OrderStatus... statuses); Order getByOrderNumber(String orderNumber); static String SUPPLY_LINE_MISSING_COMMENT; }