Copilot commented on code in PR #8153:
URL: https://github.com/apache/hbase/pull/8153#discussion_r3153729624


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestBlockIOUtils.java:
##########
@@ -467,25 +457,21 @@ public void testPositionalReadPrematureEOF() throws 
IOException {
     when(in.read(position, buf, bufOffset, totalLen)).thenReturn(9);
     when(in.read(position, buf, bufOffset, totalLen)).thenReturn(-1);

Review Comment:
   In this test, the same Mockito stubbing is applied twice for 
`in.read(position, buf, bufOffset, totalLen)`. The second 
`when(...).thenReturn(-1)` overrides the first, so the mock will not return `9` 
then `-1` as intended, and the test no longer exercises the 
partial-read-then-EOF path. Use sequential stubbing (e.g., a single 
`thenReturn(9, -1)` or chained `thenReturn(9).thenReturn(-1)`) to model the 
intended behavior.
   ```suggestion
       when(in.read(position, buf, bufOffset, totalLen)).thenReturn(9, -1);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to