--- jsr166/src/test/tck/Collection8Test.java 2016/11/06 03:35:25 1.14 +++ jsr166/src/test/tck/Collection8Test.java 2016/11/06 18:51:53 1.17 @@ -5,6 +5,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ +import static java.util.concurrent.TimeUnit.HOURS; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.ArrayList; @@ -169,27 +170,42 @@ public class Collection8Test extends JSR () -> d.push(null), () -> d.descendingIterator().forEachRemaining(null)); } - if (!impl.permitsNulls() && c instanceof BlockingQueue) { + if (c instanceof BlockingQueue) { BlockingQueue q = (BlockingQueue) c; assertThrows( NullPointerException.class, () -> { - try { q.offer(null, 1L, MILLISECONDS); } + try { q.offer(null, 1L, HOURS); } + catch (InterruptedException ex) { + throw new AssertionError(ex); + }}, + () -> { + try { q.put(null); } catch (InterruptedException ex) { throw new AssertionError(ex); }}); } - if (!impl.permitsNulls() && c instanceof BlockingDeque) { + if (c instanceof BlockingDeque) { BlockingDeque q = (BlockingDeque) c; assertThrows( NullPointerException.class, () -> { - try { q.offerFirst(null, 1L, MILLISECONDS); } + try { q.offerFirst(null, 1L, HOURS); } + catch (InterruptedException ex) { + throw new AssertionError(ex); + }}, + () -> { + try { q.offerLast(null, 1L, HOURS); } + catch (InterruptedException ex) { + throw new AssertionError(ex); + }}, + () -> { + try { q.putFirst(null); } catch (InterruptedException ex) { throw new AssertionError(ex); }}, () -> { - try { q.offerLast(null, 1L, MILLISECONDS); } + try { q.putLast(null); } catch (InterruptedException ex) { throw new AssertionError(ex); }}); @@ -241,7 +257,6 @@ public class Collection8Test extends JSR } }; try { - assertFalse(survivors.contains(null)); try { boolean modified = c.removeIf(randomPredicate); if (!modified) {