@Test public void shouldThrowErrorIfQuantityShippedIsMissing() { ShipmentLineItemDTO dto = dtoWithAllFields(); dto.setQuantityShipped(null); expectException.expect(DataException.class); expectException.expectMessage("error.mandatory.fields.missing"); transformer.transform(dto, SIMPLE_DATE_FORMAT, SIMPLE_DATE_FORMAT, new Date()); }
public ShipmentLineItem transform(ShipmentLineItemDTO shipmentLineItemDTO, String packedDateFormat, String shippedDateFormat, Date creationDate) throws DataException { shipmentLineItemDTO.checkMandatoryFields(); ShipmentLineItem lineItem = new ShipmentLineItem(); try { setMandatoryFields(lineItem, shipmentLineItemDTO); setOptionalFields(lineItem, shipmentLineItemDTO, packedDateFormat, shippedDateFormat, creationDate); } catch (DataException e) { throw e; } catch (Exception e) { throw new DataException("wrong.data.type"); } return lineItem; }
ShipmentLineItemTransformer extends LineItemTransformer { public ShipmentLineItem transform(ShipmentLineItemDTO shipmentLineItemDTO, String packedDateFormat, String shippedDateFormat, Date creationDate) throws DataException { shipmentLineItemDTO.checkMandatoryFields(); ShipmentLineItem lineItem = new ShipmentLineItem(); try { setMandatoryFields(lineItem, shipmentLineItemDTO); setOptionalFields(lineItem, shipmentLineItemDTO, packedDateFormat, shippedDateFormat, creationDate); } catch (DataException e) { throw e; } catch (Exception e) { throw new DataException("wrong.data.type"); } return lineItem; } }
ShipmentLineItemTransformer extends LineItemTransformer { public ShipmentLineItem transform(ShipmentLineItemDTO shipmentLineItemDTO, String packedDateFormat, String shippedDateFormat, Date creationDate) throws DataException { shipmentLineItemDTO.checkMandatoryFields(); ShipmentLineItem lineItem = new ShipmentLineItem(); try { setMandatoryFields(lineItem, shipmentLineItemDTO); setOptionalFields(lineItem, shipmentLineItemDTO, packedDateFormat, shippedDateFormat, creationDate); } catch (DataException e) { throw e; } catch (Exception e) { throw new DataException("wrong.data.type"); } return lineItem; }  }
ShipmentLineItemTransformer extends LineItemTransformer { public ShipmentLineItem transform(ShipmentLineItemDTO shipmentLineItemDTO, String packedDateFormat, String shippedDateFormat, Date creationDate) throws DataException { shipmentLineItemDTO.checkMandatoryFields(); ShipmentLineItem lineItem = new ShipmentLineItem(); try { setMandatoryFields(lineItem, shipmentLineItemDTO); setOptionalFields(lineItem, shipmentLineItemDTO, packedDateFormat, shippedDateFormat, creationDate); } catch (DataException e) { throw e; } catch (Exception e) { throw new DataException("wrong.data.type"); } return lineItem; }  ShipmentLineItem transform(ShipmentLineItemDTO shipmentLineItemDTO,
                                    String packedDateFormat,
                                    String shippedDateFormat,
                                    Date creationDate); }
ShipmentLineItemTransformer extends LineItemTransformer { public ShipmentLineItem transform(ShipmentLineItemDTO shipmentLineItemDTO, String packedDateFormat, String shippedDateFormat, Date creationDate) throws DataException { shipmentLineItemDTO.checkMandatoryFields(); ShipmentLineItem lineItem = new ShipmentLineItem(); try { setMandatoryFields(lineItem, shipmentLineItemDTO); setOptionalFields(lineItem, shipmentLineItemDTO, packedDateFormat, shippedDateFormat, creationDate); } catch (DataException e) { throw e; } catch (Exception e) { throw new DataException("wrong.data.type"); } return lineItem; }  ShipmentLineItem transform(ShipmentLineItemDTO shipmentLineItemDTO,
                                    String packedDateFormat,
                                    String shippedDateFormat,
                                    Date creationDate);  }