Skip to content

Commit

Permalink
poi: store repeated expressions as temporary variables to make code s…
Browse files Browse the repository at this point in the history
…horter
  • Loading branch information
antony-liu committed Dec 21, 2024
1 parent 3b0a5be commit e187405
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions testcases/openxml4net/TestZipPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,23 @@ public void TestBug56479()

// Check we found the contents of it
bool foundCoreProps = false, foundDocument = false, foundTheme1 = false;
foreach (PackagePart part in p.GetParts())
foreach(PackagePart part in p.GetParts())
{
if (part.PartName.ToString().Equals("/docProps/core.xml"))
String partName = part.PartName.ToString();
String contentType = part.ContentType;
if("/docProps/core.xml".Equals(partName))
{
Assert.AreEqual(ContentTypes.CORE_PROPERTIES_PART, part.ContentType);
Assert.AreEqual(ContentTypes.CORE_PROPERTIES_PART, contentType);
foundCoreProps = true;
}
if (part.PartName.ToString().Equals("/word/document.xml"))
if("/word/document.xml".Equals(partName))
{
Assert.AreEqual(XWPFRelation.DOCUMENT.ContentType, part.ContentType);
Assert.AreEqual(XWPFRelation.DOCUMENT.ContentType, contentType);
foundDocument = true;
}
if (part.PartName.ToString().Equals("/word/theme/theme1.xml"))
if("/word/theme/theme1.xml".Equals(partName))
{
Assert.AreEqual(XWPFRelation.THEME.ContentType, part.ContentType);
Assert.AreEqual(XWPFRelation.THEME.ContentType, contentType);
foundTheme1 = true;
}
}
Expand Down

0 comments on commit e187405

Please sign in to comment.