--- jsr166/src/test/tck/PriorityQueueTest.java 2003/10/05 23:00:40 1.7 +++ jsr166/src/test/tck/PriorityQueueTest.java 2009/11/02 20:28:31 1.9 @@ -1,8 +1,9 @@ /* - * Written by members of JCP JSR-166 Expert Group and released to the - * public domain. Use, modify, and redistribute this code in any way - * without acknowledgement. Other contributors include Andrew Wright, - * Jeffrey Hayes, Pat Fischer, Mike Judd. + * Written by Doug Lea with assistance from members of JCP JSR-166 + * Expert Group and released to the public domain, as explained at + * http://creativecommons.org/licenses/publicdomain + * Other contributors include Andrew Wright, Jeffrey Hayes, + * Pat Fisher, Mike Judd. */ import junit.framework.*; @@ -12,13 +13,13 @@ import java.io.*; public class PriorityQueueTest extends JSR166TestCase { public static void main(String[] args) { - junit.textui.TestRunner.run (suite()); + junit.textui.TestRunner.run (suite()); } public static Test suite() { return new TestSuite(PriorityQueueTest.class); } - static class MyReverseComparator implements Comparator { + static class MyReverseComparator implements Comparator { public int compare(Object x, Object y) { int i = ((Integer)x).intValue(); int j = ((Integer)y).intValue(); @@ -43,7 +44,7 @@ public class PriorityQueueTest extends J assertEquals(n, q.size()); return q; } - + /** * A new queue has unbounded capacity */ @@ -169,7 +170,7 @@ public class PriorityQueueTest extends J PriorityQueue q = new PriorityQueue(1); q.offer(null); shouldThrow(); - } catch (NullPointerException success) { } + } catch (NullPointerException success) { } } /** @@ -180,7 +181,7 @@ public class PriorityQueueTest extends J PriorityQueue q = new PriorityQueue(1); q.add(null); shouldThrow(); - } catch (NullPointerException success) { } + } catch (NullPointerException success) { } } /** @@ -327,7 +328,7 @@ public class PriorityQueueTest extends J q.remove(); shouldThrow(); } catch (NoSuchElementException success){ - } + } } /** @@ -344,7 +345,7 @@ public class PriorityQueueTest extends J } assertTrue(q.isEmpty()); } - + /** * contains(x) reports true when elements added but not yet removed */ @@ -442,7 +443,7 @@ public class PriorityQueueTest extends J for(int i = 0; i < ints.length; i++) assertEquals(ints[i], q.poll()); } - + /** * iterator iterates through all elements */ @@ -486,10 +487,10 @@ public class PriorityQueueTest extends J for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } - } + } /** - * A deserialized serialized queue has same elements + * A deserialized serialized queue has same elements */ public void testSerialization() { PriorityQueue q = populatedQueue(SIZE); @@ -503,7 +504,7 @@ public class PriorityQueueTest extends J ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); PriorityQueue r = (PriorityQueue)in.readObject(); assertEquals(q.size(), r.size()); - while (!q.isEmpty()) + while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); } catch(Exception e){ unexpectedException();