@Test
public void offer() {

    BehaviorProcessor<Integer> pp = BehaviorProcessor.create();
    TestSubscriber<Integer> ts = pp.test(0);
    assertFalse(pp.offer(1));
    ts.request(1);
    assertTrue(pp.offer(1));
    assertFalse(pp.offer(2));
    ts.cancel();
    assertTrue(pp.offer(2));
    ts = pp.test(1);
    assertTrue(pp.offer(null));
    ts.assertFailure(NullPointerException.class, 2);
    assertTrue(pp.hasThrowable());
    assertTrue(pp.getThrowable().toString(), pp.getThrowable() instanceof NullPointerException);
}