aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcases/org')
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java21
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