KAFKA-10768 Make ByteBufferInputStream.read(byte[], int, int) to follow the contract#9761
Conversation
…tStreamTest I made a test for ByteBufferInputStream in the ByteBufferLogInputStreamTest. First, I add a ByteBuffer that it's not empty to the ByteBufferInputStream, in order to verify it. After that, I try to use ByteBufferInputStream's read function and check return value whether it's correct.
|
@bertber Please take a look at origin PR (https://github.com/apache/kafka/pull/3752/files#diff-ae627decd5dd27d053a7a9b051860f60df6b89c8884e50df2f9ae0de6a4645e5R40). It would be better to fix the scenario of 'len==0'. |
| } | ||
|
|
||
| @Test | ||
| public void testReadUnsignedIntFromInputStream() { |
There was a problem hiding this comment.
Could you move the tests to ByteBufferInputStreamTest? If there is no such test class, feel free to create new one.
|
Is |
No, I don't think it is related to this PR. |
testReadUnsignedIntFromInputStream from ByteBufferLogInputStreamTest to ByteufferInputStreamTest.
| assertNotNull(logInputStream.nextBatch()); | ||
| logInputStream.nextBatch(); | ||
| } | ||
|
|
There was a problem hiding this comment.
This change have been reverted.
| public class ByteBufferInputStreamTest { | ||
|
|
||
| @Test | ||
| public void testReadUnsignedIntFromInputStream() throws Exception { |
There was a problem hiding this comment.
It have been removed.
from ByteBufferInputStreamTest.
| */ | ||
| package org.apache.kafka.common.utils; | ||
|
|
||
| import static org.junit.Assert.assertEquals; |
There was a problem hiding this comment.
We have a pending PR offering a consistent import order (see #8404 (comment)). Could you please follow the rules (although it is not merged)?
- kafka, org.apache.kafka
- com, net, org
- java, javax
There was a problem hiding this comment.
I have put the java behind the org
I made a test for ByteBufferInputStream in the ByteBufferLogInputStreamTest.
First, I add a ByteBuffer that it's not empty to the ByteBufferInputStream, in order to verify it.
After that, I try to use ByteBufferInputStream's read function and check return value whether it's correct.
Committer Checklist (excluded from commit message)