You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/05/09 04:29:17 UTC
svn commit: r1742871 -
/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java
Author: onealj
Date: Mon May 9 04:29:17 2016
New Revision: 1742871
URL: http://svn.apache.org/viewvc?rev=1742871&view=rev
Log:
fix BasteTestCellComment#attemptToSave2CommentsWithSameCoordinates to work with different behaviors of HSSFWorkbook and XSSFWorkbook
Modified:
poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java
Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java?rev=1742871&r1=1742870&r2=1742871&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java Mon May 9 04:29:17 2016
@@ -357,19 +357,25 @@ public abstract class BaseTestCellCommen
}
@Test
- public void attemptToSave2CommentsWithSameCoordinates(){
+ public void attemptToSave2CommentsWithSameCoordinates() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sh = wb.createSheet();
CreationHelper factory = wb.getCreationHelper();
Drawing patriarch = sh.createDrawingPatriarch();
patriarch.createCellComment(factory.createClientAnchor());
- patriarch.createCellComment(factory.createClientAnchor());
- try{
+ try {
+ patriarch.createCellComment(factory.createClientAnchor());
_testDataProvider.writeOutAndReadBack(wb);
- fail("Expected IllegalStateException(found multiple cell comments for cell $A$1");
- } catch (IllegalStateException e){
+ fail("Should not be able to create a corrupted workbook with multiple cell comments in one cell");
+ } catch (IllegalStateException e) {
+ // HSSFWorkbooks fail when writing out workbook
assertEquals("found multiple cell comments for cell $A$1", e.getMessage());
+ } catch (IllegalArgumentException e) {
+ // XSSFWorkbooks fail when creating and setting the cell address of the comment
+ assertEquals("Multiple cell comments in one cell are not allowed, cell: A1", e.getMessage());
+ } finally {
+ wb.close();
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org