@Test public void shouldThrowErrorIfShippedDateIsDifferentFromFormat() { String shippedDate = "10/10/13 "; ShipmentLineItemDTO dto = new ShipmentLineItemDTO("11", "P111", "P151", "12", "34", "10/09/2013", shippedDate); expectException.expect(DataException.class); expectException.expectMessage("wrong.data.type"); new ShipmentLineItemTransformer().transform(dto, "MM/dd/yyyy", "MM/dd/yyyy", 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);  }