@Test public void shouldThrowDataExceptionForDuplicateRnrToOrderConversion() { Order order = new Order(); doThrow(new DuplicateKeyException("Error updating database.")).when(orderMapper).insert(order); exception.expect(DataException.class); exception.expectMessage("msg.rnr.already.converted.to.order"); orderRepository.save(order); verify(orderMapper).insert(order); }
public void save(Order order) { try { orderMapper.insert(order); } catch (DuplicateKeyException dke) { throw new DataException("msg.rnr.already.converted.to.order"); } }
OrderRepository { public void save(Order order) { try { orderMapper.insert(order); } catch (DuplicateKeyException dke) { throw new DataException("msg.rnr.already.converted.to.order"); } } }
OrderRepository { public void save(Order order) { try { orderMapper.insert(order); } catch (DuplicateKeyException dke) { throw new DataException("msg.rnr.already.converted.to.order"); } }  }
OrderRepository { public void save(Order order) { try { orderMapper.insert(order); } catch (DuplicateKeyException dke) { throw new DataException("msg.rnr.already.converted.to.order"); } }  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 void save(Order order) { try { orderMapper.insert(order); } catch (DuplicateKeyException dke) { throw new DataException("msg.rnr.already.converted.to.order"); } }  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);  }