harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r547193 - in /harmony/enhanced/classlib/branches/java6/modules/luni/src: main/java/java/util/LinkedList.java test/java/tests/api/java/util/LinkedListTest.java test/resources/serialization/tests/api/java/util/LinkedListTest.golden.ser
Date Thu, 14 Jun 2007 09:59:23 GMT
Author: tellison
Date: Thu Jun 14 02:59:22 2007
New Revision: 547193

URL: http://svn.apache.org/viewvc?view=rev&rev=547193
Log:
Apply patch HARMONY-4152 ([classlib][luni][java6] New methods in java.util.LinkedList for
java6)

Added:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/resources/serialization/tests/api/java/util/LinkedListTest.golden.ser
  (with props)
Modified:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/LinkedList.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/LinkedList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/LinkedList.java?view=diff&rev=547193&r1=547192&r2=547193
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/LinkedList.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/LinkedList.java
Thu Jun 14 02:59:22 2007
@@ -31,7 +31,8 @@
  * @since 1.2
  */
 public class LinkedList<E> extends AbstractSequentialList<E> implements
-        List<E>, Queue<E>, Cloneable, Serializable {
+		List<E>, Deque<E>, Cloneable, Serializable {
+
 	
 	private static final long serialVersionUID = 876323262645176354L;
 
@@ -147,19 +148,18 @@
 					next.previous = previous;
 					previous.next = next;
 					if (lastLink == link) {
-                        pos--;
-                    }
+						pos--;
+					}
 					link = previous;
 					lastLink = null;
 					expectedModCount++;
 					list.size--;
 					list.modCount++;
-				} else {
-                    throw new IllegalStateException();
-                }
-			} else {
-                throw new ConcurrentModificationException();
-            }
+					return;
+				}
+				throw new IllegalStateException();
+			}
+			throw new ConcurrentModificationException();
 		}
 
 		public void set(ET object) {
@@ -175,6 +175,64 @@
 		}
 	}
 
