public void testToAndFromString() throws Exception
{
Locale locale = I18NUtil.getLocale();
String localeStr = DefaultTypeConverter.INSTANCE.convert(String.class, locale);
ContentData property = new ContentData(null, null, 0L, null, null);
String propertyStr = property.toString();
assertEquals("Null values not converted correctly",
"contentUrl=|mimetype=|size=0|encoding=|locale=" + localeStr,
propertyStr);
ContentData checkProperty = ContentData.createContentProperty(propertyStr);
assertEquals("Conversion from string failed", property, checkProperty);
property = new ContentData("test://uuu", "mmm", 123L, "eee", I18NUtil.getLocale());
propertyStr = property.toString();
assertEquals("Incorrect property string representation",
"contentUrl=test://uuu|mimetype=mmm|size=123|encoding=eee|locale=" + localeStr, propertyStr);
checkProperty = ContentData.createContentProperty(propertyStr);
assertEquals("Conversion from string failed", property, checkProperty);
}