169 |
|
} |
170 |
|
|
171 |
|
/** |
172 |
< |
* A null Executor argument to SubmissionPublisher constructor throws NPE |
172 |
> |
* A null Executor argument to SubmissionPublisher constructor |
173 |
> |
* throws NullPointerException |
174 |
|
*/ |
175 |
|
public void testConstructor3() { |
176 |
|
try { |
181 |
|
|
182 |
|
/** |
183 |
|
* A negative capacity argument to SubmissionPublisher constructor |
184 |
< |
* throws IAE |
184 |
> |
* throws IllegalArgumentException |
185 |
|
*/ |
186 |
|
public void testConstructor4() { |
187 |
|
Executor e = Executors.newFixedThreadPool(1); |
193 |
|
|
194 |
|
/** |
195 |
|
* A closed publisher reports isClosed with no closedException and |
196 |
< |
* throws ISE upon attempted submission; a subsequent close or |
197 |
< |
* closeExceptionally has no additional effect. |
196 |
> |
* throws IllegalStateException upon attempted submission; a |
197 |
> |
* subsequent close or closeExceptionally has no additional |
198 |
> |
* effect. |
199 |
|
*/ |
200 |
|
public void testClose() { |
201 |
|
SubmissionPublisher<Integer> p = basicPublisher(); |
215 |
|
|
216 |
|
/** |
217 |
|
* A publisher closedExceptionally reports isClosed with the |
218 |
< |
* closedException and throws ISE upon attempted submission; a |
219 |
< |
* subsequent close or closeExceptionally has no additional |
220 |
< |
* effect. |
218 |
> |
* closedException and throws IllegalStateException upon attempted |
219 |
> |
* submission; a subsequent close or closeExceptionally has no |
220 |
> |
* additional effect. |
221 |
|
*/ |
222 |
|
public void testCloseExceptionally() { |
223 |
|
SubmissionPublisher<Integer> p = basicPublisher(); |
494 |
|
s1.request = false; |
495 |
|
p.subscribe(s1); |
496 |
|
s1.awaitSubscribe(); |
497 |
< |
assertTrue(p.estimateMinimumDemand() == 0); |
497 |
> |
assertEquals(0, p.estimateMinimumDemand()); |
498 |
|
TestSubscriber s2 = new TestSubscriber(); |
499 |
|
p.subscribe(s2); |
500 |
|
p.submit(1); |
535 |
|
} |
536 |
|
|
537 |
|
/** |
538 |
< |
* Negative request causes error |
538 |
> |
* Non-positive request causes error |
539 |
|
*/ |
540 |
|
public void testRequest3() { |
541 |
|
SubmissionPublisher<Integer> p = basicPublisher(); |
542 |
|
TestSubscriber s1 = new TestSubscriber(); |
543 |
|
TestSubscriber s2 = new TestSubscriber(); |
544 |
+ |
TestSubscriber s3 = new TestSubscriber(); |
545 |
|
p.subscribe(s1); |
546 |
|
p.subscribe(s2); |
547 |
+ |
p.subscribe(s3); |
548 |
+ |
s3.awaitSubscribe(); |
549 |
|
s2.awaitSubscribe(); |
550 |
|
s1.awaitSubscribe(); |
551 |
|
s1.sn.request(-1L); |
552 |
+ |
s3.sn.request(0L); |
553 |
|
p.submit(1); |
554 |
|
p.submit(2); |
555 |
|
p.close(); |
559 |
|
s1.awaitError(); |
560 |
|
assertEquals(1, s1.errors); |
561 |
|
assertTrue(s1.lastError instanceof IllegalArgumentException); |
562 |
+ |
s3.awaitError(); |
563 |
+ |
assertEquals(1, s3.errors); |
564 |
+ |
assertTrue(s3.lastError instanceof IllegalArgumentException); |
565 |
|
} |
566 |
|
|
567 |
|
/** |