]> source.dussan.org Git - poi.git/commitdiff
move TestHSSFComment#attemptToSave2CommentsWithSameCoordinates down to BaseTestCellCo...
authorJaven O'Neal <onealj@apache.org>
Mon, 9 May 2016 03:35:45 +0000 (03:35 +0000)
committerJaven O'Neal <onealj@apache.org>
Mon, 9 May 2016 03:35:45 +0000 (03:35 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1742866 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java

index f437b0207ba3b95d5a1e1e72d43495f1cc709ec0..ac6507034027e320fb292d3f71729bb631e55ce4 100644 (file)
@@ -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);
-    }
 }
index 65d6911c22484086169bf661c05b393dc0d56c4d..e7db17c47c978740d64f45172aa88db451d10930 100644 (file)
@@ -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());
+        }
+    }
 }