]> source.dussan.org Git - poi.git/commitdiff
fix tests
authorPJ Fanning <fanningpj@apache.org>
Wed, 29 Dec 2021 22:00:43 +0000 (22:00 +0000)
committerPJ Fanning <fanningpj@apache.org>
Wed, 29 Dec 2021 22:00:43 +0000 (22:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896513 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/test/java/org/apache/poi/ss/tests/formula/functions/TestVlookup.java
poi/src/main/java/org/apache/poi/ss/formula/OperatorEnum.java
poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java

index 753e2046d259e00344926c68b16b215b3ba81a3c..15d0dedd90f721bf59c83b431de41e89fd58646e 100644 (file)
@@ -80,8 +80,8 @@ class TestVlookup {
             Cell cell = row.createCell(0);
             cell.setCellFormula("vlookup(A2,B1:B5,2,false)");
 
-            CreationHelper crateHelper = wb.getCreationHelper();
-            FormulaEvaluator eval = crateHelper.createFormulaEvaluator();
+            CreationHelper createHelper = wb.getCreationHelper();
+            FormulaEvaluator eval = createHelper.createFormulaEvaluator();
             CellValue value = eval.evaluate(cell);
 
             assertFalse(value.getBooleanValue());
@@ -97,8 +97,8 @@ class TestVlookup {
             Cell cell = row.createCell(0);
             cell.setCellFormula("vlookup(A2,B1:B5,2,)");
 
-            CreationHelper crateHelper = wb.getCreationHelper();
-            FormulaEvaluator eval = crateHelper.createFormulaEvaluator();
+            CreationHelper createHelper = wb.getCreationHelper();
+            FormulaEvaluator eval = createHelper.createFormulaEvaluator();
             CellValue value = eval.evaluate(cell);
 
             assertFalse(value.getBooleanValue());
@@ -114,8 +114,8 @@ class TestVlookup {
             Cell cell = row.createCell(0);
             cell.setCellFormula("vlookup(A2,B1:B5,,)");
 
-            CreationHelper crateHelper = wb.getCreationHelper();
-            FormulaEvaluator eval = crateHelper.createFormulaEvaluator();
+            CreationHelper createHelper = wb.getCreationHelper();
+            FormulaEvaluator eval = createHelper.createFormulaEvaluator();
             CellValue value = eval.evaluate(cell);
 
             assertFalse(value.getBooleanValue());
@@ -131,8 +131,8 @@ class TestVlookup {
             Cell cell = row.createCell(0);
             cell.setCellFormula("vlookup(A2,,,)");
 
-            CreationHelper crateHelper = wb.getCreationHelper();
-            FormulaEvaluator eval = crateHelper.createFormulaEvaluator();
+            CreationHelper createHelper = wb.getCreationHelper();
+            FormulaEvaluator eval = createHelper.createFormulaEvaluator();
             CellValue value = eval.evaluate(cell);
 
             assertFalse(value.getBooleanValue());
index 3eeea4eebe77de37f1a8ad76981cbe9e46be3ee2..a68d662e0e5a111d11f3f6c6ea3099978b4d9ed2 100644 (file)
@@ -131,8 +131,7 @@ enum OperatorEnum {
         if (v1 == null) {
             return true; // non-null not equal null, returns true
         }
-        // need to avoid instanceof, to work around a 1.6 compiler bug
-        if (cellValue.getClass() == String.class) {
+        if (cellValue instanceof String) {
             return cellValue.toString().compareToIgnoreCase(v1.toString()) == 0;
         }
         return cellValue.compareTo(v1) != 0;
index fa21d33531c96dd4f916a146040d401ca14141d0..648250beca75f14d28b2e646cb2c37056c75559a 100644 (file)
@@ -123,9 +123,8 @@ public final class LookupUtils {
 
                 @Override
                 public Integer next() {
-                    pos++;
-                    if (pos > getSize()) throw new NoSuchElementException();
-                    return pos;
+                    if (!hasNext()) throw new NoSuchElementException();
+                    return pos++;
                 }
             };
         }