@@ -118,6 +118,14 @@ void findEmptyRow_noEmpty() {
118118 assertEquals (-1 , reportPage .findEmptyRow (0 , Integer .MAX_VALUE ));
119119 }
120120
121+ @ Test
122+ void findEmptyRow_limitEnd_noEmpty () {
123+ Worksheet worksheet = getWorksheet ();
124+ XmlReportPage reportPage = new XmlReportPage (worksheet );
125+
126+ assertEquals (-1 , reportPage .findEmptyRow (0 , 1 ));
127+ }
128+
121129 @ Test
122130 void findEmptyRow_onEmptySheet () {
123131 Worksheet worksheet = new SSWorksheet ("test sheet" );
@@ -136,7 +144,7 @@ void findEmptyRow_onSheetOfEmptyRow() {
136144 }
137145
138146 @ Test
139- void findEmptyRow () {
147+ void findEmptyRow_allCellsAreEmpty () {
140148 Worksheet worksheet = getWorksheet ();
141149 worksheet .addCellAt (3 , 1 ).setData ("" );
142150 worksheet .addCellAt (3 , 2 ).setData ("" );
@@ -145,11 +153,20 @@ void findEmptyRow() {
145153 assertEquals (2 , reportPage .findEmptyRow (0 , Integer .MAX_VALUE ));
146154 }
147155
156+ @ Test
157+ void findEmptyRow_row2IsNull () {
158+ Worksheet worksheet = getWorksheet ();
159+ worksheet .addCellAt (4 , 1 ).setData ("" ); // zero based row num = 3, zero based row 2 now is null
160+ XmlReportPage reportPage = new XmlReportPage (worksheet );
161+
162+ assertEquals (2 , reportPage .findEmptyRow (0 , Integer .MAX_VALUE ));
163+ }
164+
148165 private static Worksheet getWorksheet () {
149166 Worksheet worksheet = new SSWorksheet ("test sheet" );
150167 worksheet .addCellAt (1 , 1 ).setData ("11" );
151168 worksheet .addCellAt (1 , 2 ).setData ("12" );
152- worksheet .addCellAt (2 , 1 ).setData ("21" );
169+ worksheet .addCellAt (2 , 1 ).setData (21 );
153170 worksheet .addCellAt (2 , 2 ).setData ("22" );
154171 return worksheet ;
155172 }
0 commit comments