From a9f5110d1e60b6f0020ef35003b415c7dee538a2 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Mon, 18 Apr 2016 04:46:05 +0000 Subject: [PATCH] add unit test for SXSSFSheet#changeRowNum git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1739688 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/streaming/TestSXSSFSheet.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java index 07b80c43eb..fabe7e0fe0 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java @@ -20,6 +20,7 @@ package org.apache.poi.xssf.streaming; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; import static org.junit.Assert.fail; import java.io.IOException; @@ -154,4 +155,21 @@ public final class TestSXSSFSheet extends BaseTestXSheet { template.close(); } } + + @Test + public void changeRowNum() throws IOException { + SXSSFWorkbook wb = new SXSSFWorkbook(3); + SXSSFSheet sheet = wb.createSheet(); + SXSSFRow row0 = sheet.createRow(0); + SXSSFRow row1 = sheet.createRow(1); + sheet.changeRowNum(row0, 2); + + assertEquals("Row 1 knows its row number", 1, row1.getRowNum()); + assertEquals("Row 2 knows its row number", 2, row0.getRowNum()); + assertEquals("Sheet knows Row 1's row number", 1, sheet.getRowNum(row1)); + assertEquals("Sheet knows Row 2's row number", 2, sheet.getRowNum(row0)); + assertEquals("Sheet row iteratation order should be ascending", row1, sheet.iterator().next()); + + wb.close(); + } } -- 2.39.5