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.1 by dl, Mon Sep 7 17:14:06 2015 UTC vs.
Revision 1.2 by jsr166, Mon Sep 7 20:20:40 2015 UTC

# Line 45 | Line 45 | public class SubmissionPublisherTest ext
45              return t;
46          }
47      }
48 <    
48 >
49      static final Executor basicExecutor =
50          (ForkJoinPool.getCommonPoolParallelism() > 0) ?
51          ForkJoinPool.commonPool() :
52          new ThreadPoolExecutor(1, 1, 60, SECONDS,
53                                 new LinkedBlockingQueue<Runnable>(),
54                                 new DaemonThreadFactory());
55 <        
55 >
56      static SubmissionPublisher<Integer> basicPublisher() {
57          return new SubmissionPublisher<Integer>(basicExecutor,
58                                                  Flow.defaultBufferSize());
59      }
60 <    
60 >
61      static class SPException extends RuntimeException {}
62  
63      class TestSubscriber implements Subscriber<Integer> {
# Line 193 | Line 193 | public class SubmissionPublisherTest ext
193       */
194      public void testConstructor3() {
195          try {
196 <            SubmissionPublisher<Integer> p = new SubmissionPublisher<Integer>(null, 8);
196 >            new SubmissionPublisher<Integer>(null, 8);
197              shouldThrow();
198 <        } catch (NullPointerException success) {
199 <        }
198 >        } catch (NullPointerException success) {}
199      }
200  
201      /**
# Line 206 | Line 205 | public class SubmissionPublisherTest ext
205      public void testConstructor4() {
206          Executor e = Executors.newFixedThreadPool(1);
207          try {
208 <            SubmissionPublisher<Integer> p = new SubmissionPublisher<Integer>(e, -1);
208 >            new SubmissionPublisher<Integer>(e, -1);
209              shouldThrow();
210 <        } catch (IllegalArgumentException success) {
212 <        }
210 >        } catch (IllegalArgumentException success) {}
211      }
212  
213      /**
# Line 226 | Line 224 | public class SubmissionPublisherTest ext
224          try {
225              p.submit(1);
226              shouldThrow();
227 <        }
230 <        catch(IllegalStateException success) {
231 <        }
227 >        } catch (IllegalStateException success) {}
228          Throwable ex = new SPException();
229          p.closeExceptionally(ex);
230          assertTrue(p.isClosed());
# Line 251 | Line 247 | public class SubmissionPublisherTest ext
247          try {
248              p.submit(1);
249              shouldThrow();
250 <        }
255 <        catch(IllegalStateException success) {
256 <        }
250 >        } catch (IllegalStateException success) {}
251          p.close();
252          assertTrue(p.isClosed());
253          assertSame(p.getClosedException(), ex);
# Line 358 | Line 352 | public class SubmissionPublisherTest ext
352          s.throwOnCall = true;
353          try {
354              p.subscribe(s);
355 <        } catch(Exception ok) {
362 <        }
355 >        } catch (Exception ok) {}
356          s.awaitError();
357          assertEquals(s.nexts, 0);
358          assertEquals(s.errors, 1);
# Line 373 | Line 366 | public class SubmissionPublisherTest ext
366          SubmissionPublisher<Integer> p = basicPublisher();
367          try {
368              p.subscribe(null);
369 <        } catch(NullPointerException success) {
370 <        }
369 >            shouldThrow();
370 >        } catch (NullPointerException success) {}
371          checkInitialState(p);
372      }
373  
# Line 612 | Line 605 | public class SubmissionPublisherTest ext
605          SubmissionPublisher<Integer> p = basicPublisher();
606          try {
607              p.submit(null);
608 <        } catch (NullPointerException success) {
609 <        }
608 >            shouldThrow();
609 >        } catch (NullPointerException success) {}
610      }
611  
612      /**
# Line 668 | Line 661 | public class SubmissionPublisherTest ext
661          assertEquals(s1.nexts, 20);
662          assertEquals(s1.completes, 1);
663      }
664 <    
664 >
665      static boolean noopHandle(AtomicInteger count) {
666          count.getAndIncrement();
667          return false;
# Line 695 | Line 688 | public class SubmissionPublisherTest ext
688          SubmissionPublisher<Integer> p = basicPublisher();
689          try {
690              p.offer(null, null);
691 <        } catch (NullPointerException success) {
692 <        }
691 >            shouldThrow();
692 >        } catch (NullPointerException success) {}
693      }
694  
695      /**
# Line 825 | Line 818 | public class SubmissionPublisherTest ext
818          SubmissionPublisher<Integer> p = basicPublisher();
819          try {
820              p.offer(null, SHORT_DELAY_MS, MILLISECONDS, null);
821 <        } catch (NullPointerException success) {
822 <        }
821 >            shouldThrow();
822 >        } catch (NullPointerException success) {}
823          try {
824              p.offer(1, SHORT_DELAY_MS, null, null);
825 <        } catch (NullPointerException success) {
826 <        }
825 >            shouldThrow();
826 >        } catch (NullPointerException success) {}
827      }
828  
829      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines