
    public boolean add(T e)
    {
        Entry<T> entry = new Entry<T>();
        entry.setEntry(e);

        return entries.add(entry);
    }


    public void add(int index, T element)
    {
        Entry<T> entry = new Entry<T>();
        entry.setEntry(element);

        entries.add(index, entry);
    }


    public boolean addAll(Collection<? extends T> c)
    {
        throw new UnsupportedOperationException();
    }


    public boolean addAll(int index, Collection<? extends T> c)
    {
        throw new UnsupportedOperationException();
    }


    public void clear()
    {
        entries.clear();
    }


    public boolean contains(Object o)
    {
        return getEntries().contains(o);
    }


    public boolean containsAll(Collection<?> c)
    {
        return getEntries().containsAll(c);
    }


    public T get(int index)
    {
        return getEntries().get(index);
    }


    public int indexOf(Object o)
    {
        return getEntries().indexOf(o);
    }


    public boolean isEmpty()
    {
        return entries.isEmpty();
    }


    public Iterator<T> iterator()
    {
        return this.getEntries().iterator();
    }


    public int lastIndexOf(Object o)
    {
        return getEntries().lastIndexOf(o);
    }


    public ListIterator<T> listIterator()
    {
        return getEntries().listIterator();
    }


    public ListIterator<T> listIterator(int index)
    {
        return getEntries().listIterator(index);
    }


    public boolean remove(Object o)
    {
        throw new UnsupportedOperationException();
    }


    public T remove(int index)
    {
        Entry<T> entry = entries.remove(index);

        return entry.getEntry();
    }


    public boolean removeAll(Collection<?> c)
    {
        throw new UnsupportedOperationException();
    }


    public boolean retainAll(Collection<?> c)
    {
        throw new UnsupportedOperationException();
    }


    public T set(int index, T element)
    {
        Entry<T> entry = new Entry<T>();
        entry.setEntry(element);

        return (entries.set(index, entry)).getEntry();
    }


    public int size()
    {
        return entries.size();
    }


    public List<T> subList(int fromIndex, int toIndex)
    {
        return getEntries().subList(fromIndex, toIndex);
    }


    public Object[] toArray()
    {
        return getEntries().toArray();
    }


    @SuppressWarnings("hiding")
    public <T> T[] toArray(T[] a)
    {
        return getEntries().toArray(a);
    }
    
    
    
    ==================
    
    
package org.springframework.social.alfresco.connect.test;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

import org.springframework.social.alfresco.api.entities.AlfrescoList;
import org.springframework.social.alfresco.api.entities.AlfrescoList.Entry;
import org.springframework.social.alfresco.api.entities.Tag;
import org.junit.BeforeClass;
import org.junit.Test;


public class AlfrescoListTest
{
    private static ArrayList<Entry<Tag>> tagArrayList = new ArrayList<Entry<Tag>>();
    private static AlfrescoList<Tag>     tagList      = new AlfrescoList<Tag>();


    // private static Tag two = new Tag();


    @BeforeClass
    public static void setup()
    {

        Entry<Tag> entryOne = new Entry<Tag>();
        Tag one = new Tag();
        one.setId("1");
        one.setTag("one");
        entryOne.setEntry(one);
        tagArrayList.add(entryOne);

        Entry<Tag> entryTwo = new Entry<Tag>();
        Tag two = new Tag();
        two.setId("2");
        two.setTag("two");
        entryTwo.setEntry(two);
        tagArrayList.add(entryTwo);

        Entry<Tag> entryThree = new Entry<Tag>();
        Tag three = new Tag();
        three.setId("3");
        three.setTag("three");
        entryThree.setEntry(three);
        tagArrayList.add(entryThree);


        tagList.setEntries(tagArrayList);

    }


    @Test
    public void TestAdd()
    {
        Tag four = new Tag();
        four.setId("4");
        four.setTag("four");

        boolean added = tagList.add(four);

        assertTrue(added);
        assertEquals(four, tagList.get(3));

        tagList.remove(3);
    }


    @Test
    public void TestAdd2()
    {
        Tag zero = new Tag();
        zero.setId("0");
        zero.setTag("zero");

        tagList.add(0, zero);

        assertEquals(zero, tagList.get(0));

        tagList.remove(0);
    }


    @Test(expected = UnsupportedOperationException.class)
    public void TestAddAll()
    {
        tagList.addAll(new ArrayList<Tag>());
    }


    @Test(expected = UnsupportedOperationException.class)
    public void TestAddAllw()
    {
        tagList.addAll(0, new ArrayList<Tag>());
    }


    @Test
    public void TestClear()
    {
        tagList.clear();

        assertEquals(0, tagList.size());

        setup();
    }


    @Test
    public void TestContains()
    {
        Tag two = new Tag();
        two.setId("2");
        two.setTag("two");

        boolean contains = tagList.contains(two);
        assertTrue(contains);
    }


    @Test
    public void TestContatinsAll()
    {
        ArrayList<Tag> tags = new ArrayList<Tag>();

        Tag one = new Tag();
        one.setId("1");
        one.setTag("one");
        tags.add(one);

        Tag two = new Tag();
        two.setId("2");
        two.setTag("two");
        tags.add(two);

        Tag three = new Tag();
        three.setId("3");
        three.setTag("three");
        tags.add(three);

        boolean contains = tagList.containsAll(tags);

        assertTrue(contains);
    }


    @Test
    public void TestIndexOf()
    {
        Tag two = new Tag();
        two.setId("2");
        two.setTag("two");

        int index = tagList.indexOf(two);

        assertEquals(1, index);
    }


    @Test
    public void TestLastIndexOf()
    {
        Tag two = new Tag();
        two.setId("2");
        two.setTag("two");

        int index = tagList.lastIndexOf(two);

        assertEquals(1, index);
    }


    @Test
    public void TestIsEmpty()
    {
        tagList.clear();

        assertTrue(tagList.isEmpty());

        setup();
    }


    @Test
    public void TestIterator()
    {
        int count = 0;
        for (Iterator<Tag> iterator = tagList.iterator(); iterator.hasNext();)
        {
            Tag tag = iterator.next();
            assertEquals(tagList.get(count), tag);
            count++;
        }
    }


    @Test
    public void TestListIterator()
    {
        ListIterator<Tag> listIterator = tagList.listIterator();

        int count = 0;
        while (listIterator.hasNext())
        {
            assertEquals(tagList.get(count), listIterator.next());
            count++;
        }

        while (listIterator.hasPrevious())
        {
            count--;
            assertEquals(tagList.get(count), listIterator.previous());

        }
    }


    @Test
    public void TestListIterator2()
    {
        ListIterator<Tag> listIterator = tagList.listIterator(1);

        int count = 1;
        while (listIterator.hasNext())
        {
            assertEquals(tagList.get(count), listIterator.next());
            count++;
        }

        while (listIterator.hasPrevious())
        {
            count--;
            assertEquals(tagList.get(count), listIterator.previous());

        }
    }


    @Test(expected = UnsupportedOperationException.class)
    public void TestRemove()
    {
        tagList.remove(new Object());
    }


    @Test
    public void TestRemove2()
    {
        Tag tag = tagList.remove(1);

        assertFalse(tagList.contains(tag));

        tagList.add(1, tag);
    }


    @Test(expected = UnsupportedOperationException.class)
    public void TestRemoveAll()
    {
        tagList.removeAll(new ArrayList<Object>());
    }


    @Test(expected = UnsupportedOperationException.class)
    public void TestRetainAll()
    {
        tagList.retainAll(new ArrayList<Object>());
    }


    @Test
    public void TestSet()
    {
        Tag newTwo = new Tag();
        newTwo.setId("2.5");
        newTwo.setTag("twopointfive");

        Tag two = tagList.set(1, newTwo);

        assertEquals("two", two.getTag());

        Tag entryTwo = tagList.get(1);

        assertEquals(newTwo.getTag(), entryTwo.getTag());

        tagList.set(1, two);
    }


    @Test
    public void TestSize()
    {
        assertEquals(3, tagList.size());
    }


    @Test
    public void TestSubList()
    {
        List<Tag> subList = tagList.subList(1, 2);

        String[] ids = { "2", "3" };
        int count = 0;
        for (Tag tag : subList)
        {
            assertEquals(ids[count], tag.getId());
            count++;
        }
    }


    @Test
    public void TestArray()
    {
        String[] ids = { "1", "2", "3" };
        int count = 0;
        Object[] tags = tagList.toArray();

        for (Object object : tags)
        {
            assertEquals(ids[count], ((Tag)object).getId());
            count++;
        }
    }


    @Test
    public void TestArray2()
    {
        int count = 0;
        Tag[] tags = tagList.toArray(new Tag[0]);

        for (Tag t : tags)
        {
            assertEquals(tagArrayList.get(count), t);
            count++;
        }
    }
}
    
