move TestHSSFComment#attemptToSave2CommentsWithSameCoordinates down to BaseTestCellComment

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1742866 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-05-09 03:35:45 +00:00
parent 94e4eb5276
commit 88d0eee64b
2 changed files with 18 additions and 19 deletions

View File

@ -455,23 +455,4 @@ public final class TestHSSFComment extends BaseTestCellComment {
wb.close(); 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);
}
} }

View File

@ -23,6 +23,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
@ -354,4 +355,21 @@ public abstract class BaseTestCellComment {
wb.close(); 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());
}
}
} }