--- jsr166/src/test/tck/AbstractQueueTest.java 2004/01/10 20:37:20 1.1 +++ jsr166/src/test/tck/AbstractQueueTest.java 2011/03/15 19:47:06 1.7 @@ -1,9 +1,9 @@ /* * 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. + * http://creativecommons.org/publicdomain/zero/1.0/ + * Other contributors include Andrew Wright, Jeffrey Hayes, + * Pat Fisher, Mike Judd. */ @@ -15,16 +15,16 @@ import java.io.*; public class AbstractQueueTest 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(AbstractQueueTest.class); } static class Succeed extends AbstractQueue { - public boolean offer(Integer x) { + public boolean offer(Integer x) { if (x == null) throw new NullPointerException(); - return true; + return true; } public Integer peek() { return one; } public Integer poll() { return one; } @@ -33,9 +33,9 @@ public class AbstractQueueTest extends J } static class Fail extends AbstractQueue { - public boolean offer(Integer x) { + public boolean offer(Integer x) { if (x == null) throw new NullPointerException(); - return false; + return false; } public Integer peek() { return null; } public Integer poll() { return null; } @@ -59,8 +59,7 @@ public class AbstractQueueTest extends J try { q.add(one); shouldThrow(); - } catch (IllegalStateException success) { - } + } catch (IllegalStateException success) {} } /** @@ -71,8 +70,7 @@ public class AbstractQueueTest extends J try { q.add(null); shouldThrow(); - } catch (NullPointerException success) { - } + } catch (NullPointerException success) {} } /** @@ -91,8 +89,7 @@ public class AbstractQueueTest extends J try { q.remove(); shouldThrow(); - } catch (NoSuchElementException success) { - } + } catch (NoSuchElementException success) {} } @@ -112,20 +109,18 @@ public class AbstractQueueTest extends J try { q.element(); shouldThrow(); - } catch (NoSuchElementException success) { - } + } catch (NoSuchElementException success) {} } /** - * addAll(null) throws NPE + * addAll(null) throws NPE */ public void testAddAll1() { try { Succeed q = new Succeed(); q.addAll(null); shouldThrow(); - } - catch (NullPointerException success) {} + } catch (NullPointerException success) {} } /** @@ -136,13 +131,12 @@ public class AbstractQueueTest extends J Succeed q = new Succeed(); q.addAll(q); shouldThrow(); - } - catch (IllegalArgumentException success) {} + } catch (IllegalArgumentException success) {} } /** - * addAll of a collection with null elements throws NPE + * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { @@ -150,9 +144,9 @@ public class AbstractQueueTest extends J Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); - } - catch (NullPointerException success) {} + } catch (NullPointerException success) {} } + /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements @@ -165,9 +159,9 @@ public class AbstractQueueTest extends J ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); - } - catch (NullPointerException success) {} + } catch (NullPointerException success) {} } + /** * addAll throws ISE if an add fails */ @@ -179,8 +173,7 @@ public class AbstractQueueTest extends J ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); - } - catch (IllegalStateException success) {} + } catch (IllegalStateException success) {} } }