use of org.mockito.stubbing.Stubber in project imcache by Cetsoft.
the class RedisStreamReaderTest method setupInputStreamRead.
protected void setupInputStreamRead(final byte[] bytes, int chunkSize) throws IOException {
Stubber stubber = null;
for (int i = 0; i < bytes.length / chunkSize + 1; i++) {
int length = (i + 1) * chunkSize < bytes.length ? chunkSize : bytes.length - i * chunkSize;
@SuppressWarnings("rawtypes") Answer answer = createAnswer(bytes, i * chunkSize, length);
if (stubber == null) {
stubber = doAnswer(answer);
} else {
stubber = stubber.doAnswer(answer);
}
}
stubber.when(inputStream).read((byte[]) any());
}