IElementSerializer elementSerializer = new StandardSerializer();
IElementAttributes attr = new ElementAttributes();
attr.setMaxLifeSeconds( 34 );
ICacheElement before = new CacheElement( cacheName, key, value );
before.setElementAttributes( attr );
ICacheElementSerialized serialized = SerializationConversionUtil.getSerializedCacheElement( before,
elementSerializer );
assertNotNull( "Should have a serialized object.", serialized );
System.out.println( "testSimpleConversion, " + serialized );
ICacheElement after = SerializationConversionUtil.getDeSerializedCacheElement( serialized, elementSerializer );
assertNotNull( "Should have a deserialized object.", after );
assertEquals( "Values should be the same.", before.getVal(), after.getVal() );
assertEquals( "Attributes should be the same.", before.getElementAttributes().getMaxLifeSeconds(), after
.getElementAttributes().getMaxLifeSeconds() );
assertEquals( "Keys should be the same.", before.getKey(), after.getKey() );
assertEquals( "Cache name should be the same.", before.getCacheName(), after.getCacheName() );
}