@Test
public void testErrorPropagation() {

  ClassCastException e = new ClassCastException("fake error");
  stream.observer().onError(e);
  Throwable actualError = null;
  try {
    Truth.assertThat(Lists.newArrayList(stream)).isNotNull();
  } catch (Throwable t) {
    actualError = t;
  }
  Truth.assertThat(actualError).hasMessageThat().contains(e.getMessage());
  Truth.assertThat(actualError).isEqualTo(e);
}