diff options
author | Javen O'Neal <onealj@apache.org> | 2016-07-17 09:42:13 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2016-07-17 09:42:13 +0000 |
commit | e9d5694574692c423c64d3864378c980cf9f86ca (patch) | |
tree | 6024d8edbc91ead27a8dc55e03286438211c4264 /src/testcases/org | |
parent | ed944416dac5c75a82476322ba75f27cf134604e (diff) | |
download | poi-e9d5694574692c423c64d3864378c980cf9f86ca.tar.gz poi-e9d5694574692c423c64d3864378c980cf9f86ca.zip |
bug 59783: replace deprecated Hyperlink.LINK_* and Hyperlink.getType usage
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1753041 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org')
3 files changed, 12 insertions, 10 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java index eb1c1e95d2..fccbf55f57 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java @@ -28,6 +28,7 @@ import static org.junit.Assert.fail; import java.io.IOException; import java.util.Calendar; +import org.apache.poi.common.usermodel.HyperlinkType; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.ITestDataProvider; import org.apache.poi.ss.SpreadsheetVersion; @@ -771,21 +772,21 @@ public abstract class BaseTestCell { CreationHelper helper = wb1.getCreationHelper(); Cell cell1 = row.createCell(1); - Hyperlink link1 = helper.createHyperlink(Hyperlink.LINK_URL); + Hyperlink link1 = helper.createHyperlink(HyperlinkType.URL); cell1.setHyperlink(link1); assertNotNull(cell1.getHyperlink()); cell1.removeHyperlink(); assertNull(cell1.getHyperlink()); Cell cell2 = row.createCell(0); - Hyperlink link2 = helper.createHyperlink(Hyperlink.LINK_URL); + Hyperlink link2 = helper.createHyperlink(HyperlinkType.URL); cell2.setHyperlink(link2); assertNotNull(cell2.getHyperlink()); cell2.setHyperlink(null); assertNull(cell2.getHyperlink()); Cell cell3 = row.createCell(2); - Hyperlink link3 = helper.createHyperlink(Hyperlink.LINK_URL); + Hyperlink link3 = helper.createHyperlink(HyperlinkType.URL); link3.setAddress("http://poi.apache.org/"); cell3.setHyperlink(link3); assertNotNull(cell3.getHyperlink()); diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java index 91b83861db..d5b71758c7 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java @@ -25,7 +25,7 @@ import java.io.IOException; import java.util.List; import org.junit.Test; - +import org.apache.poi.common.usermodel.HyperlinkType; import org.apache.poi.ss.ITestDataProvider; /** @@ -53,21 +53,21 @@ public abstract class BaseTestHyperlink { //URL cell = sheet.createRow(0).createCell((short) 0); cell.setCellValue("URL Link"); - link = createHelper.createHyperlink(Hyperlink.LINK_URL); + link = createHelper.createHyperlink(HyperlinkType.URL); link.setAddress("http://poi.apache.org/"); cell.setHyperlink(link); //link to a file in the current directory cell = sheet.createRow(1).createCell((short) 0); cell.setCellValue("File Link"); - link = createHelper.createHyperlink(Hyperlink.LINK_FILE); + link = createHelper.createHyperlink(HyperlinkType.FILE); link.setAddress("hyperinks-beta4-dump.txt"); cell.setHyperlink(link); //e-mail link cell = sheet.createRow(2).createCell((short) 0); cell.setCellValue("Email Link"); - link = createHelper.createHyperlink(Hyperlink.LINK_EMAIL); + link = createHelper.createHyperlink(HyperlinkType.EMAIL); //note, if subject contains white spaces, make sure they are url-encoded link.setAddress("mailto:poi@apache.org?subject=Hyperlinks"); cell.setHyperlink(link); @@ -80,7 +80,7 @@ public abstract class BaseTestHyperlink { cell = sheet.createRow(3).createCell((short) 0); cell.setCellValue("Worksheet Link"); - link = createHelper.createHyperlink(Hyperlink.LINK_DOCUMENT); + link = createHelper.createHyperlink(HyperlinkType.DOCUMENT); link.setAddress("'Target Sheet'!A1"); cell.setHyperlink(link); @@ -116,7 +116,7 @@ public abstract class BaseTestHyperlink { cell1 = row.createCell(0); cell2 = row.createCell(1); cell1.setCellValue("URL Link"); - link1 = createHelper.createHyperlink(Hyperlink.LINK_URL); + link1 = createHelper.createHyperlink(HyperlinkType.URL); link1.setAddress("http://poi.apache.org/"); cell1.setHyperlink(link1); diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java index 8db351aa33..65db968861 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java @@ -37,6 +37,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.apache.poi.common.usermodel.HyperlinkType; import org.apache.poi.ss.ITestDataProvider; import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.util.CellAddress; @@ -1212,7 +1213,7 @@ public abstract class BaseTestSheet { @Test public void getHyperlink() throws IOException { Workbook workbook = _testDataProvider.createWorkbook(); - Hyperlink hyperlink = workbook.getCreationHelper().createHyperlink(Hyperlink.LINK_URL); + Hyperlink hyperlink = workbook.getCreationHelper().createHyperlink(HyperlinkType.URL); hyperlink.setAddress("https://poi.apache.org/"); Sheet sheet = workbook.createSheet(); |