ObjectMetadataValueTranslator extends ValueTranslatorImp { @Override public void setValue(AdaptrisMessage message, Object value) { if(!StringUtils.isEmpty(metadataKey)) message.addObjectHeader(this.getMetadataKey(), value); else log.warn("No metadata key set for metadata-value-translator, no translation occuring."); } ObjectMetadataValueTranslator();  ObjectMetadataValueTranslator(String metadataKey, String type); @Override Object getValue(AdaptrisMessage message); @Override void setValue(AdaptrisMessage message, Object value); String getMetadataKey(); void setMetadataKey(String metadataKey);  }
@Test public void testSetValue() throws Exception { String newMetadataKey = "NewMetadataKey"; String expectedValue = "NewValue"; objectMetadataValueTranslator.setMetadataKey(newMetadataKey); objectMetadataValueTranslator.setType("java.lang.String"); objectMetadataValueTranslator.setValue(message, expectedValue); String newValue = (String) objectMetadataValueTranslator.getValue(message); assertEquals(expectedValue, newValue); }
@Test public void testSetValueNoMetadataKey() throws Exception { String newValue = "NewValue"; objectMetadataValueTranslator.setType("java.lang.String"); objectMetadataValueTranslator.setValue(message, newValue); }