public void testStoreAndDelete() throws Exception
{
String contents = "This is the text that travels in the Message body";
// toEpr for files must be a directory
FileEpr toEpr = new FileEpr(_tmpDir.toURI());
toEpr.setInputSuffix(TEST_SUFFIX);
Message msg = MessageFactory.getInstance().getMessage();
msg.getBody().add(contents.getBytes());
msg.getBody().add("exampleObj", new ExampleObject("hello", 1234));
Call call = new Call(toEpr);
final String uid = UUID.randomUUID().toString();
call.setMessageID(new URI(uid));
msg.getHeader().setCall(call);
CourierUtil.deliverMessage(msg);
File theFile = new File(_tmpDir,uid+TEST_SUFFIX);
Assert.assertTrue(theFile.exists());
_logger.info("Message file "+theFile.toString()+" successfully created");
FileEpr fromEpr = new FileEpr(toEpr.getURI());
fromEpr.setInputSuffix(TEST_SUFFIX);
// setting postdelete to true will delete input Message files, if they were picked up
fromEpr.setPostDelete(true);
TwoWayCourier pickUp = CourierFactory.getPickupCourier(fromEpr);
Message retrieved = pickUp.pickup(1000);
Assert.assertFalse("Null message retrieved",null==retrieved);