@Test public void shouldFillPODLineItemsOnlyWithNonZeroPackToShip() throws Exception { Long createdBy = 1L; RnrLineItem rnrLineItem1 = make(a(defaultRnrLineItem, with(packsToShip, 10))); RnrLineItem rnrLineItem2 = make(a(defaultRnrLineItem, with(packsToShip, 0))); List<RnrLineItem> rnrLineItems = asList(rnrLineItem1, rnrLineItem2); whenNew(OrderPODLineItem.class).withArguments(rnrLineItem1, createdBy).thenReturn(mock(OrderPODLineItem.class)); OrderPOD orderPOD = new OrderPOD(); orderPOD.fillPODLineItems(rnrLineItems); assertThat(orderPOD.getPodLineItems().size(), is(1)); }
public void fillPODLineItems(List<? extends LineItem> lineItems) { this.podLineItems = new ArrayList<>(); for (LineItem lineItem : lineItems) { if (!validPacksToShip(lineItem)) continue; this.podLineItems.add(new OrderPODLineItem(lineItem, this.createdBy)); } }
OrderPOD extends BaseModel { public void fillPODLineItems(List<? extends LineItem> lineItems) { this.podLineItems = new ArrayList<>(); for (LineItem lineItem : lineItems) { if (!validPacksToShip(lineItem)) continue; this.podLineItems.add(new OrderPODLineItem(lineItem, this.createdBy)); } } }
OrderPOD extends BaseModel { public void fillPODLineItems(List<? extends LineItem> lineItems) { this.podLineItems = new ArrayList<>(); for (LineItem lineItem : lineItems) { if (!validPacksToShip(lineItem)) continue; this.podLineItems.add(new OrderPODLineItem(lineItem, this.createdBy)); } } OrderPOD(Long id);  OrderPOD(Long orderId, String orderNumber, Long userId); }
OrderPOD extends BaseModel { public void fillPODLineItems(List<? extends LineItem> lineItems) { this.podLineItems = new ArrayList<>(); for (LineItem lineItem : lineItems) { if (!validPacksToShip(lineItem)) continue; this.podLineItems.add(new OrderPODLineItem(lineItem, this.createdBy)); } } OrderPOD(Long id);  OrderPOD(Long orderId, String orderNumber, Long userId); void validate(); void fillPOD(Rnr requisition); void fillPODLineItems(List<? extends LineItem> lineItems); void copy(OrderPOD orderPOD); @JsonIgnore String getStringReceivedDate(); Date trimHoursFromDate(Date receivedDate); }
OrderPOD extends BaseModel { public void fillPODLineItems(List<? extends LineItem> lineItems) { this.podLineItems = new ArrayList<>(); for (LineItem lineItem : lineItems) { if (!validPacksToShip(lineItem)) continue; this.podLineItems.add(new OrderPODLineItem(lineItem, this.createdBy)); } } OrderPOD(Long id);  OrderPOD(Long orderId, String orderNumber, Long userId); void validate(); void fillPOD(Rnr requisition); void fillPODLineItems(List<? extends LineItem> lineItems); void copy(OrderPOD orderPOD); @JsonIgnore String getStringReceivedDate(); Date trimHoursFromDate(Date receivedDate);  }