mirror of https://github.com/apache/poi.git
[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
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue