From 353a0ab08b40e4ae18fbce9099f28dd8bc4d4357 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Mon, 9 May 2016 03:35:45 +0000 Subject: [PATCH] move TestHSSFComment#attemptToSave2CommentsWithSameCoordinates down to BaseTestCellComment git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1742866 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hssf/usermodel/TestHSSFComment.java | 19 ------------------- .../poi/ss/usermodel/BaseTestCellComment.java | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java index f437b0207b..ac65070340 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java @@ -455,23 +455,4 @@ public final class TestHSSFComment extends BaseTestCellComment { wb.close(); } - - @Test - public void attemptToSave2CommentsWithSameCoordinates(){ - Object err = null; - - HSSFWorkbook wb = new HSSFWorkbook(); - HSSFSheet sh = wb.createSheet(); - HSSFPatriarch patriarch = sh.createDrawingPatriarch(); - patriarch.createCellComment(new HSSFClientAnchor()); - patriarch.createCellComment(new HSSFClientAnchor()); - - try{ - HSSFTestDataSamples.writeOutAndReadBack(wb); - } catch (IllegalStateException e){ - err = 1; - assertEquals(e.getMessage(), "found multiple cell comments for cell $A$1"); - } - assertNotNull(err); - } } diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java index 65d6911c22..e7db17c47c 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.IOException; @@ -354,4 +355,21 @@ public abstract class BaseTestCellComment { wb.close(); } + + @Test + public void attemptToSave2CommentsWithSameCoordinates(){ + 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{ + _testDataProvider.writeOutAndReadBack(wb); + fail("Expected IllegalStateException(found multiple cell comments for cell $A$1"); + } catch (IllegalStateException e){ + assertEquals("found multiple cell comments for cell $A$1", e.getMessage()); + } + } } -- 2.39.5