This is an automated email from the ASF dual-hosted git repository.

pjfanning pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b34ee018d2 TestPOIFSMiniStore: assert empty ministore throws (#1504)
b34ee018d2 is described below

commit b34ee018d288b81ab17a8b8aaed38e961dce955d
Author: Sharang Gupta <[email protected]>
AuthorDate: Thu Oct 29 17:57:14 2026 +0000

    TestPOIFSMiniStore: assert empty ministore throws (#1504)
    
    testCreateMiniStoreFirst calls getNextBlock(0) on an empty ministore
    inside a try with an empty catch and no fail(), so it passes whether or
    not the IndexOutOfBoundsException is thrown. Use assertThrows like the
    rest of the class.
---
 .../java/org/apache/poi/poifs/filesystem/TestPOIFSMiniStore.java     | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git 
a/poi/src/test/java/org/apache/poi/poifs/filesystem/TestPOIFSMiniStore.java 
b/poi/src/test/java/org/apache/poi/poifs/filesystem/TestPOIFSMiniStore.java
index 6b85326a90..ef005bc665 100644
--- a/poi/src/test/java/org/apache/poi/poifs/filesystem/TestPOIFSMiniStore.java
+++ b/poi/src/test/java/org/apache/poi/poifs/filesystem/TestPOIFSMiniStore.java
@@ -356,10 +356,7 @@ final class TestPOIFSMiniStore {
         assertEquals(POIFSConstants.FAT_SECTOR_BLOCK, fs.getNextBlock(1));
         assertEquals(POIFSConstants.UNUSED_BLOCK, fs.getNextBlock(2));
         // Ministore has no blocks, so can't iterate until used
-        try {
-            ministore.getNextBlock(0);
-        } catch (IndexOutOfBoundsException e) {
-        }
+        assertThrows(IndexOutOfBoundsException.class, () -> 
fs.getMiniStore().getNextBlock(0), "Empty ministore has no blocks");
 
         // Write a very small new document, will populate the ministore for us
         byte[] data = new byte[8];


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

Reply via email to