@Test public void shouldThrowErrorIfOrderIdIsBlank() { OrderPOD orderPod = new OrderPOD(1L); orderPod.setOrderId(null); List<OrderPODLineItem> orderPodLineItems = asList(new OrderPODLineItem(1L, "P100", 100)); orderPod.setPodLineItems(orderPodLineItems); expectedException.expect(DataException.class); expectedException.expectMessage("error.mandatory.fields.missing"); orderPod.validate(); }
public void validate() { if (orderId == null) { throw new DataException("error.mandatory.fields.missing"); } for (OrderPODLineItem lineItem : podLineItems) { lineItem.validate(); } }
OrderPOD extends BaseModel { public void validate() { if (orderId == null) { throw new DataException("error.mandatory.fields.missing"); } for (OrderPODLineItem lineItem : podLineItems) { lineItem.validate(); } } }
OrderPOD extends BaseModel { public void validate() { if (orderId == null) { throw new DataException("error.mandatory.fields.missing"); } for (OrderPODLineItem lineItem : podLineItems) { lineItem.validate(); } } OrderPOD(Long id);  OrderPOD(Long orderId, String orderNumber, Long userId); }
OrderPOD extends BaseModel { public void validate() { if (orderId == null) { throw new DataException("error.mandatory.fields.missing"); } for (OrderPODLineItem lineItem : podLineItems) { lineItem.validate(); } } 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 validate() { if (orderId == null) { throw new DataException("error.mandatory.fields.missing"); } for (OrderPODLineItem lineItem : podLineItems) { lineItem.validate(); } } 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);  }