From 55897d88158d09d847618a2db0b3c753c5b38d55 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Wed, 21 Sep 2016 05:32:26 +0000 Subject: [PATCH] replace @Ignore with POITestCase.skipTest/testPassesNow git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761674 13f79535-47bb-0310-9956-ffa450edef68 --- .../usermodel/TestXSSFSheetShiftRows.java | 6 ++-- .../ss/usermodel/BaseTestSheetShiftRows.java | 30 +++++++++++++++---- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftRows.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftRows.java index 6ff649fcc1..fa4c77fbf8 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftRows.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftRows.java @@ -26,8 +26,6 @@ import static org.junit.Assert.fail; import java.io.IOException; -import junit.framework.AssertionFailedError; - import org.apache.poi.ss.usermodel.BaseTestSheetShiftRows; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; @@ -405,6 +403,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows { at org.apache.poi.xssf.usermodel.XSSFRow.getRowNum(XSSFRow.java:363) at org.apache.poi.xssf.usermodel.TestXSSFSheetShiftRows.bug59733(TestXSSFSheetShiftRows.java:393) */ + // FIXME: remove try, catch, and testPassesNow, skipTest when test passes try { sheet.removeRow(sheet.getRow(0)); assertEquals(1, sheet.getRow(1).getRowNum()); @@ -437,7 +436,8 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows { assertEquals("SUM(D2:D4)", getCellFormula(sheet, "D5")); assertEquals("SUM(E2:E4)", getCellFormula(sheet, "E5")); - sheet.shiftRows(3, sheet.getLastRowNum(), 1); + sheet.shiftRows(3, sheet.getLastRowNum(), 1); + // FIXME: remove try, catch, and testPassesNow, skipTest when test passes try { assertEquals("SUM(C2:C5)", getCellFormula(sheet, "C6")); assertEquals("SUM(D2:D5)", getCellFormula(sheet, "D6")); diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java index efae0d80c6..556e89b43a 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java @@ -17,6 +17,8 @@ package org.apache.poi.ss.usermodel; +import static org.apache.poi.POITestCase.skipTest; +import static org.apache.poi.POITestCase.testPassesNow; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; @@ -295,7 +297,7 @@ public abstract class BaseTestSheetShiftRows { wb.close(); } - @Ignore("bug 56454: Incorrectly handles merged regions that do not contain column 0") + //@Ignore("bug 56454: Incorrectly handles merged regions that do not contain column 0") @Test public final void shiftWithMergedRegions_bug56454() throws IOException { Workbook wb = _testDataProvider.createWorkbook(); @@ -328,7 +330,15 @@ public abstract class BaseTestSheetShiftRows { expectedMergedRegions.add(A4_B8); expectedMergedRegions.add(C4_D8); - assertEquals(expectedMergedRegions, sheet.getMergedRegions()); + // This test is written as expected-to-fail and should be rewritten + // as expected-to-pass when the bug is fixed. + // FIXME: remove try, catch, and testPassesNow, skipTest when test passes + try { + assertEquals(expectedMergedRegions, sheet.getMergedRegions()); + testPassesNow(56454); + } catch (AssertionError e) { + skipTest(e); + } wb.close(); } @@ -589,7 +599,7 @@ public abstract class BaseTestSheetShiftRows { read.close(); } - @Ignore("bug 56454: Incorrectly handles merged regions that do not contain column 0") + //@Ignore("bug 56454: Incorrectly handles merged regions that do not contain column 0") @Test public void shiftRowsWithMergedRegionsThatDoNotContainColumnZero() throws IOException { Workbook wb = _testDataProvider.createWorkbook(); @@ -614,9 +624,17 @@ public abstract class BaseTestSheetShiftRows { // C5:D7 will be shifted down with same size sheet.shiftRows(4, sheet.getLastRowNum(), 1); - assertEquals(2, sheet.getNumMergedRegions()); - assertEquals(CellRangeAddress.valueOf("A4:B8"), sheet.getMergedRegion(0)); - assertEquals(CellRangeAddress.valueOf("C5:D8"), sheet.getMergedRegion(1)); + // This test is written as expected-to-fail and should be rewritten + // as expected-to-pass when the bug is fixed. + // FIXME: remove try, catch, and testPassesNow, skipTest when test passes + try { + assertEquals(2, sheet.getNumMergedRegions()); + assertEquals(CellRangeAddress.valueOf("A4:B8"), sheet.getMergedRegion(0)); + assertEquals(CellRangeAddress.valueOf("C5:D8"), sheet.getMergedRegion(1)); + testPassesNow(56454); + } catch (AssertionError e) { + skipTest(e); + } wb.close(); }