diff options
author | Dominik Stadler <centic@apache.org> | 2023-02-05 21:11:09 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2023-02-05 21:11:09 +0000 |
commit | 3eae53357d0ded614a5a0d7dd875b74eeb0fd18d (patch) | |
tree | db78fd8dda472339b291f8e82e1d783789e8c9ea /poi-ooxml | |
parent | 1ca2e638ed1de3438cf660f1006d6cd42e265e3c (diff) | |
download | poi-3eae53357d0ded614a5a0d7dd875b74eeb0fd18d.tar.gz poi-3eae53357d0ded614a5a0d7dd875b74eeb0fd18d.zip |
Avoid a file-handle leak in tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1907445 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFTheme.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFTheme.java b/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFTheme.java index 56fa5e20ca..0ae73cfd23 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFTheme.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFTheme.java @@ -31,13 +31,14 @@ public final class TestXWPFTheme { @Test void testRead() throws IOException { - XWPFDocument docx = XWPFTestDataSamples.openSampleDocument("sample.docx"); - XWPFTheme theme = docx.getTheme(); - assertEquals("Office Theme", theme.getName()); - assertEquals("Cambria", theme.getMajorFont()); - assertEquals("Calibri", theme.getMinorFont()); - CTColor accent1 = theme.getCTColor("accent1"); - XSLFColor color = new XSLFColor(accent1, null, null, null); - assertEquals(new Color(79, 129, 189), color.getColor()); + try (XWPFDocument docx = XWPFTestDataSamples.openSampleDocument("sample.docx")) { + XWPFTheme theme = docx.getTheme(); + assertEquals("Office Theme", theme.getName()); + assertEquals("Cambria", theme.getMajorFont()); + assertEquals("Calibri", theme.getMinorFont()); + CTColor accent1 = theme.getCTColor("accent1"); + XSLFColor color = new XSLFColor(accent1, null, null, null); + assertEquals(new Color(79, 129, 189), color.getColor()); + } } } |