@Test public void shouldSearchOrdersByWarehouseIdsAndStatuses() throws Exception { List<Order> expectedOrders = asList(new Order()); when(orderMapper.getByWarehouseIdsAndStatuses("{3, 6}", "{RELEASED, READY_TO_PACK}",1L)).thenReturn(expectedOrders); List<Order> actualOrders = orderRepository.searchByWarehousesAndStatuses(asList(3l, 6l), asList(RELEASED, READY_TO_PACK),1L,0L); verify(orderMapper).getByWarehouseIdsAndStatuses("{3, 6}", "{RELEASED, READY_TO_PACK}",1L); assertThat(actualOrders, is(expectedOrders)); }
public List<Order> searchByWarehousesAndStatuses(List<Long> facilityIds, List<OrderStatus> orderStatuses, Long programId, Long facilityId) { if (facilityId != 0 && facilityId != null) { return orderMapper.getByWarehouseIdsAndStatusesByFacility(format(facilityIds.toString()), format(orderStatuses.toString()), programId, facilityId); } return orderMapper.getByWarehouseIdsAndStatuses(format(facilityIds.toString()), format(orderStatuses.toString()), programId); }
OrderRepository { public List<Order> searchByWarehousesAndStatuses(List<Long> facilityIds, List<OrderStatus> orderStatuses, Long programId, Long facilityId) { if (facilityId != 0 && facilityId != null) { return orderMapper.getByWarehouseIdsAndStatusesByFacility(format(facilityIds.toString()), format(orderStatuses.toString()), programId, facilityId); } return orderMapper.getByWarehouseIdsAndStatuses(format(facilityIds.toString()), format(orderStatuses.toString()), programId); } }
OrderRepository { public List<Order> searchByWarehousesAndStatuses(List<Long> facilityIds, List<OrderStatus> orderStatuses, Long programId, Long facilityId) { if (facilityId != 0 && facilityId != null) { return orderMapper.getByWarehouseIdsAndStatusesByFacility(format(facilityIds.toString()), format(orderStatuses.toString()), programId, facilityId); } return orderMapper.getByWarehouseIdsAndStatuses(format(facilityIds.toString()), format(orderStatuses.toString()), programId); }  }
OrderRepository { public List<Order> searchByWarehousesAndStatuses(List<Long> facilityIds, List<OrderStatus> orderStatuses, Long programId, Long facilityId) { if (facilityId != 0 && facilityId != null) { return orderMapper.getByWarehouseIdsAndStatusesByFacility(format(facilityIds.toString()), format(orderStatuses.toString()), programId, facilityId); } return orderMapper.getByWarehouseIdsAndStatuses(format(facilityIds.toString()), format(orderStatuses.toString()), programId); }  void save(Order order); List<Order> getOrdersForPage(int page, int pageSize, Long userId, String rightName); List<Order> getOrdersForPage(int page, int pageSize, Long userId, String right, Long supplyDepot, Long program, Long period); Order getById(Long id); void updateStatusAndShipmentIdForOrder(String orderNumber, OrderStatus status, Long shipmentId); List<OrderFileColumn> getOrderFileTemplate(); void saveOrderFileColumns(List<OrderFileColumn> orderFileColumns, Long userId); void updateOrderStatus(Order order); OrderStatus getStatus(String orderNumber); Integer getNumberOfPages(int pageSize); Integer getNumberOfPages(int pageSize, Long supplyDepot, Long program, Long period); List<Order> searchByWarehousesAndStatuses(List<Long> facilityIds, List<OrderStatus> orderStatuses, Long programId, Long facilityId); Order getByOrderNumber(String orderNumber); }
OrderRepository { public List<Order> searchByWarehousesAndStatuses(List<Long> facilityIds, List<OrderStatus> orderStatuses, Long programId, Long facilityId) { if (facilityId != 0 && facilityId != null) { return orderMapper.getByWarehouseIdsAndStatusesByFacility(format(facilityIds.toString()), format(orderStatuses.toString()), programId, facilityId); } return orderMapper.getByWarehouseIdsAndStatuses(format(facilityIds.toString()), format(orderStatuses.toString()), programId); }  void save(Order order); List<Order> getOrdersForPage(int page, int pageSize, Long userId, String rightName); List<Order> getOrdersForPage(int page, int pageSize, Long userId, String right, Long supplyDepot, Long program, Long period); Order getById(Long id); void updateStatusAndShipmentIdForOrder(String orderNumber, OrderStatus status, Long shipmentId); List<OrderFileColumn> getOrderFileTemplate(); void saveOrderFileColumns(List<OrderFileColumn> orderFileColumns, Long userId); void updateOrderStatus(Order order); OrderStatus getStatus(String orderNumber); Integer getNumberOfPages(int pageSize); Integer getNumberOfPages(int pageSize, Long supplyDepot, Long program, Long period); List<Order> searchByWarehousesAndStatuses(List<Long> facilityIds, List<OrderStatus> orderStatuses, Long programId, Long facilityId); Order getByOrderNumber(String orderNumber);  }