list = new ArrayList( 3 ); list.add( this.o1 ); list.add( this.o2 ); list.add( this.o3 ); list.remove( this.o1 ); objects = list.getInternalArray(); assertEquals( this.o2, objects[0] ); assertEquals( this.o3, objects[1] ); assertEquals( null, objects[2] );
	public void testRemove() {		ArrayList list = new ArrayList( 3 );		list.add( this.o1 );		list.add( this.o2 );		list.add( this.o3 );		// illegal remove:		try {			list.remove( 3 );			fail("ArrayList.remove(3) should fail when the list has only [" + list.size() +"] entries.");		} catch (IndexOutOfBoundsException e) {			// okay, expected behaviour!		}		try {			list.remove( -1 );			fail("ArrayList.remove(-1) should fail.");		} catch (IndexOutOfBoundsException e) {			// okay, expected behaviour!		}		// now try remove an element which does not exist in list:		assertEquals( false, list.remove( this.o6 ));		// now remove the third (and last) element:		Object o = list.remove( 2 );		assertEquals( this.o3, o );		list.add(this.o3);		assertTrue( list.remove( this.o3 ) );		list.add( this.o3 );		assertEquals( 3, list.size() );		compareWithArray( list );		assertTrue(list.remove( this.o1 ) );		assertEquals( 2, list.size() );		assertEquals( this.o2, list.remove( 0 ) ); // == o2		assertEquals( 1, list.size() );		assertTrue( list.remove( this.o3 ) );		assertEquals( 0, list.size() );		list.add(this.o1);		assertEquals(1, list.size() );		try {			list.remove(null);			fail("remove(null) should throw IllegalArgumentException");		} catch (IllegalArgumentException e) {			// expected behaviour		}	}