pjfanning commented on code in PR #920:
URL: https://github.com/apache/poi/pull/920#discussion_r2447988262


##########
poi-ooxml/src/test/java/org/apache/poi/xssf/eventusermodel/TestXSSFBReader.java:
##########
@@ -216,4 +229,234 @@ public String toString() {
             return sb.toString();
         }
     }
+
+    private static XSSFBSheetHandler.XSSFBSheetContentsHandler 
mockSheetContentsHandler() {
+        return mock(
+                XSSFBSheetHandler.XSSFBSheetContentsHandler.class,
+                withSettings().strictness(Strictness.STRICT_STUBS));
+    }
+
+    private static ArgumentMatcher<XSSFComment> commentWith(String author, 
String text) {
+        return comment -> comment != null
+                && author.equals(comment.getAuthor())
+                && comment.getString() != null
+                && text.equals(comment.getString().toString().trim());
+    }
+
+    void testXSSFBSheetContentsHandler(String fileName,
+            XSSFBSheetHandler.XSSFBSheetContentsHandler handler) throws 
Exception {
+        try (OPCPackage pkg = 
OPCPackage.open(_ssTests.openResourceAsStream(fileName))) {
+            XSSFBReader r = new XSSFBReader(pkg);
+            assertNotNull(r.getXSSFBStylesTable());
+            XSSFBSharedStringsTable sst = new XSSFBSharedStringsTable(pkg);
+            XSSFBStylesTable xssfbStylesTable = r.getXSSFBStylesTable();
+            XSSFBReader.SheetIterator it = (XSSFBReader.SheetIterator) 
r.getSheetsData();
+
+            while (it.hasNext()) {
+                InputStream is = it.next();
+                XSSFBSheetHandler sheetHandler = new XSSFBSheetHandler(is,
+                        xssfbStylesTable,
+                        it.getXSSFBSheetComments(),
+                        sst,
+                        handler,
+                        false);
+                sheetHandler.parse();
+            }
+        }
+    }
+
+    @Test
+    void testBasicXSSFBSheetContentsHandler() throws Exception {
+        XSSFBSheetHandler.XSSFBSheetContentsHandler handler = 
mockSheetContentsHandler();
+        testXSSFBSheetContentsHandler("testVarious.xlsb", handler);
+  
+        InOrder ordered = inOrder(handler);

Review Comment:
   Why do we need mockito? Can't this be tested with the APIs as is?



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