diff options
author | Dominik Stadler <centic@apache.org> | 2017-09-17 11:08:45 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2017-09-17 11:08:45 +0000 |
commit | e504e87873d0837079da7567cf04d8fd219217b4 (patch) | |
tree | f5952360bcc13c93955885d9947d654b148e7d9e /src/testcases/org/apache/poi/poifs | |
parent | ade4aec2ddd09c009fe422985186799a79d94fe1 (diff) | |
download | poi-e504e87873d0837079da7567cf04d8fd219217b4.tar.gz poi-e504e87873d0837079da7567cf04d8fd219217b4.zip |
Remove deprecated methods from NPOIFSFileSystem/OPOIFSFileSystem
IntelliJ warnings/suggestions
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808622 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/poifs')
-rw-r--r-- | src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java b/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java index 8b53738030..a1b877fd43 100644 --- a/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java @@ -50,8 +50,8 @@ public class TestOfficeXMLException extends TestCase { assertContains(e.getMessage(), "You are calling the part of POI that deals with OLE2 Office Documents"); } } - public void test2003XMLException() throws IOException - { + + public void test2003XMLException() throws IOException { InputStream in = openSampleStream("SampleSS.xml"); try { @@ -87,18 +87,9 @@ public class TestOfficeXMLException extends TestCase { } private void confirmIsPOIFS(String sampleFileName, boolean expectedResult) throws IOException { - InputStream in = FileMagic.prepareToCheckMagic(openSampleStream(sampleFileName)); - try { - boolean actualResult; - try { - actualResult = POIFSFileSystem.hasPOIFSHeader(in); - } catch (IOException e) { - throw new RuntimeException(e); - } - assertEquals(expectedResult, actualResult); - } finally { - in.close(); - } + try (InputStream in = FileMagic.prepareToCheckMagic(openSampleStream(sampleFileName))) { + assertEquals(expectedResult, FileMagic.valueOf(in) == FileMagic.OLE2); + } } public void testFileCorruption() throws Exception { @@ -109,11 +100,12 @@ public class TestOfficeXMLException extends TestCase { // detect header InputStream in = FileMagic.prepareToCheckMagic(testInput); - assertFalse(POIFSFileSystem.hasPOIFSHeader(in)); + + assertFalse(FileMagic.valueOf(in) == FileMagic.OLE2); // check if InputStream is still intact byte[] test = new byte[3]; - in.read(test); + assertEquals(3, in.read(test)); assertTrue(Arrays.equals(testData, test)); assertEquals(-1, in.read()); } @@ -127,11 +119,12 @@ public class TestOfficeXMLException extends TestCase { // detect header InputStream in = FileMagic.prepareToCheckMagic(testInput); - assertFalse(OPOIFSFileSystem.hasPOIFSHeader(in)); + assertFalse(FileMagic.valueOf(in) == FileMagic.OLE2); + assertEquals(FileMagic.UNKNOWN, FileMagic.valueOf(in)); // check if InputStream is still intact byte[] test = new byte[3]; - in.read(test); + assertEquals(3, in.read(test)); assertTrue(Arrays.equals(testData, test)); assertEquals(-1, in.read()); } |