Exemplo n.º 1
0
 @Test
 public void testDelegate3() {
   TestSubscriber<Integer> ts1 = TestSubscriber.create();
   TestSubscriber<Integer> ts2 = TestSubscriber.create(ts1, 0);
   ts2.onCompleted();
   ts1.assertCompleted();
 }
Exemplo n.º 2
0
  @Test
  public void testDelegate1() {
    TestObserver<Integer> to = new TestObserver<Integer>();
    TestSubscriber<Integer> ts = TestSubscriber.create(to);
    ts.onCompleted();

    to.assertTerminalEvent();
  }
Exemplo n.º 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!");
 }
Exemplo n.º 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
    }
  }
Exemplo n.º 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();
  }
Exemplo n.º 6
0
 @Test(expected = NullPointerException.class)
 public void testNullDelegate3() {
   TestSubscriber<Integer> ts = new TestSubscriber<Integer>((Subscriber<Integer>) null, 0);
   ts.onCompleted();
 }