Пример #1
0
 @Test
 public void testDelegate3() {
   TestSubscriber<Integer> ts1 = TestSubscriber.create();
   TestSubscriber<Integer> ts2 = TestSubscriber.create(ts1, 0);
   ts2.onCompleted();
   ts1.assertCompleted();
 }
Пример #2
0
  @Test
  public void testDelegate1() {
    TestObserver<Integer> to = new TestObserver<Integer>();
    TestSubscriber<Integer> ts = TestSubscriber.create(to);
    ts.onCompleted();

    to.assertTerminalEvent();
  }
Пример #3
0
 @Test
 public void testCompleted() {
   TestSubscriber<Integer> ts = new TestSubscriber<Integer>();
   ts.onCompleted();
   try {
     ts.assertNotCompleted();
   } catch (AssertionError ex) {
     // expected
     return;
   }
   fail("Completed and no assertion error!");
 }
Пример #4
0
  @Test
  public void testNoTerminalEventBut1Completed() {
    TestSubscriber<Integer> ts = TestSubscriber.create();

    ts.onCompleted();

    try {
      ts.assertNoTerminalEvent();
      fail("Failed to report there were terminal event(s)!");
    } catch (AssertionError ex) {
      // expected
    }
  }
Пример #5
0
  @Test(timeout = 1000)
  public void testOnCompletedCrashCountsDownLatch() {
    TestObserver<Integer> to =
        new TestObserver<Integer>() {
          @Override
          public void onCompleted() {
            throw new TestException();
          }
        };
    TestSubscriber<Integer> ts = TestSubscriber.create(to);

    try {
      ts.onCompleted();
    } catch (TestException ex) {
      // expected
    }

    ts.awaitTerminalEvent();
  }
Пример #6
0
 @Test(expected = NullPointerException.class)
 public void testNullDelegate3() {
   TestSubscriber<Integer> ts = new TestSubscriber<Integer>((Subscriber<Integer>) null, 0);
   ts.onCompleted();
 }