DigitalObjectManager implements Serializable { public DigitalObject getCopyOfDataFilledDigitalObject(DigitalObject object) throws StorageException { if ((object.getPid() == null) || (object.getPid().equals(""))) { throw new InvalidParameterException("DigitalObject must have a pid set to be retrievable from a storage"); } byte[] digitalObjectBytes = byteStreamManager.load(object.getPid()); ByteStream digitalObjectByteStream = new ByteStream(); digitalObjectByteStream.setData(digitalObjectBytes); DigitalObject copyObject = object.clone(); copyObject.setData(digitalObjectByteStream); return copyObject; }  void moveDataToStorage(DigitalObject object); DigitalObject getCopyOfDataFilledDigitalObject(DigitalObject object); void setByteStreamManager(ByteStreamManager byteStreamManager);  }
@Test(expected = InvalidParameterException.class) public void getCopyOfDataFilledDigitalObject_digitalObjectWithoutPidCausesInvalidParameterException() throws StorageException { DigitalObject object = new DigitalObject(); object.setPid(""); DigitalObjectManager digitalObjectManager = new DigitalObjectManager(); digitalObjectManager.getCopyOfDataFilledDigitalObject(object); }