wuwangben commented on issue #2772:
URL: https://github.com/apache/fory/issues/2772#issuecomment-3435713417

   package org.apache.fory.io;
   
   import org.testng.Assert;
   import org.testng.annotations.Test;
   
   import java.io.ByteArrayInputStream;
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
   import java.nio.ByteBuffer;
   
   import static org.testng.Assert.assertEquals;
   
   public class ForyInputStreamTest {
   
     @Test
     public void testFillBufferIndexOutOfBoundsException() throws IOException {
       try (ForyInputStream in = new ForyInputStream(new 
ByteArrayInputStream(new byte[0])) ) {
         try {
           in.fillBuffer(1);
           Assert.fail("Expected IndexOutOfBoundsException to be thrown");
         } catch (IndexOutOfBoundsException e) {
           Assert.assertTrue(e.getMessage().contains("No enough data in the 
stream"));
         }
       }
     }
   
     @Test
     public void testReadToIndexOutOfBoundsException() throws IOException {
       try (ForyInputStream in = new ForyInputStream(new 
ByteArrayInputStream(new byte[0])) ) {
         try {
           in.readTo(new byte[10], 0, 10);
           Assert.fail("Expected IndexOutOfBoundsException to be thrown");
         } catch (IndexOutOfBoundsException e) {
           Assert.assertTrue(e.getMessage().contains("No enough data in the 
stream"));
         }
       }
     }
   }


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to