예제 #1
0
  @Test
  public void shouldTriggerNotifyOnEventService() throws Exception {
    Rnr requisition = make(a(defaultRequisition));
    Order order = new Order(requisition);
    order.setStatus(READY_TO_PACK);

    OrderStatusChangeEvent event = mock(OrderStatusChangeEvent.class);
    whenNew(OrderStatusChangeEvent.class).withArguments(order).thenReturn(event);

    service.notifyForStatusChange(order);

    verify(eventService).notify(event);
  }
예제 #2
0
  private static OrderDTO getOrderForView(Order order) {
    OrderDTO orderDTO = new OrderDTO();
    orderDTO.setId(order.getId());
    orderDTO.setRnr(RnrDTO.prepareForOrderView(order.getRnr()));

    orderDTO.setCreatedDate(order.getCreatedDate());
    String createdDate =
        order.getCreatedDate() == null
            ? null
            : new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").format(order.getCreatedDate());
    orderDTO.setStringCreatedDate(createdDate);

    orderDTO.setStatus(order.getStatus());
    orderDTO.setFtpComment(order.getFtpComment());
    orderDTO.setSupplyLine(order.getSupplyLine());
    ShipmentFileInfo shipmentFileInfo = order.getShipmentFileInfo();
    if (shipmentFileInfo != null) orderDTO.setShipmentError(shipmentFileInfo.isProcessingError());
    if (order.getRnr().getFullSupplyLineItems().size() == 0
        && order.getRnr().getNonFullSupplyLineItems().size() == 0) {
      orderDTO.setProductsOrdered(false);
    } else {
      orderDTO.setProductsOrdered(true);
    }
    return orderDTO;
  }