+	/*
+	 * NOTES:descendingIterator is not fail-fast, according to the documentation
+	 * and test case.
+	 */
+	private class ReverseLinkIterator<ET> implements Iterator<ET> {
+		private int expectedModCount;
+
+		private final LinkedList<ET> list;
+
+		private Link<ET> link;
+
+		private boolean canRemove;
+
+		ReverseLinkIterator(LinkedList<ET> linkedList) {
+			super();
+			list = linkedList;
+			expectedModCount = list.modCount;
+			link = list.voidLink;
+			canRemove = false;
+		}
+
+		public boolean hasNext() {
+			return link.previous != list.voidLink;
+		}
+
+		public ET next() {
+			if (expectedModCount == list.modCount) {
+				if (hasNext()) {
+					link = link.previous;
+					canRemove = true;
+					return link.data;
+				}
+				throw new NoSuchElementException();
+			}
+			throw new ConcurrentModificationException();
+
+		}
+
+		public void remove() {
+			if (expectedModCount == list.modCount) {
+				if (canRemove) {
+					Link<ET> next = link.previous;
+					Link<ET> previous = link.next;
+					next.next = previous;
+					previous.previous = next;
+					link = previous;
+					list.size--;
+					list.modCount++;
+					expectedModCount++;
+					canRemove = false;
+					return;
+				}
+				throw new IllegalStateException();
+			}
+			throw new ConcurrentModificationException();
+		}
+	}
+
 	/**
 	 * Constructs a new empty instance of LinkedList.
 	 * 
@@ -246,7 +304,10 @@
 	 */
 	@Override
     public boolean add(E object) {
-		// Cannot call addLast() as subclasses can override
+		return addLastImpl(object);
+	}
+
+	private boolean addLastImpl(E object) {
 		Link<E> oldLast = voidLink.previous;
 		Link<E> newLink = new Link<E>(object, oldLast, voidLink);
 		voidLink.previous = newLink;
@@ -334,12 +395,17 @@
 	 *            the object to add
 	 */
 	public void addFirst(E object) {
+		addFirstImpl(object);
+	}
+
+	private boolean addFirstImpl(E object) {
 		Link<E> oldFirst = voidLink.next;
 		Link<E> newLink = new Link<E>(object, voidLink, oldFirst);
 		voidLink.next = newLink;
 		oldFirst.previous = newLink;
 		size++;
 		modCount++;
+		return true;
 	}
 
 	/**
@@ -349,12 +415,7 @@
 	 *            the object to add
 	 */
 	public void addLast(E object) {
-		Link<E> oldLast = voidLink.previous;
-		Link<E> newLink = new Link<E>(object, oldLast, voidLink);
-		voidLink.previous = newLink;
-		oldLast.next = newLink;
-		size++;
-		modCount++;
+		addLastImpl(object);
 	}
 
 	/**
@@ -453,6 +514,10 @@
 	 *                when this LinkedList is empty
 	 */
 	public E getFirst() {
+		return getFirstImpl();
+	}
+
+	private E getFirstImpl() {
 		Link<E> first = voidLink.next;
 		if (first != voidLink) {
             return first.data;
@@ -595,26 +660,7 @@
 
 	@Override
     public boolean remove(Object object) {
-		Link<E> link = voidLink.next;
-		if (object != null) {
-			while (link != voidLink && !object.equals(link.data)) {
-                link = link.next;
-            }
-		} else {
-			while (link != voidLink && link.data != null) {
-                link = link.next;
-            }
-		}
-		if (link == voidLink) {
-            return false;
-        }
-		Link<E> next = link.next;
-		Link<E> previous = link.previous;
-		previous.next = next;
-		next.previous = previous;
-		size--;
-		modCount++;
-		return true;
+		return removeFirstOccurrenceImpl(object);
 	}
 
 	/**
@@ -626,6 +672,10 @@
 	 *                when this LinkedList is empty
 	 */
 	public E removeFirst() {
+		return removeFirstImpl();
+	}
+
+	private E removeFirstImpl() {
 		Link<E> first = voidLink.next;
 		if (first != voidLink) {
 			Link<E> next = first.next;
@@ -647,6 +697,10 @@
 	 *                when this LinkedList is empty
 	 */
 	public E removeLast() {
+		return removeLastImpl();
+	}
+
+	private E removeLastImpl() {
 		Link<E> last = voidLink.previous;
 		if (last != voidLink) {
 			Link<E> previous = last.previous;
@@ -660,6 +714,134 @@
 	}
 
 	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#descendingIterator()
+	 * @since 1.6
+	 */
+	public Iterator<E> descendingIterator() {
+		return new ReverseLinkIterator<E>(this);
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#offerFirst(java.lang.Object)
+	 * @since 1.6
+	 */
+	public boolean offerFirst(E e) {
+		return addFirstImpl(e);
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#offerLast(java.lang.Object)
+	 * @since 1.6
+	 */
+	public boolean offerLast(E e) {
+		return addLastImpl(e);
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#peekFirst()
+	 * @since 1.6
+	 */
+	public E peekFirst() {
+		return peekFirstImpl();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#peekLast()
+	 * @since 1.6
+	 */
+	public E peekLast() {
+		Link<E> last = voidLink.previous;
+		return (last == voidLink) ? null : last.data;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#pollFirst()
+	 * @since 1.6
+	 */
+	public E pollFirst() {
+		return (size == 0) ? null : removeFirstImpl();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#pollLast()
+	 * @since 1.6
+	 */
+	public E pollLast() {
+		return (size == 0) ? null : removeLastImpl();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#pop()
+	 * @since 1.6
+	 */
+	public E pop() {
+		return removeFirstImpl();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#push(java.lang.Object)
+	 * @since 1.6
+	 */
+	public void push(E e) {
+		addFirstImpl(e);
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#removeFirstOccurrence(java.lang.Object)
+	 * @since 1.6
+	 */
+	public boolean removeFirstOccurrence(Object o) {
+		return removeFirstOccurrenceImpl(o);
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see java.util.Deque#removeLastOccurrence(java.lang.Object)
+	 * @since 1.6
+	 */
+	public boolean removeLastOccurrence(Object o) {
+		Iterator<E> iter = new ReverseLinkIterator<E>(this);
+		return removeOneOccurrence(o, iter);
+	}
+
+	private boolean removeFirstOccurrenceImpl(Object o) {
+		Iterator<E> iter = new LinkIterator<E>(this, 0);
+		return removeOneOccurrence(o, iter);
+	}
+
+	private boolean removeOneOccurrence(Object o, Iterator<E> iter) {
+		while (iter.hasNext()) {
+			E element = iter.next();
+			if (o == null ? element == null : o.equals(element)) {
+				iter.remove();
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
 	 * Replaces the element at the specified location in this LinkedList with
 	 * the specified object.
 	 * 
@@ -703,25 +885,28 @@
 	}
     
     public boolean offer(E o) {
-        add(o);
-        return true;
+		return addLastImpl(o);
     }
 
     public E poll() {
-        return size == 0 ? null : removeFirst();
+		return (size == 0) ? null : removeFirstImpl();
     }
 
     public E remove() {
-        return removeFirst();
+		return removeFirstImpl();
     }
 
     public E peek() {
+		return peekFirstImpl();
+	}
+
+	private E peekFirstImpl() {
         Link<E> first = voidLink.next;
         return first == voidLink ? null : first.data;
     }
 
     public E element() {
-        return getFirst();
+		return getFirstImpl();
     }
 
 	/**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java?view=diff&rev=547193&r1=547192&r2=547193
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java
Thu Jun 14 02:59:22 2007
@@ -17,21 +17,37 @@
 
 package tests.api.java.util;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.ConcurrentModificationException;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.NoSuchElementException;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
 
 import tests.support.Support_ListTest;
 
 public class LinkedListTest extends junit.framework.TestCase {
 
 	LinkedList ll;
+    
+    LinkedList<Object> testList;
+    
+    private Object testObjOne;
+
+    private Object testObjTwo;
+
+    private Object testObjThree;
+
+    private Object testObjFour;
+
+    private Object testObjLast;
 
 	static Object[] objArray;
 	{
@@ -472,18 +488,27 @@
 			assertTrue("Lists are not equal", li.next() == ri.next());
 	}
 
+    /**
+     * @tests {@link java.util.LinkedList#offer(Object)}
+     */
     public void test_offer() {
         int origSize = ll.size();
         assertTrue("offer() should return true'", ll.offer(objArray[0]));
         assertEquals("offer() should add an element as the last one", origSize, ll.lastIndexOf(objArray[0]));
     }
 
+    /**
+     * @tests {@link java.util.LinkedList#poll()}
+     */
     public void test_poll() {
         assertEquals("should return the head", objArray[0], ll.poll());
         LinkedList list = new LinkedList();
         assertNull("should return 'null' if list is empty", list.poll());
     }
 
+    /**
+     * @tests {@link java.util.LinkedList#remove()}
+     */
     public void test_remove() {
         for (int i = 0; i < objArray.length; i++) {
             assertEquals("should remove the head", objArray[i], ll.remove());
@@ -497,6 +522,9 @@
         }
     }
 
+    /**
+     * @tests {@link java.util.LinkedList#element()}
+     */
     public void test_element() {
         assertEquals("should return the head", objArray[0], ll.element());
         assertEquals("element() should remove nothing", objArray.length, ll.size());
@@ -507,7 +535,285 @@
             //-- expected
         }
     }
+    
+    /**
+     * @tests {@link java.util.LinkedList#removeFirstOccurrence(Object)}
+     */
+    public void test_removeFirstOccurrence() throws Exception {
+        assertTrue(testList.offerLast(testObjOne));
+        assertTrue(testList.offerLast(testObjTwo));
+        assertTrue(testList.offerLast(testObjOne));
+        assertTrue(testList.offerLast(testObjThree));
+        assertTrue(testList.offerLast(testObjOne));
+        assertEquals(5, testList.size());
+        assertTrue(testList.removeFirstOccurrence(testObjOne));
+        assertFalse(testList.removeFirstOccurrence(testObjFour));
+        assertEquals(testObjTwo, testList.peekFirst());
+        assertEquals(testObjOne, testList.peekLast());
+        assertEquals(4, testList.size());
+        assertTrue(testList.removeFirstOccurrence(testObjOne));
+        assertEquals(3, testList.size());
+        assertEquals(testObjOne, testList.peekLast());
+        assertTrue(testList.removeFirstOccurrence(testObjOne));
+        assertEquals(2, testList.size());
+        assertEquals(testObjThree, testList.peekLast());
+        assertFalse(testList.removeFirstOccurrence(testObjOne));
+    }
 
+    /**
+     * @tests {@link java.util.LinkedList#removeLastOccurrence(Object)}
+     */    
+    public void test_removeLastOccurrence() throws Exception {
+        assertTrue(testList.offerLast(testObjOne));
+        assertTrue(testList.offerLast(testObjTwo));
+        assertTrue(testList.offerLast(testObjOne));
+        assertTrue(testList.offerLast(testObjThree));
+        assertTrue(testList.offerLast(testObjOne));
+        assertEquals(5, testList.size());
+        assertTrue(testList.removeLastOccurrence(testObjOne));
+        assertFalse(testList.removeLastOccurrence(testObjFour));
+        assertEquals(testObjOne, testList.peekFirst());
+        assertEquals(testObjThree, testList.peekLast());
+        assertEquals(4, testList.size());
+        assertTrue(testList.removeLastOccurrence(testObjOne));
+        assertEquals(3, testList.size());
+        assertEquals(testObjOne, testList.peekFirst());
+        assertEquals(testObjThree, testList.peekLast());
+        assertTrue(testList.removeLastOccurrence(testObjOne));
+        assertEquals(2, testList.size());
+        assertEquals(testObjThree, testList.peekLast());
+        assertFalse(testList.removeLastOccurrence(testObjOne));
+    }
+    
+    /**
+     * @tests {@link java.util.LinkedList#offerFirst(Object)}
+     */
+    public void test_offerFirst() throws Exception {
+        assertTrue(testList.offerFirst(testObjOne));
+        assertEquals(1, testList.size());
+        assertEquals(testObjOne, testList.peek());
+        assertTrue(testList.offerFirst(testObjOne));
+        assertEquals(2, testList.size());
+        assertEquals(testObjOne, testList.peek());
+        assertTrue(testList.offerFirst(testObjTwo));
+        assertEquals(3, testList.size());
+        assertEquals(testObjTwo, testList.peek());
+        assertEquals(testObjOne, testList.getLast());
+        assertTrue(testList.offerFirst(null));
+        assertEquals(4, testList.size());
+    }
+
+    /**
+     * @tests {@link java.util.LinkedList#offerLast(Object)}
+     */
+    public void test_offerLast() throws Exception {
+        assertTrue(testList.offerLast(testObjOne));
+        assertEquals(1, testList.size());
+        assertEquals(testObjOne, testList.peek());
+        assertTrue(testList.offerLast(testObjOne));
+        assertEquals(2, testList.size());
+        assertEquals(testObjOne, testList.peek());
+        assertTrue(testList.offerLast(testObjTwo));
+        assertEquals(3, testList.size());
+        assertEquals(testObjOne, testList.peek());
+        assertEquals(testObjTwo, testList.getLast());
+        assertTrue(testList.offerLast(null));
+        assertEquals(4, testList.size());
+    }
+    
+    /**
+     * @tests {@link java.util.LinkedList#push(Object)}
+     */
+    public void test_push() throws Exception {
+        testList.push(testObjOne);
+        assertEquals(1, testList.size());
+        assertEquals(testObjOne, testList.peek());
+        testList.push(testObjOne);
+        assertEquals(2, testList.size());
+        assertEquals(testObjOne, testList.peek());
+        testList.push(testObjTwo);
+        assertEquals(3, testList.size());
+        assertEquals(testObjTwo, testList.peek());
+        assertEquals(testObjOne, testList.getLast());
+        testList.push(null);
+        assertEquals(4, testList.size());
+    }
+
+    /**
+     * @tests {@link java.util.LinkedList#pop()}
+     */
+    public void test_pop() throws Exception {
+        assertTrue(testList.offerLast(testObjOne));
+        assertTrue(testList.offerLast(testObjTwo));
+        assertTrue(testList.offerLast(testObjThree));
+        assertEquals(3, testList.size());
+        assertEquals(testObjOne, testList.pop());
+        assertEquals(2, testList.size());
+        assertEquals(testObjTwo, testList.pop());
+        assertEquals(testObjThree, testList.pop());
+        assertEquals(0, testList.size());
+        testList.push(null);
+        assertEquals(1, testList.size());
+        assertNull(testList.pop());
+        try {
+            testList.pop();
+            fail("should throw NoSuchElementException ");
+        } catch (NoSuchElementException e) {
+            // expected
+        }
+    }    
+
+    /**
+     * @tests {@link java.util.LinkedList#descendingIterator()}
+     */
+    public void test_descendingIterator() throws Exception {
+        assertFalse(testList.descendingIterator().hasNext());
+        assertTrue(testList.add(testObjOne));
+        assertTrue(testList.add(testObjTwo));
+        assertTrue(testList.add(testObjOne));
+        assertTrue(testList.add(testObjThree));
+        assertTrue(testList.add(testObjLast));
+        Iterator result = testList.descendingIterator();
+        assertEquals(5, testList.size());
+        try {
+            result.remove();
+            fail("should throw IllegalStateException");
+        } catch (IllegalStateException e) {
+            // expected
+        }
+        assertTrue(testList.add(testObjFour));
+        
+        try {
+            assertEquals(testObjLast,result.next());
+            fail("should throw ConcurrentModificationException");
+        } catch (ConcurrentModificationException e) {
+            // expected
+        }
+   
+        result = testList.descendingIterator();
+        assertEquals(testObjFour, result.next());
+        assertEquals(testObjLast, result.next());
+        assertEquals(testObjThree, result.next());
+        assertEquals(testObjOne, result.next());
+        assertEquals(testObjTwo, result.next());
+        assertTrue(result.hasNext());
+        result.remove();
+        assertEquals(testObjOne, result.next());
+        assertFalse(result.hasNext());
+        try {
+            result.next();
+            fail("should throw NoSuchElementException");
+        } catch (NoSuchElementException e) {
+            // expected
+        }
+    }
+    /**
+     * @tests {@link java.util.LinkedList#pollFirst()}
+     */
+    public void test_pollFirst() throws Exception {
+        assertTrue(testList.offerLast(testObjOne));
+        assertTrue(testList.offerLast(testObjTwo));
+        assertTrue(testList.offerLast(testObjThree));
+        assertEquals(3, testList.size());
+        assertEquals(testObjOne, testList.pollFirst());
+        assertEquals(2, testList.size());
+        assertEquals(testObjTwo, testList.pollFirst());
+        assertEquals(testObjThree, testList.pollFirst());
+        assertEquals(0, testList.size());
+        assertNull(testList.pollFirst());
+    }
+
+    /**
+     * @tests {@link java.util.LinkedList#pollLast()}
+     */
+    public void test_pollLast() throws Exception {
+        assertTrue(testList.offerLast(testObjOne));
+        assertTrue(testList.offerLast(testObjTwo));
+        assertTrue(testList.offerLast(testObjThree));
+        assertEquals(3, testList.size());
+        assertEquals(testObjThree, testList.pollLast());
+        assertEquals(2, testList.size());
+        assertEquals(testObjTwo, testList.pollLast());
+        assertEquals(testObjOne, testList.pollLast());
+        assertEquals(0, testList.size());
+        assertNull(testList.pollFirst());
+    }
+    
+    /**
+     * @tests {@link java.util.LinkedList#peekFirst()}
+     */
+    public void test_peekFirst() throws Exception {
+        assertTrue(testList.offerLast(testObjOne));
+        assertTrue(testList.offerLast(testObjTwo));
+        assertTrue(testList.offerLast(testObjThree));
+        assertEquals(3, testList.size());
+        assertEquals(testObjOne, testList.peekFirst());
+        assertEquals(3, testList.size());
+        assertEquals(testObjOne, testList.pollFirst());
+        assertEquals(testObjTwo, testList.peekFirst());
+        assertEquals(testObjTwo, testList.pollFirst());
+        assertEquals(testObjThree, testList.pollFirst());
+        assertEquals(0, testList.size());
+        assertEquals(null, testList.peekFirst());
+    }
+
+    /**
+     * @tests {@link java.util.LinkedList#peek()}
+     */
+    public void test_peekLast() throws Exception {
+        assertTrue(testList.offerLast(testObjOne));
+        assertTrue(testList.offerLast(testObjTwo));
+        assertTrue(testList.offerLast(testObjThree));
+        assertEquals(3, testList.size());
+        assertEquals(testObjThree, testList.peekLast());
+        assertEquals(3, testList.size());
+        assertEquals(testObjThree, testList.pollLast());
+        assertEquals(testObjTwo, testList.peekLast());
+        assertEquals(testObjTwo, testList.pollLast());
+        assertEquals(testObjOne, testList.pollLast());
+        assertEquals(0, testList.size());
+        assertNull(testList.peekLast());
+    }
+
+    /**
+     * @tests java.util.LinkedList#Serialization()
+     */
+    public void test_serialization() throws Exception {
+        assertTrue(ll.add(new Integer(1)));
+        assertTrue(ll.add(new Integer(2)));
+        assertTrue(ll.add(new Integer(3)));
+        assertTrue(ll.add(new Integer(4)));
+        assertTrue(ll.add(new Integer(5)));
+        SerializationTest.verifySelf(ll, new SerializableAssert() {
+            public void assertDeserialized(Serializable initial,
+                    Serializable deserialized) {
+                LinkedList<Object> formerQue = (LinkedList)initial;
+                LinkedList<Object> deserializedQue = (LinkedList)deserialized;
+                assertEquals(formerQue.remove(),deserializedQue.remove());
+            }
+        });
+    }
+    
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    @SuppressWarnings( { "unchecked", "boxing" })
+    public void testSerializationCompatibility() throws Exception {
+        assertTrue(ll.add(new Integer(1)));
+        assertTrue(ll.add(new Integer(2)));
+        assertTrue(ll.add(new Integer(3)));
+        assertTrue(ll.add(new Integer(4)));
+        assertTrue(ll.add(new Integer(5)));
+        SerializationTest.verifyGolden(this,ll, new SerializableAssert() {
+            public void assertDeserialized(Serializable initial,
+                    Serializable deserialized) {
+                LinkedList<Object> formerQue = (LinkedList)initial;
+                LinkedList<Object> deserializedQue = (LinkedList)deserialized;
+                assertEquals(formerQue.remove(),deserializedQue.remove());
+            }
+        });
+    }
+    
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method
 	 * is called before a test is executed.
@@ -518,5 +824,11 @@
 		for (int i = 0; i < objArray.length; i++) {
 			ll.add(objArray[i]);
         }
+        testList = new LinkedList<Object>();
+        testObjOne = new Object();
+        testObjTwo = new Object();
+        testObjThree = new Object();
+        testObjFour = new Object();
+        testObjLast = new Object();
 	}
 }

Added: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/resources/serialization/tests/api/java/util/LinkedListTest.golden.ser
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/resources/serialization/tests/api/java/util/LinkedListTest.golden.ser?view=auto&rev=547193
==============================================================================
Binary file - no diff available.

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/resources/serialization/tests/api/java/util/LinkedListTest.golden.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message