diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-12-06 10:10:16 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-12-06 10:10:16 +0000 |
commit | 50bab16ecede7454892a9f086cfa59fd83506fac (patch) | |
tree | 1ad659cae299a2322145bc028eb1df2f74c8cc9b | |
parent | 80d4b8bd32d55156f52a3b8e50dffc073f6e8aa5 (diff) | |
download | poi-50bab16ecede7454892a9f086cfa59fd83506fac.tar.gz poi-50bab16ecede7454892a9f086cfa59fd83506fac.zip |
add xlookup test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895613 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFXLookupFunction.java (renamed from poi-ooxml/src/test/java/org/apache/poi/xssf/TestXLookupFunction.java) | 16 | ||||
-rw-r--r-- | test-data/spreadsheet/xlookup.xlsx | bin | 0 -> 12031 bytes |
2 files changed, 15 insertions, 1 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXLookupFunction.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFXLookupFunction.java index 16122cfffc..dbe7c956fc 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXLookupFunction.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFXLookupFunction.java @@ -31,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * Testcase for function XLOOKUP() */ -public class TestXLookupFunction { +public class TestXSSFXLookupFunction { //https://support.microsoft.com/en-us/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929 @@ -52,6 +52,20 @@ public class TestXLookupFunction { } } + @Test + void testXLookupFile() throws Exception { + try (XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("xlookup.xlsx")) { + XSSFSheet sheet = workbook.getSheetAt(0); + XSSFFormulaEvaluator fe = new XSSFFormulaEvaluator(workbook); + XSSFRow row1 = sheet.getRow(1); + assertEquals("Dianne Pugh", row1.getCell(2).getStringCellValue()); + assertEquals("Finance", row1.getCell(3).getStringCellValue()); + fe.evaluateAll(); + row1 = sheet.getRow(1); + assertEquals("Dianne Pugh", row1.getCell(2).getStringCellValue()); + assertEquals("Finance", row1.getCell(3).getStringCellValue()); + } + } private XSSFWorkbook initWorkbook2() { XSSFWorkbook wb = new XSSFWorkbook(); diff --git a/test-data/spreadsheet/xlookup.xlsx b/test-data/spreadsheet/xlookup.xlsx Binary files differnew file mode 100644 index 0000000000..58b6ae9bc8 --- /dev/null +++ b/test-data/spreadsheet/xlookup.xlsx |