mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
[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
This commit is contained in:
parent
aa2f66acde
commit
dae226aecf
@ -196,23 +196,26 @@ class TestXWPFBugs {
|
|||||||
//attempt to remove item with numId 2
|
//attempt to remove item with numId 2
|
||||||
assertTrue(numbering.removeAbstractNum(BigInteger.valueOf(2)));
|
assertTrue(numbering.removeAbstractNum(BigInteger.valueOf(2)));
|
||||||
|
|
||||||
for (int i = 0; i <= 10; i++) {
|
XWPFDocument docReloaded = writeOutAndReadBack(doc);
|
||||||
XWPFAbstractNum abstractNum = numbering.getAbstractNum(BigInteger.valueOf(i));
|
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
|
// we removed id "2", so this one should be empty, all others not
|
||||||
if (i == 2) {
|
if (id == 2) {
|
||||||
assertNull(abstractNum, "Failed for " + i);
|
assertNull(abstractNum, "Failed for " + id);
|
||||||
} else {
|
} else {
|
||||||
assertNotNull(abstractNum, "Failed for " + i);
|
assertNotNull(abstractNum, "Failed for " + id);
|
||||||
assertEquals(i, abstractNum.getAbstractNum().getAbstractNumId().longValue());
|
assertEquals(id, abstractNum.getAbstractNum().getAbstractNumId().longValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// removing the same again fails
|
// removing the same again fails
|
||||||
assertFalse(numbering.removeAbstractNum(BigInteger.valueOf(2)));
|
assertFalse(numberingReloaded.removeAbstractNum(BigInteger.valueOf(2)));
|
||||||
|
|
||||||
// removing another one works
|
// removing another one works
|
||||||
assertTrue(numbering.removeAbstractNum(BigInteger.valueOf(4)));
|
assertTrue(numberingReloaded.removeAbstractNum(BigInteger.valueOf(4)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user