119 |
|
private DelayQueue populatedQueue(int n) { |
120 |
|
DelayQueue q = new DelayQueue(); |
121 |
|
assertTrue(q.isEmpty()); |
122 |
< |
for(int i = n-1; i >= 0; i-=2) |
122 |
> |
for (int i = n-1; i >= 0; i-=2) |
123 |
|
assertTrue(q.offer(new PDelay(i))); |
124 |
< |
for(int i = (n & 1); i < n; i+=2) |
124 |
> |
for (int i = (n & 1); i < n; i+=2) |
125 |
|
assertTrue(q.offer(new PDelay(i))); |
126 |
|
assertFalse(q.isEmpty()); |
127 |
|
assertEquals(NOCAP, q.remainingCapacity()); |
732 |
|
Object[] o = q.toArray(); |
733 |
|
Arrays.sort(o); |
734 |
|
try { |
735 |
< |
for(int i = 0; i < o.length; i++) |
735 |
> |
for (int i = 0; i < o.length; i++) |
736 |
|
assertEquals(o[i], q.take()); |
737 |
|
} catch (InterruptedException e){ |
738 |
|
unexpectedException(); |
748 |
|
ints = (PDelay[])q.toArray(ints); |
749 |
|
Arrays.sort(ints); |
750 |
|
try { |
751 |
< |
for(int i = 0; i < ints.length; i++) |
751 |
> |
for (int i = 0; i < ints.length; i++) |
752 |
|
assertEquals(ints[i], q.take()); |
753 |
|
} catch (InterruptedException e){ |
754 |
|
unexpectedException(); |
764 |
|
DelayQueue q = populatedQueue(SIZE); |
765 |
|
Object o[] = q.toArray(null); |
766 |
|
shouldThrow(); |
767 |
< |
} catch(NullPointerException success){} |
767 |
> |
} catch (NullPointerException success){} |
768 |
|
} |
769 |
|
|
770 |
|
/** |
775 |
|
DelayQueue q = populatedQueue(SIZE); |
776 |
|
Object o[] = q.toArray(new String[10] ); |
777 |
|
shouldThrow(); |
778 |
< |
} catch(ArrayStoreException success){} |
778 |
> |
} catch (ArrayStoreException success){} |
779 |
|
} |
780 |
|
|
781 |
|
/** |
785 |
|
DelayQueue q = populatedQueue(SIZE); |
786 |
|
int i = 0; |
787 |
|
Iterator it = q.iterator(); |
788 |
< |
while(it.hasNext()) { |
788 |
> |
while (it.hasNext()) { |
789 |
|
assertTrue(q.contains(it.next())); |
790 |
|
++i; |
791 |
|
} |
880 |
|
last = tt; |
881 |
|
} |
882 |
|
} |
883 |
< |
catch(InterruptedException ie) { |
883 |
> |
catch (InterruptedException ie) { |
884 |
|
unexpectedException(); |
885 |
|
} |
886 |
|
} |
925 |
|
try { |
926 |
|
q.drainTo(null); |
927 |
|
shouldThrow(); |
928 |
< |
} catch(NullPointerException success) { |
928 |
> |
} catch (NullPointerException success) { |
929 |
|
} |
930 |
|
} |
931 |
|
|
937 |
|
try { |
938 |
|
q.drainTo(q); |
939 |
|
shouldThrow(); |
940 |
< |
} catch(IllegalArgumentException success) { |
940 |
> |
} catch (IllegalArgumentException success) { |
941 |
|
} |
942 |
|
} |
943 |
|
|
986 |
|
assertTrue(l.size() >= SIZE); |
987 |
|
t.join(); |
988 |
|
assertTrue(q.size() + l.size() >= SIZE); |
989 |
< |
} catch(Exception e){ |
989 |
> |
} catch (Exception e){ |
990 |
|
unexpectedException(); |
991 |
|
} |
992 |
|
} |
999 |
|
try { |
1000 |
|
q.drainTo(null, 0); |
1001 |
|
shouldThrow(); |
1002 |
< |
} catch(NullPointerException success) { |
1002 |
> |
} catch (NullPointerException success) { |
1003 |
|
} |
1004 |
|
} |
1005 |
|
|
1011 |
|
try { |
1012 |
|
q.drainTo(q, 0); |
1013 |
|
shouldThrow(); |
1014 |
< |
} catch(IllegalArgumentException success) { |
1014 |
> |
} catch (IllegalArgumentException success) { |
1015 |
|
} |
1016 |
|
} |
1017 |
|
|