diff options
author | Javen O'Neal <onealj@apache.org> | 2016-07-17 04:41:20 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2016-07-17 04:41:20 +0000 |
commit | dcf43f75bd8f0f862530d77aca0946e3957644bc (patch) | |
tree | d9427943f7e80052bd48f6db8327eb8eb568c652 /src/testcases/org | |
parent | 1589ae176a68173aa8438a0850c711099674bc1c (diff) | |
download | poi-dcf43f75bd8f0f862530d77aca0946e3957644bc.tar.gz poi-dcf43f75bd8f0f862530d77aca0946e3957644bc.zip |
bug 59872: add Sheet.getHyperlink(CellAddress)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1753009 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org')
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java index b7b85cf730..65565f17bf 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java @@ -1208,6 +1208,27 @@ public abstract class BaseTestSheet { workbook.close(); wb.close(); } + + @Test + public void getHyperlink() throws IOException { + Workbook workbook = _testDataProvider.createWorkbook(); + Hyperlink hyperlink = workbook.getCreationHelper().createHyperlink(Hyperlink.LINK_URL); + hyperlink.setAddress("https://poi.apache.org/"); + + Sheet sheet = workbook.createSheet(); + Cell cell = sheet.createRow(5).createCell(1); + + assertEquals("list size before add", 0, sheet.getHyperlinkList().size()); + cell.setHyperlink(hyperlink); + assertEquals("list size after add", 1, sheet.getHyperlinkList().size()); + + assertEquals("list", hyperlink, sheet.getHyperlinkList().get(0)); + assertEquals("row, col", hyperlink, sheet.getHyperlink(5, 1)); + assertEquals("addr", hyperlink, sheet.getHyperlink(new CellAddress("B4"))); + assertEquals("no hyperlink at A1", null, sheet.getHyperlink(CellAddress.A1)); + + workbook.close(); + } @Test |