diff options
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java index 3696bb940e..4c156e7b6f 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java @@ -17,6 +17,7 @@ package org.apache.poi.hssf.usermodel; +import junit.framework.AssertionFailedError; import junit.framework.TestCase; import org.apache.poi.hssf.HSSFTestDataSamples; @@ -39,7 +40,24 @@ public final class TestHSSFWorkbook extends TestCase { NameRecord nameRecord = b.getWorkbook().getNameRecord( 0 ); assertEquals( 3, nameRecord.getIndexToSheet() ); } - + + public void testCaseInsensitiveNames() { + HSSFWorkbook b = new HSSFWorkbook( ); + HSSFSheet originalSheet = b.createSheet("Sheet1"); + HSSFSheet fetchedSheet = b.getSheet("sheet1"); + if(fetchedSheet == null) { + throw new AssertionFailedError("Identified bug 44892"); + } + assertEquals(originalSheet, fetchedSheet); + try { + b.createSheet("sHeeT1"); + fail("should have thrown exceptiuon due to duplicate sheet name"); + } catch (IllegalArgumentException e) { + // expected during successful test + assertEquals("The workbook already contains a sheet of this name", e.getMessage()); + } + } + public void testDuplicateNames() { HSSFWorkbook b = new HSSFWorkbook( ); b.createSheet("Sheet1"); |