aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-05-21 22:38:43 +0000
committerPJ Fanning <fanningpj@apache.org>2022-05-21 22:38:43 +0000
commitdae226aecf2ff1aa5d3fe1e4b5febe4d45134d5d (patch)
treea10f938dfd4dd5fce154b67b27fcf2bdc4466034
parentaa2f66acde172c9b44eaefcb9b4086db13a26a9c (diff)
downloadpoi-dae226aecf2ff1aa5d3fe1e4b5febe4d45134d5d.tar.gz
poi-dae226aecf2ff1aa5d3fe1e4b5febe4d45134d5d.zip
[bug-66079] apply test provided by Vladislav Arakelov
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1901105 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFBugs.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFBugs.java b/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFBugs.java
index f3ce643603..dd241c14d3 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFBugs.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFBugs.java
@@ -196,23 +196,26 @@ class TestXWPFBugs {
//attempt to remove item with numId 2
assertTrue(numbering.removeAbstractNum(BigInteger.valueOf(2)));
- for (int i = 0; i <= 10; i++) {
- XWPFAbstractNum abstractNum = numbering.getAbstractNum(BigInteger.valueOf(i));
+ XWPFDocument docReloaded = writeOutAndReadBack(doc);
+ XWPFNumbering numberingReloaded = docReloaded.getNumbering();
+
+ for (int id = 0; id <= 10; id++) {
+ XWPFAbstractNum abstractNum = numberingReloaded.getAbstractNum(BigInteger.valueOf(id));
// we removed id "2", so this one should be empty, all others not
- if (i == 2) {
- assertNull(abstractNum, "Failed for " + i);
+ if (id == 2) {
+ assertNull(abstractNum, "Failed for " + id);
} else {
- assertNotNull(abstractNum, "Failed for " + i);
- assertEquals(i, abstractNum.getAbstractNum().getAbstractNumId().longValue());
+ assertNotNull(abstractNum, "Failed for " + id);
+ assertEquals(id, abstractNum.getAbstractNum().getAbstractNumId().longValue());
}
}
// removing the same again fails
- assertFalse(numbering.removeAbstractNum(BigInteger.valueOf(2)));
+ assertFalse(numberingReloaded.removeAbstractNum(BigInteger.valueOf(2)));
// removing another one works
- assertTrue(numbering.removeAbstractNum(BigInteger.valueOf(4)));
+ assertTrue(numberingReloaded.removeAbstractNum(BigInteger.valueOf(4)));
}
}