diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2015-11-29 15:26:53 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2015-11-29 15:26:53 +0000 |
commit | b9c792dad07cab34bc1ecf9f13e8085292ad5e86 (patch) | |
tree | 81165c7122172964790d7de38703c5a593c0e0a4 /src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java | |
parent | f9640207460b701e8a790f99c4a02cf233e101b1 (diff) | |
download | poi-b9c792dad07cab34bc1ecf9f13e8085292ad5e86.tar.gz poi-b9c792dad07cab34bc1ecf9f13e8085292ad5e86.zip |
close resources
fix a few eclipse warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1717077 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java')
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java index d96cc3bbae..91b83861db 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestHyperlink.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotSame; +import java.io.IOException; import java.util.List; import org.junit.Test; @@ -41,13 +42,13 @@ public abstract class BaseTestHyperlink { } @Test - public final void testBasicTypes(){ - Workbook wb = _testDataProvider.createWorkbook(); - CreationHelper createHelper = wb.getCreationHelper(); + public final void testBasicTypes() throws IOException { + Workbook wb1 = _testDataProvider.createWorkbook(); + CreationHelper createHelper = wb1.getCreationHelper(); Cell cell; Hyperlink link; - Sheet sheet = wb.createSheet("Hyperlinks"); + Sheet sheet = wb1.createSheet("Hyperlinks"); //URL cell = sheet.createRow(0).createCell((short) 0); @@ -74,7 +75,7 @@ public abstract class BaseTestHyperlink { //link to a place in this workbook //create a target sheet and cell - Sheet sheet2 = wb.createSheet("Target Sheet"); + Sheet sheet2 = wb1.createSheet("Target Sheet"); sheet2.createRow(0).createCell((short) 0).setCellValue("Target Cell"); cell = sheet.createRow(3).createCell((short) 0); @@ -83,9 +84,10 @@ public abstract class BaseTestHyperlink { link.setAddress("'Target Sheet'!A1"); cell.setHyperlink(link); - wb = _testDataProvider.writeOutAndReadBack(wb); + Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1); + wb1.close(); - sheet = wb.getSheetAt(0); + sheet = wb2.getSheetAt(0); link = sheet.getRow(0).getCell(0).getHyperlink(); assertEquals("http://poi.apache.org/", link.getAddress()); @@ -95,11 +97,13 @@ public abstract class BaseTestHyperlink { assertEquals("mailto:poi@apache.org?subject=Hyperlinks", link.getAddress()); link = sheet.getRow(3).getCell(0).getHyperlink(); assertEquals("'Target Sheet'!A1", link.getAddress()); + + wb2.close(); } // copy a hyperlink via the copy constructor @Test - public void testCopyHyperlink() { + public void testCopyHyperlink() throws IOException { final Workbook wb = _testDataProvider.createWorkbook(); final CreationHelper createHelper = wb.getCreationHelper(); @@ -136,6 +140,8 @@ public abstract class BaseTestHyperlink { assertEquals(2, actualHyperlinks.size()); assertEquals(link1, actualHyperlinks.get(0)); assertEquals(link2, actualHyperlinks.get(1)); + + wb.close(); } public abstract Hyperlink copyHyperlink(Hyperlink link); |