public void testRemove() {
        int element_count = 10;

        TIntList a = new TIntLinkedList();
        assertTrue( a.isEmpty() );

        for ( int i = 1; i <= element_count; i++ ) {
            a.add( i );
        }

        assertEquals( 6, a.get( 5 ) );
        assertTrue( a.remove( 5 ) );
        for ( int i = 0; i < 4; i++ ) {
            int expected = i + 1;
            assertTrue( "index " + i + " expected " + expected, a.get( i ) == expected );
        }
        for ( int i = 4; i < a.size(); i++ ) {
            int expected = i + 2;
            assertTrue( "index " + i + " expected " + expected, a.get( i ) == expected );
        }

        // Can't remove again from THIS list because it's not present.
        assertFalse( a.remove( 5 ) );

        assertEquals( 6, a.removeAt( 4 ) );
        for ( int i = 0; i < 4; i++ ) {
            int expected = i + 1;
            assertTrue( "index " + i + " expected " + expected, a.get( i ) == expected );
        }
        for ( int i = 4; i < a.size(); i++ ) {
            int expected = i + 3;
            assertTrue( "index " + i + " expected " + expected, a.get( i ) == expected );
        }
        a.insert( 4, 6 );

        // Add a value twice, can remove it twice
        assertTrue( a.add( 5 ) );
        assertTrue( a.add( 5 ) );

        assertTrue( a.remove( 5 ) );
        assertTrue( a.remove( 5 ) );
        assertFalse( a.remove( 5 ) );

        a.insert( 4, 5 );
        assertTrue( a.add( 5 ) );
        for ( int i = 0; i < 5; i++ ) {
            int expected = i + 1;
            assertTrue( "index " + i + " expected " + expected, a.get( i ) == expected );
        }
        for ( int i = 5; i < a.size() - 1; i++ ) {
            int expected = i + 1;
            assertTrue( "index " + i + " expected " + expected + ", list: " + a,
                    a.get( i ) == expected );
        }
        assertEquals( 5, a.get( a.size() - 1 ) );

        assertTrue( a.remove( 5 ) );
        assertEquals( element_count, a.size() );
        for ( int i = 0; i < 4; i++ ) {
            int expected = i + 1;
            assertTrue( "index " + i + " expected " + expected, a.get( i ) == expected );
        }
        for ( int i = 4; i < a.size() - 1; i++ ) {
            int expected = i + 2;
            assertTrue( "index " + i + " expected " + expected, a.get( i ) == expected );
        }
        assertEquals( 5, a.get( a.size() - 1 ) );


    }