--- jsr166/src/test/tck/PriorityQueueTest.java 2009/11/02 20:28:31 1.9 +++ jsr166/src/test/tck/PriorityQueueTest.java 2009/11/21 02:07:27 1.12 @@ -13,10 +13,10 @@ 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); + return new TestSuite(PriorityQueueTest.class); } static class MyReverseComparator implements Comparator { @@ -36,12 +36,12 @@ public class PriorityQueueTest extends J private PriorityQueue populatedQueue(int n) { PriorityQueue q = new PriorityQueue(n); assertTrue(q.isEmpty()); - for(int i = n-1; i >= 0; i-=2) - assertTrue(q.offer(new Integer(i))); - for(int i = (n & 1); i < n; i+=2) - assertTrue(q.offer(new Integer(i))); + for (int i = n-1; i >= 0; i-=2) + assertTrue(q.offer(new Integer(i))); + for (int i = (n & 1); i < n; i+=2) + assertTrue(q.offer(new Integer(i))); assertFalse(q.isEmpty()); - assertEquals(n, q.size()); + assertEquals(n, q.size()); return q; } @@ -166,7 +166,7 @@ public class PriorityQueueTest extends J * offer(null) throws NPE */ public void testOfferNull() { - try { + try { PriorityQueue q = new PriorityQueue(1); q.offer(null); shouldThrow(); @@ -177,7 +177,7 @@ public class PriorityQueueTest extends J * add(null) throws NPE */ public void testAddNull() { - try { + try { PriorityQueue q = new PriorityQueue(1); q.add(null); shouldThrow(); @@ -204,7 +204,7 @@ public class PriorityQueueTest extends J q.offer(new Object()); shouldThrow(); } - catch(ClassCastException success) {} + catch (ClassCastException success) {} } /** @@ -283,7 +283,7 @@ public class PriorityQueueTest extends J for (int i = 0; i < SIZE; ++i) { assertEquals(i, ((Integer)q.poll()).intValue()); } - assertNull(q.poll()); + assertNull(q.poll()); } /** @@ -297,7 +297,7 @@ public class PriorityQueueTest extends J assertTrue(q.peek() == null || i != ((Integer)q.peek()).intValue()); } - assertNull(q.peek()); + assertNull(q.peek()); } /** @@ -327,8 +327,8 @@ public class PriorityQueueTest extends J try { q.remove(); shouldThrow(); - } catch (NoSuchElementException success){ - } + } catch (NoSuchElementException success) { + } } /** @@ -426,10 +426,10 @@ public class PriorityQueueTest extends J */ public void testToArray() { PriorityQueue q = populatedQueue(SIZE); - Object[] o = q.toArray(); + Object[] o = q.toArray(); Arrays.sort(o); - for(int i = 0; i < o.length; i++) - assertEquals(o[i], q.poll()); + for (int i = 0; i < o.length; i++) + assertEquals(o[i], q.poll()); } /** @@ -437,10 +437,10 @@ public class PriorityQueueTest extends J */ public void testToArray2() { PriorityQueue q = populatedQueue(SIZE); - Integer[] ints = new Integer[SIZE]; - ints = (Integer[])q.toArray(ints); + Integer[] ints = new Integer[SIZE]; + ints = (Integer[])q.toArray(ints); Arrays.sort(ints); - for(int i = 0; i < ints.length; i++) + for (int i = 0; i < ints.length; i++) assertEquals(ints[i], q.poll()); } @@ -450,8 +450,8 @@ public class PriorityQueueTest extends J public void testIterator() { PriorityQueue q = populatedQueue(SIZE); int i = 0; - Iterator it = q.iterator(); - while(it.hasNext()) { + Iterator it = q.iterator(); + while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } @@ -506,7 +506,7 @@ public class PriorityQueueTest extends J assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } }