From 8dd5f7b8878971fef75e4327b920f738094ff6cf Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Tue, 7 Mar 2017 03:16:50 +0000 Subject: [PATCH] store repeated expressions as temporary variables to make code shorter git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1785793 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/openxml4j/opc/TestZipPackage.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestZipPackage.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestZipPackage.java index 0989d10cb..91a3db04a 100644 --- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestZipPackage.java +++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestZipPackage.java @@ -58,17 +58,19 @@ public class TestZipPackage { // Check we found the contents of it boolean foundCoreProps = false, foundDocument = false, foundTheme1 = false; - for (PackagePart part : p.getParts()) { - if (part.getPartName().toString().equals("/docProps/core.xml")) { - assertEquals(ContentTypes.CORE_PROPERTIES_PART, part.getContentType()); + for (final PackagePart part : p.getParts()) { + final String partName = part.getPartName().toString(); + final String contentType = part.getContentType(); + if ("/docProps/core.xml".equals(partName)) { + assertEquals(ContentTypes.CORE_PROPERTIES_PART, contentType); foundCoreProps = true; } - if (part.getPartName().toString().equals("/word/document.xml")) { - assertEquals(XWPFRelation.DOCUMENT.getContentType(), part.getContentType()); + if ("/word/document.xml".equals(partName)) { + assertEquals(XWPFRelation.DOCUMENT.getContentType(), contentType); foundDocument = true; } - if (part.getPartName().toString().equals("/word/theme/theme1.xml")) { - assertEquals(XWPFRelation.THEME.getContentType(), part.getContentType()); + if ("/word/theme/theme1.xml".equals(partName)) { + assertEquals(XWPFRelation.THEME.getContentType(), contentType); foundTheme1 = true; } }