Object obj4 = new String( "replpush.obj4" );
Object obj8 = new String( "obj8" );
Object obj9 = new String( "obj9" );
Digester d = new Digester();
d.setStackAction( action );
assertEquals( 0, action.events.size() );
d.push( obj1 );
d.push( obj2 );
d.push( obj3 );
d.push( obj4 );
assertNotNull( d.peek( 0 ) );
// for obj4, a copy should have been pushed
assertNotSame( obj4, d.peek( 0 ) );
assertEquals( obj4, d.peek( 0 ) );
// for obj3, replacement only occurs on pop
assertSame( obj3, d.peek( 1 ) );
assertSame( obj2, d.peek( 2 ) );
assertSame( obj1, d.peek( 3 ) );
Object obj4a = d.pop();
Object obj3a = d.pop();
Object obj2a = d.pop();
Object obj1a = d.pop();
assertFalse( obj4 == obj4a );
assertEquals( obj4, obj4a );
assertFalse( obj3 == obj4a );
assertEquals( obj3, obj3a );
assertSame( obj2, obj2a );
assertSame( obj1, obj1a );
d.push( "stack1", obj8 );
d.push( "stack1", obj9 );
Object obj9a = d.pop( "stack1" );
Object obj8a = d.pop( "stack1" );
assertSame( obj8, obj8a );
assertSame( obj9, obj9a );
assertEquals( 12, action.events.size() );