You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Test
public void testFromReaderWillUnsubscribeBeforeCallingNextRead() {
final byte[] inBytes = "test".getBytes();
final AtomicInteger numReads = new AtomicInteger(0);
ByteArrayInputStream is = new ByteArrayInputStream(inBytes) {
@Override
public synchronized int read(byte[] b, int off, int len) {
numReads.incrementAndGet();
return super.read(b, off, len);
}
};
StringObservable.from(new InputStreamReader(is)).first().toBlocking().single();
assertEquals(1, numReads.get());
}
Looking at the test code, I don't see how this test is related to unsubscribe handling. All I see is a test that asserts that the overriden read() on the stream is called exactly once.