You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2022/05/26 13:19:26 UTC

svn commit: r1901287 - /poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSubtotal.java

Author: fanningpj
Date: Thu May 26 13:19:26 2022
New Revision: 1901287

URL: http://svn.apache.org/viewvc?rev=1901287&view=rev
Log:
[bug-66093] fix some var names

Modified:
    poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSubtotal.java

Modified: poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSubtotal.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSubtotal.java?rev=1901287&r1=1901286&r2=1901287&view=diff
==============================================================================
--- poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSubtotal.java (original)
+++ poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSubtotal.java Thu May 26 13:19:26 2022
@@ -92,12 +92,12 @@ final class TestSubtotal {
         FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
         Sheet sh = wb.createSheet();
-        Cell a1 = sh.createRow(1).createCell(1);
-        a1.setCellValue(1);
-        Cell a2 = sh.createRow(2).createCell(1);
-        a2.setCellValue(3);
-        Cell a3 = sh.createRow(3).createCell(1);
-        a3.setCellFormula("SUBTOTAL(1,B2:B3)");
+        Cell b2 = sh.createRow(1).createCell(1);
+        b2.setCellValue(1);
+        Cell b3 = sh.createRow(2).createCell(1);
+        b3.setCellValue(3);
+        Cell b4 = sh.createRow(3).createCell(1);
+        b4.setCellFormula("SUBTOTAL(1,B2:B3)");
         Cell a4 = sh.createRow(4).createCell(1);
         a4.setCellValue(1);
         Cell a5 = sh.createRow(5).createCell(1);
@@ -111,7 +111,7 @@ final class TestSubtotal {
 
         fe.evaluateAll();
 
-        assertEquals(2.0, a3.getNumericCellValue(), 0);
+        assertEquals(2.0, b4.getNumericCellValue(), 0);
         assertEquals(8.0, a6.getNumericCellValue(), 0);
         assertEquals(3.0, a7.getNumericCellValue(), 0);
         assertEquals(3.0, a8.getNumericCellValue(), 0);
@@ -126,12 +126,12 @@ final class TestSubtotal {
         FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
         Sheet sh = wb.createSheet();
-        Cell a1 = sh.createRow(1).createCell(1);
-        a1.setCellValue(1);
-        Cell a2 = sh.createRow(2).createCell(1);
-        a2.setCellValue(3);
-        Cell a3 = sh.createRow(3).createCell(1);
-        a3.setCellFormula("SUBTOTAL(9,B2:B3)");
+        Cell b2 = sh.createRow(1).createCell(1);
+        b2.setCellValue(1);
+        Cell b3 = sh.createRow(2).createCell(1);
+        b3.setCellValue(3);
+        Cell b4 = sh.createRow(3).createCell(1);
+        b4.setCellFormula("SUBTOTAL(9,B2:B3)");
         Cell a4 = sh.createRow(4).createCell(1);
         a4.setCellValue(1);
         Cell a5 = sh.createRow(5).createCell(1);
@@ -145,7 +145,7 @@ final class TestSubtotal {
 
         fe.evaluateAll();
 
-        assertEquals(4.0, a3.getNumericCellValue(), 0);
+        assertEquals(4.0, b4.getNumericCellValue(), 0);
         assertEquals(26.0, a6.getNumericCellValue(), 0);
         assertEquals(12.0, a7.getNumericCellValue(), 0);
         assertEquals(12.0, a8.getNumericCellValue(), 0);
@@ -160,12 +160,12 @@ final class TestSubtotal {
         FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
         Sheet sh = wb.createSheet();
-        Cell a1 = sh.createRow(1).createCell(1);
-        a1.setCellValue(1);
-        Cell a2 = sh.createRow(2).createCell(1);
-        a2.setCellValue(3);
-        Cell a3 = sh.createRow(3).createCell(1);
-        a3.setCellFormula("SUBTOTAL(2,B2:B3)");
+        Cell b2 = sh.createRow(1).createCell(1);
+        b2.setCellValue(1);
+        Cell b3 = sh.createRow(2).createCell(1);
+        b3.setCellValue(3);
+        Cell b4 = sh.createRow(3).createCell(1);
+        b4.setCellFormula("SUBTOTAL(2,B2:B3)");
         Cell a4 = sh.createRow(4).createCell(1);
         a4.setCellValue("POI");                  // A4 is string and not counted
         /*Cell a5 =*/ sh.createRow(5).createCell(1); // A5 is blank and not counted
@@ -179,7 +179,7 @@ final class TestSubtotal {
 
         fe.evaluateAll();
 
-        assertEquals(2.0, a3.getNumericCellValue(), 0);
+        assertEquals(2.0, b4.getNumericCellValue(), 0);
         assertEquals(6.0, a6.getNumericCellValue(), 0);
         assertEquals(2.0, a7.getNumericCellValue(), 0);
         assertEquals(2.0, a8.getNumericCellValue(), 0);
@@ -194,12 +194,12 @@ final class TestSubtotal {
         FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
         Sheet sh = wb.createSheet();
-        Cell a1 = sh.createRow(1).createCell(1);
-        a1.setCellValue(1);
-        Cell a2 = sh.createRow(2).createCell(1);
-        a2.setCellValue(3);
-        Cell a3 = sh.createRow(3).createCell(1);
-        a3.setCellFormula("SUBTOTAL(3,B2:B3)");
+        Cell b2 = sh.createRow(1).createCell(1);
+        b2.setCellValue(1);
+        Cell b3 = sh.createRow(2).createCell(1);
+        b3.setCellValue(3);
+        Cell b4 = sh.createRow(3).createCell(1);
+        b4.setCellFormula("SUBTOTAL(3,B2:B3)");
         Cell a4 = sh.createRow(4).createCell(1);
         a4.setCellValue("POI");                  // A4 is string and not counted
         /*Cell a5 =*/ sh.createRow(5).createCell(1); // A5 is blank and not counted
@@ -213,7 +213,7 @@ final class TestSubtotal {
 
         fe.evaluateAll();
 
-        assertEquals(2.0, a3.getNumericCellValue(), 0);
+        assertEquals(2.0, b4.getNumericCellValue(), 0);
         assertEquals(8.0, a6.getNumericCellValue(), 0);
         assertEquals(3.0, a7.getNumericCellValue(), 0);
         assertEquals(3.0, a8.getNumericCellValue(), 0);
@@ -228,12 +228,12 @@ final class TestSubtotal {
         FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
         Sheet sh = wb.createSheet();
-        Cell a1 = sh.createRow(1).createCell(1);
-        a1.setCellValue(1);
-        Cell a2 = sh.createRow(2).createCell(1);
-        a2.setCellValue(3);
-        Cell a3 = sh.createRow(3).createCell(1);
-        a3.setCellFormula("SUBTOTAL(4,B2:B3)");
+        Cell b2 = sh.createRow(1).createCell(1);
+        b2.setCellValue(1);
+        Cell b3 = sh.createRow(2).createCell(1);
+        b3.setCellValue(3);
+        Cell b4 = sh.createRow(3).createCell(1);
+        b4.setCellFormula("SUBTOTAL(4,B2:B3)");
         Cell a4 = sh.createRow(4).createCell(1);
         a4.setCellValue(1);
         Cell a5 = sh.createRow(5).createCell(1);
@@ -247,7 +247,7 @@ final class TestSubtotal {
 
         fe.evaluateAll();
 
-        assertEquals(3.0, a3.getNumericCellValue(), 0);
+        assertEquals(3.0, b4.getNumericCellValue(), 0);
         assertEquals(16.0, a6.getNumericCellValue(), 0);
         assertEquals(7.0, a7.getNumericCellValue(), 0);
         assertEquals(7.0, a8.getNumericCellValue(), 0);
@@ -262,12 +262,12 @@ final class TestSubtotal {
         FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
         Sheet sh = wb.createSheet();
-        Cell a1 = sh.createRow(1).createCell(1);
-        a1.setCellValue(1);
-        Cell a2 = sh.createRow(2).createCell(1);
-        a2.setCellValue(3);
-        Cell a3 = sh.createRow(3).createCell(1);
-        a3.setCellFormula("SUBTOTAL(5,B2:B3)");
+        Cell b2 = sh.createRow(1).createCell(1);
+        b2.setCellValue(1);
+        Cell b3 = sh.createRow(2).createCell(1);
+        b3.setCellValue(3);
+        Cell b4 = sh.createRow(3).createCell(1);
+        b4.setCellFormula("SUBTOTAL(5,B2:B3)");
         Cell a4 = sh.createRow(4).createCell(1);
         a4.setCellValue(1);
         Cell a5 = sh.createRow(5).createCell(1);
@@ -281,7 +281,7 @@ final class TestSubtotal {
 
         fe.evaluateAll();
 
-        assertEquals(1.0, a3.getNumericCellValue(), 0);
+        assertEquals(1.0, b4.getNumericCellValue(), 0);
         assertEquals(4.0, a6.getNumericCellValue(), 0);
         assertEquals(1.0, a7.getNumericCellValue(), 0);
         assertEquals(1.0, a8.getNumericCellValue(), 0);
@@ -296,12 +296,12 @@ final class TestSubtotal {
         FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
         Sheet sh = wb.createSheet();
-        Cell a1 = sh.createRow(1).createCell(1);
-        a1.setCellValue(1);
-        Cell a2 = sh.createRow(2).createCell(1);
-        a2.setCellValue(3);
-        Cell a3 = sh.createRow(3).createCell(1);
-        a3.setCellFormula("SUBTOTAL(7,B2:B3)");
+        Cell b2 = sh.createRow(1).createCell(1);
+        b2.setCellValue(1);
+        Cell b3 = sh.createRow(2).createCell(1);
+        b3.setCellValue(3);
+        Cell b4 = sh.createRow(3).createCell(1);
+        b4.setCellFormula("SUBTOTAL(7,B2:B3)");
         Cell a4 = sh.createRow(4).createCell(1);
         a4.setCellValue(1);
         Cell a5 = sh.createRow(5).createCell(1);
@@ -315,7 +315,7 @@ final class TestSubtotal {
 
         fe.evaluateAll();
 
-        assertEquals(1.41421, a3.getNumericCellValue(), 0.00001);
+        assertEquals(1.41421, b4.getNumericCellValue(), 0.00001);
         assertEquals(7.65685, a6.getNumericCellValue(), 0.00001);
         assertEquals(2.82842, a7.getNumericCellValue(), 0.00001);
         assertEquals(2.82842, a8.getNumericCellValue(), 0.00001);
@@ -329,12 +329,12 @@ final class TestSubtotal {
             FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
             Sheet sh = wb.createSheet();
-            Cell a1 = sh.createRow(1).createCell(1);
-            a1.setCellValue(1);
-            Cell a2 = sh.createRow(2).createCell(1);
-            a2.setCellValue(3);
-            Cell a3 = sh.createRow(3).createCell(1);
-            a3.setCellFormula("SUBTOTAL(8,B2:B3)");
+            Cell b2 = sh.createRow(1).createCell(1);
+            b2.setCellValue(1);
+            Cell b3 = sh.createRow(2).createCell(1);
+            b3.setCellValue(3);
+            Cell b4 = sh.createRow(3).createCell(1);
+            b4.setCellFormula("SUBTOTAL(8,B2:B3)");
             Cell a4 = sh.createRow(4).createCell(1);
             a4.setCellValue(1);
             Cell a5 = sh.createRow(5).createCell(1);
@@ -348,7 +348,7 @@ final class TestSubtotal {
 
             fe.evaluateAll();
 
-            assertEquals(1.0, a3.getNumericCellValue(), 0.00001);
+            assertEquals(1.0, b4.getNumericCellValue(), 0.00001);
             assertEquals(6.898979, a6.getNumericCellValue(), 0.00001);
             assertEquals(2.44949, a7.getNumericCellValue(), 0.00001);
             assertEquals(2.44949, a8.getNumericCellValue(), 0.00001);
@@ -362,12 +362,12 @@ final class TestSubtotal {
             FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
             Sheet sh = wb.createSheet();
-            Cell a1 = sh.createRow(1).createCell(1);
-            a1.setCellValue(1);
-            Cell a2 = sh.createRow(2).createCell(1);
-            a2.setCellValue(3);
-            Cell a3 = sh.createRow(3).createCell(1);
-            a3.setCellFormula("SUBTOTAL(10,B2:B3)");
+            Cell b2 = sh.createRow(1).createCell(1);
+            b2.setCellValue(1);
+            Cell b3 = sh.createRow(2).createCell(1);
+            b3.setCellValue(3);
+            Cell b4 = sh.createRow(3).createCell(1);
+            b4.setCellFormula("SUBTOTAL(10,B2:B3)");
             Cell a4 = sh.createRow(4).createCell(1);
             a4.setCellValue(1);
             Cell a5 = sh.createRow(5).createCell(1);
@@ -381,7 +381,7 @@ final class TestSubtotal {
 
             fe.evaluateAll();
 
-            assertEquals(2.0, a3.getNumericCellValue());
+            assertEquals(2.0, b4.getNumericCellValue());
             assertEquals(18.0, a6.getNumericCellValue());
             assertEquals(8.0, a7.getNumericCellValue());
             assertEquals(8.0, a8.getNumericCellValue());
@@ -395,29 +395,29 @@ final class TestSubtotal {
             FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
             Sheet sh = wb.createSheet();
-            Cell a1 = sh.createRow(1).createCell(1);
-            a1.setCellValue(1);
-            Cell a2 = sh.createRow(2).createCell(1);
-            a2.setCellValue(3);
-            Cell a3 = sh.createRow(3).createCell(1);
-            a3.setCellFormula("SUBTOTAL(11,B2:B3)");
-            Cell a4 = sh.createRow(4).createCell(1);
-            a4.setCellValue(1);
-            Cell a5 = sh.createRow(5).createCell(1);
-            a5.setCellValue(7);
-            Cell a6 = sh.createRow(6).createCell(1);
-            a6.setCellFormula("SUBTOTAL(11,B2:B6)*2 + 2");
-            Cell a7 = sh.createRow(7).createCell(1);
-            a7.setCellFormula("SUBTOTAL(11,B2:B7)");
-            Cell a8 = sh.createRow(8).createCell(1);
-            a8.setCellFormula("SUBTOTAL(11,B2,B3,B4,B5,B6,B7,B8)");
+            Cell b2 = sh.createRow(1).createCell(1);
+            b2.setCellValue(1);
+            Cell b3 = sh.createRow(2).createCell(1);
+            b3.setCellValue(3);
+            Cell b4 = sh.createRow(3).createCell(1);
+            b4.setCellFormula("SUBTOTAL(11,B2:B3)");
+            Cell b5 = sh.createRow(4).createCell(1);
+            b5.setCellValue(1);
+            Cell b6 = sh.createRow(5).createCell(1);
+            b6.setCellValue(7);
+            Cell b7 = sh.createRow(6).createCell(1);
+            b7.setCellFormula("SUBTOTAL(11,B2:B6)*2 + 2");
+            Cell b8 = sh.createRow(7).createCell(1);
+            b8.setCellFormula("SUBTOTAL(11,B2:B7)");
+            Cell b9 = sh.createRow(8).createCell(1);
+            b9.setCellFormula("SUBTOTAL(11,B2,B3,B4,B5,B6,B7,B8)");
 
             fe.evaluateAll();
 
-            assertEquals(1.0, a3.getNumericCellValue());
-            assertEquals(14.0, a6.getNumericCellValue());
-            assertEquals(6.0, a7.getNumericCellValue());
-            assertEquals(6.0, a8.getNumericCellValue());
+            assertEquals(1.0, b4.getNumericCellValue());
+            assertEquals(14.0, b7.getNumericCellValue());
+            assertEquals(6.0, b8.getNumericCellValue());
+            assertEquals(6.0, b9.getNumericCellValue());
         }
     }
 
@@ -425,17 +425,17 @@ final class TestSubtotal {
     void test50209() throws IOException {
         Workbook wb = new HSSFWorkbook();
         Sheet sh = wb.createSheet();
-        Cell a1 = sh.createRow(1).createCell(1);
-        a1.setCellValue(1);
-        Cell a2 = sh.createRow(2).createCell(1);
-        a2.setCellFormula("SUBTOTAL(9,B2)");
-        Cell a3 = sh.createRow(3).createCell(1);
-        a3.setCellFormula("SUBTOTAL(9,B2:B3)");
+        Cell b2 = sh.createRow(1).createCell(1);
+        b2.setCellValue(1);
+        Cell b3 = sh.createRow(2).createCell(1);
+        b3.setCellFormula("SUBTOTAL(9,B2)");
+        Cell b4 = sh.createRow(3).createCell(1);
+        b4.setCellFormula("SUBTOTAL(9,B2:B3)");
 
         FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
         fe.evaluateAll();
-        assertEquals(1.0, a2.getNumericCellValue(), 0);
-        assertEquals(1.0, a3.getNumericCellValue(), 0);
+        assertEquals(1.0, b3.getNumericCellValue(), 0);
+        assertEquals(1.0, b4.getNumericCellValue(), 0);
         wb.close();
     }
 
@@ -494,7 +494,7 @@ final class TestSubtotal {
         FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
 
         Sheet sh = wb.createSheet();
-        Cell a3 = sh.createRow(3).createCell(1);
+        Cell b4 = sh.createRow(3).createCell(1);
 
         // formula, throws NotImplemnted?
         String[][] formulas = {
@@ -506,9 +506,9 @@ final class TestSubtotal {
         for (String[] f : formulas) {
             Exception actualEx = null;
             try {
-                a3.setCellFormula(f[0]);
+                b4.setCellFormula(f[0]);
                 fe.evaluateAll();
-                assertEquals(FormulaError.VALUE.getCode(), a3.getErrorCellValue(), f[0]);
+                assertEquals(FormulaError.VALUE.getCode(), b4.getErrorCellValue(), f[0]);
             } catch (Exception e) {
                 actualEx = e;
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org