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);
- }
}
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;
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());
+ }
+ }
}