*/
public class SafeToReuseTestCase extends TestCase {
public void testReuseOnCloning() throws Exception
{
JBossObjectOutputStream out = new JBossObjectOutputStream(null);
SafeCloningRepository safeToReuse = new SafeCloningRepository(new SafeClone()
{
public boolean isSafeToReuse(Object obj) {
return (obj instanceof ChildObject);
}
});
RootObject first = new RootObject();
RootObject second = (RootObject)out.smartClone(first,safeToReuse);
assertTrue(first!=second);
assertEquals(first,second);
assertEquals(first.child,second.child);
assertTrue(first.child==second.child);