ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/SubmissionPublisherTest.java
(Generate patch)

Comparing jsr166/src/test/tck/SubmissionPublisherTest.java (file contents):
Revision 1.19 by dl, Thu Mar 9 00:11:16 2017 UTC vs.
Revision 1.23 by dl, Sun Nov 26 21:37:56 2017 UTC

# Line 169 | Line 169 | public class SubmissionPublisherTest ext
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 {
# Line 180 | Line 181 | public class SubmissionPublisherTest ext
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);
# Line 192 | Line 193 | public class SubmissionPublisherTest ext
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();
# Line 213 | Line 215 | public class SubmissionPublisherTest ext
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();
# Line 400 | Line 402 | public class SubmissionPublisherTest ext
402       * Cancelling a subscription eventually causes no more onNexts to be issued
403       */
404      public void testCancel() {
405 <        SubmissionPublisher<Integer> p = basicPublisher();
405 >        SubmissionPublisher<Integer> p =
406 >            new SubmissionPublisher<Integer>(basicExecutor, 4); // must be < 20
407          TestSubscriber s1 = new TestSubscriber();
408          TestSubscriber s2 = new TestSubscriber();
409          p.subscribe(s1);
# Line 492 | Line 495 | public class SubmissionPublisherTest ext
495          s1.request = false;
496          p.subscribe(s1);
497          s1.awaitSubscribe();
498 <        assertTrue(p.estimateMinimumDemand() == 0);
498 >        assertEquals(0, p.estimateMinimumDemand());
499          TestSubscriber s2 = new TestSubscriber();
500          p.subscribe(s2);
501          p.submit(1);
# Line 564 | Line 567 | public class SubmissionPublisherTest ext
567  
568      /**
569       * estimateMinimumDemand reports 0 until request, nonzero after
570 <     * request, and zero again after delivery
570 >     * request
571       */
572      public void testEstimateMinimumDemand() {
573          TestSubscriber s = new TestSubscriber();
# Line 575 | Line 578 | public class SubmissionPublisherTest ext
578          assertEquals(0, p.estimateMinimumDemand());
579          s.sn.request(1);
580          assertEquals(1, p.estimateMinimumDemand());
578        p.submit(1);
579        s.awaitNext(1);
580        assertEquals(0, p.estimateMinimumDemand());
581      }
582  
583      /**
# Line 640 | Line 640 | public class SubmissionPublisherTest ext
640          p.subscribe(s1);
641          p.subscribe(s2);
642          for (int i = 1; i <= 20; ++i) {
643            assertTrue(p.estimateMinimumDemand() <= 1);
643              assertTrue(p.submit(i) >= 0);
644          }
645          p.close();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines