@Test
public void testMaterialize1() {

    // null will cause onError to be triggered before "three" can be returned
    final TestAsyncErrorObservable o1 = new TestAsyncErrorObservable("one", "two", null, "three");
    TestObserver Observer = new TestObserver();
    Observable<Notification<String>> m = Observable.create(materialize(Observable.create(o1)));
    m.subscribe(Observer);
    try {
        o1.t.join();
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
    assertFalse(Observer.onError);
    assertTrue(Observer.onCompleted);
    assertEquals(3, Observer.notifications.size());
    assertEquals("one", Observer.notifications.get(0).getValue());
    assertTrue(Observer.notifications.get(0).isOnNext());
    assertEquals("two", Observer.notifications.get(1).getValue());
    assertTrue(Observer.notifications.get(1).isOnNext());
    assertEquals(NullPointerException.class, Observer.notifications.get(2).getThrowable().getClass());
    assertTrue(Observer.notifications.get(2).isOnError());
}