You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2019/12/27 23:00:20 UTC
svn commit: r1872041 [1/23] - in /poi/trunk/src:
excelant/testcases/org/apache/poi/ss/examples/formula/
excelant/testcases/org/apache/poi/ss/excelant/
excelant/testcases/org/apache/poi/ss/excelant/util/
java/org/apache/poi/hssf/record/aggregates/ java/...
Author: kiwiwings
Date: Fri Dec 27 23:00:13 2019
New Revision: 1872041
URL: http://svn.apache.org/viewvc?rev=1872041&view=rev
Log:
Migrate all junit tests to Junit 4
get rid of references to junit.framework
don't throw AssertionFailedErrors, but use Assert.fail instead
add try-with-resources where it was missing
Added:
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java
- copied, changed from r1872040, poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java
Removed:
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/extensions/TestXSSFSheetComments.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/RecordInspector.java
Modified:
poi/trunk/src/excelant/testcases/org/apache/poi/ss/examples/formula/TestExcelAntUserDefinedFunction.java
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntPrecision.java
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSet.java
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java
poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
poi/trunk/src/ooxml/testcases/org/apache/poi/TestEmbedded.java
poi/trunk/src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java
poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestListParts.java
poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackagePartName.java
poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageThumbnail.java
poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackagingURIHelper.java
poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestRelationships.java
poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/ZipFileAssert.java
poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCComplianceCoreProperties.java
poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestProper.java
poi/trunk/src/ooxml/testcases/org/apache/poi/util/TestIdentifierManager.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFDataSourcesFactory.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/eventusermodel/TestReadOnlySharedStringsTable.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractor.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractorUsingFactory.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/io/TestLoadSaveXSSF.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestCalculationChain.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestSharedStringsTable.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/AllXSSFUsermodelTests.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/BaseTestXSSFPivotTable.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestMatrixFormulasFromXMLSpreadsheet.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFChart.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRichTextString.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheetRowGrouping.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheetUpdateArrayFormulas.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFCategoryAxis.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFChartAxis.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFDateAxis.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFValueAxis.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/extensions/TestXSSFBorder.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestHeaderFooterHelper.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/util/MemoryUsage.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/util/TestCTColComparator.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/util/TestNumericRanges.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestPackageCorePropertiesGetKeywords.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestExternalEntities.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFEndnotes.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSmartTag.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCString.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestColorSchemeAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExControl.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlinkAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExMediaAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjListAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExVideoContainer.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersContainer.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfo.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestNotesAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlidePersistAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextBytesAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextCharsAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextHeaderAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestUserEditAtom.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestMostRecentRecords.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNotesText.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/Test7BitCodepage.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestBasics.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestBlankFileRead.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestMessageSubmissionChunk.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestMessageSubmissionChunkY2KRead.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestOutlook30FileRead.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestSimpleFileRead.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/datatypes/TestChunkData.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/datatypes/TestMAPIProperty.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/datatypes/TestSorters.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/datatypes/TestTypes.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFPictures.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFRangeParts.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/AbstractWordUtilsTest.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestNumberFormatter.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToTextConverter.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestBookmarksTables.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestCHPBinTable.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestNotesTables.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestPlexOfCps.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestSectionTable.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/model/types/LFOLVLBaseAbstractTypeTest.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/model/types/LVLFAbstractTypeTest.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TestSprms.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBorderCode.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug49820.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug50075.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHeaderStories.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestLists.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestOfficeDrawings.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeInsertion.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeReplacement.java
poi/trunk/src/testcases/org/apache/poi/hssf/eventmodel/TestAbortableListener.java
poi/trunk/src/testcases/org/apache/poi/hssf/eventmodel/TestEventRecordFactory.java
poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestEventWorkbookBuilder.java
poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java
poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
poi/trunk/src/testcases/org/apache/poi/hssf/model/TestEscherRecordFactory.java
poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParserEval.java
poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParserIf.java
poi/trunk/src/testcases/org/apache/poi/hssf/model/TestHSSFAnchor.java
poi/trunk/src/testcases/org/apache/poi/hssf/model/TestLinkTable.java
poi/trunk/src/testcases/org/apache/poi/hssf/model/TestOperandClassTransformer.java
poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheet.java
poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheetAdditional.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestArrayRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestAutoFilterInfoRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestBoolErrRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestBoundSheetRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestCFHeaderRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestCommonObjectDataSubRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDConRefRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDrawingGroupRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestEmbeddedObjectRefSubRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestEndSubRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestEscherAggregate.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExtSSTRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExtendedFormatRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestFeatRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestFontRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestFtCblsSubRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestInterfaceEndRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestLabelRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestLbsDataSubRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestMergeCellsRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestNameCommentRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestPLVRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestPaneRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestRecalcIdRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestRecordInputStream.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSCLRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTRecordSizeCalculator.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSharedFormulaRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestStyleRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSubRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSupBookRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestTableRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestTextObjectBaseRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestUnicodeNameRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestWriteAccessRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestcaseRecordInputStream.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestCFRecordsAggregate.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestFormulaRecordAggregate.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestRowRecordsAggregate.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestSharedValueManager.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/cf/TestCellRange.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestAreaFormatRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestAreaRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestAxisLineFormatRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestAxisOptionsRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestAxisParentRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestAxisRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestAxisUsedRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestBarRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestCategorySeriesAxisRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestChartFormatRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestChartRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestDatRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestDataFormatRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestDefaultDataLabelTextPropertiesRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestFontBasisRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestFontIndexRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestFrameRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestLegendRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestLineFormatRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestLinkedDataRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestNumberFormatIndexRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestObjectLinkRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestPlotAreaRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestPlotGrowthRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesChartGroupIndexRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesIndexRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesLabelsRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesListRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesTextRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesToChartGroupRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestSheetPropertiesRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestTextRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestTickRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestUnitsRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestValueRangeRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/pivot/AllPivotRecordTests.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/pivot/TestExtendedPivotTableViewFieldsRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/pivot/TestPageItemRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/pivot/TestViewFieldsRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEmbeddedObjects.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestExternalReferenceChange.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorDocs.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFClientAnchor.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFHeaderFooter.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPatriarch.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPictureData.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheetUpdateArrayFormulas.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFTextbox.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestMatrixFormulasFromBinarySpreadsheet.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestPatriarch.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestRowStyle.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestUnicodeWorkbook.java
poi/trunk/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java
poi/trunk/src/testcases/org/apache/poi/hssf/util/TestRKUtil.java
poi/trunk/src/testcases/org/apache/poi/poifs/crypt/TestBiff8DecryptingStream.java
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestDirectoryNode.java
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestDocumentDescriptor.java
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNotOLE2Exception.java
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOfficeXMLException.java
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSDocumentPath.java
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSStream.java
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPropertySorter.java
poi/trunk/src/testcases/org/apache/poi/poifs/nio/TestDataSource.java
poi/trunk/src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java
poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockReading.java
poi/trunk/src/testcases/org/apache/poi/ss/TestSpreadsheetVersion.java
poi/trunk/src/testcases/org/apache/poi/ss/format/TestCellFormatCondition.java
poi/trunk/src/testcases/org/apache/poi/ss/format/TestCellFormatResult.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/TestCellCacheEntry.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/TestEvaluationCache.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/TestFunctionRegistry.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/TestPlainCellCache.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestIfError.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestMRound.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestPercentile.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestRandBetween.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/BaseTestCircularReferences.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestAreaEval.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestDivideEval.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestEqualEval.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestExternalFunction.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestMinusZeroResult.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestMissingArgEval.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestMultiSheetEval.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestOperandResolver.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestPercentEval.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestPowerEval.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestRangeEval.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestUnaryPlusEval.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/function/TestFunctionMetadataRegistry.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/function/TestParseMissingBuiltInFuncs.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/NumericFunctionInvoker.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestCalendarFieldFunction.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDate.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestIndex.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestIrr.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestMirr.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestNpv.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestStatsLib.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestSumif.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestSumifs.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestArea3DPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaErrPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestArrayPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestErrPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestExternalNameReference.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestFuncPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestFuncVarPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestIntersectionPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestPercentPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestRangePtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestRef3DPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestReferencePtg.java
poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestUnionPtg.java
poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java
poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java
poi/trunk/src/testcases/org/apache/poi/ss/usermodel/charts/TestDataSources.java
poi/trunk/src/testcases/org/apache/poi/ss/util/TestExpandedDouble.java
poi/trunk/src/testcases/org/apache/poi/ss/util/TestNumberComparer.java
poi/trunk/src/testcases/org/apache/poi/ss/util/TestNumberToTextConverter.java
poi/trunk/src/testcases/org/apache/poi/ss/util/TestSheetBuilder.java
poi/trunk/src/testcases/org/apache/poi/ss/util/TestWorkbookUtil.java
poi/trunk/src/testcases/org/apache/poi/ss/util/cellwalk/TestCellWalk.java
poi/trunk/src/testcases/org/apache/poi/util/TestArrayUtil.java
poi/trunk/src/testcases/org/apache/poi/util/TestBitField.java
poi/trunk/src/testcases/org/apache/poi/util/TestByteField.java
poi/trunk/src/testcases/org/apache/poi/util/TestIntegerField.java
poi/trunk/src/testcases/org/apache/poi/util/TestLittleEndianStreams.java
poi/trunk/src/testcases/org/apache/poi/util/TestLongField.java
poi/trunk/src/testcases/org/apache/poi/util/TestPOILogFactory.java
poi/trunk/src/testcases/org/apache/poi/util/TestShortField.java
Modified: poi/trunk/src/excelant/testcases/org/apache/poi/ss/examples/formula/TestExcelAntUserDefinedFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/examples/formula/TestExcelAntUserDefinedFunction.java?rev=1872041&r1=1872040&r2=1872041&view=diff
==============================================================================
--- poi/trunk/src/excelant/testcases/org/apache/poi/ss/examples/formula/TestExcelAntUserDefinedFunction.java (original)
+++ poi/trunk/src/excelant/testcases/org/apache/poi/ss/examples/formula/TestExcelAntUserDefinedFunction.java Fri Dec 27 23:00:13 2019
@@ -16,36 +16,42 @@
==================================================================== */
package org.apache.poi.ss.examples.formula;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestExcelAntUserDefinedFunction {
-public class TestExcelAntUserDefinedFunction extends TestCase {
-
private ExcelAntUserDefinedFunctionTestHelper fixture ;
-
- @Override
+
+ @Before
public void setUp() {
fixture = new ExcelAntUserDefinedFunctionTestHelper() ;
}
-
+
+ @Test
public void testSetClassName() {
String className = "simple.class.name" ;
-
+
fixture.setClassName( className ) ;
String value = fixture.getClassName() ;
-
+
assertNotNull( value ) ;
assertEquals( className, value ) ;
}
-
+
+ @Test
public void testSetFunction() {
String functionAlias = "alias" ;
-
+
fixture.setFunctionAlias( functionAlias ) ;
-
+
String alias = fixture.getFunctionAlias() ;
-
+
assertNotNull( alias ) ;
assertEquals( functionAlias, alias ) ;
}
-
+
}
Copied: poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java (from r1872040, poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java?p2=poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java&p1=poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java&r1=1872040&r2=1872041&rev=1872041&view=diff
==============================================================================
--- poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/BuildFileTest.java (original)
+++ poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java Fri Dec 27 23:00:13 2019
@@ -20,12 +20,12 @@ package org.apache.poi.ss.excelant;
import static org.apache.poi.POITestCase.assertContains;
import static org.apache.poi.POITestCase.assertNotContained;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.PrintStream;
-import java.net.URL;
-
-import junit.framework.TestCase;
import org.apache.poi.POIDataSamples;
import org.apache.tools.ant.BuildEvent;
@@ -33,41 +33,38 @@ import org.apache.tools.ant.BuildExcepti
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
- * A BuildFileTest is a TestCase which executes targets from an Ant buildfile
- * for testing.
- * <p>
- * This class provides a number of utility methods for particular build file
- * tests which extend this class.
- *
- * @see <a href="http://svn.apache.org/repos/asf/ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java">
- * http://svn.apache.org/repos/asf/ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java</a>
+ * JUnit test for the ExcelAnt tasks.
+ * Leverages Ant's test framework.
*/
-public abstract class BuildFileTest extends TestCase {
+public class TestBuildFile {
protected Project project;
private StringBuilder logBuffer;
private StringBuilder fullLogBuffer;
- private StringBuilder outBuffer;
- private StringBuilder errBuffer;
private BuildException buildException;
- /**
- * Default constructor for the BuildFileTest object.
- */
- public BuildFileTest() {
- super();
- }
- /**
- * Constructor for the BuildFileTest object.
- *
- * @param name string to pass up to TestCase constructor
- */
- public BuildFileTest(String name) {
- super(name);
+ @Before
+ public void setUp() {
+ String filename = TestBuildFile.getDataDir() + "/../src/excelant/testcases/org/apache/poi/ss/excelant/tests.xml";
+ int logLevel = Project.MSG_DEBUG;
+
+ logBuffer = new StringBuilder();
+ fullLogBuffer = new StringBuilder();
+ project = new Project();
+ project.init();
+ project.setNewProperty("data.dir.name", getDataDir());
+ File antFile = new File(System.getProperty("root"), filename);
+ project.setUserProperty("ant.file", antFile.getAbsolutePath());
+ project.addBuildListener(new AntTestListener(logLevel));
+ ProjectHelper.configureProject(project, antFile);
+
}
/**
@@ -79,8 +76,8 @@ public abstract class BuildFileTest exte
* is automatically called, since it's trivial to have a
* test target depend on it.
*/
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() {
if (project == null) {
/*
* Maybe the BuildFileTest was subclassed and there is
@@ -109,16 +106,6 @@ public abstract class BuildFileTest exte
}
/**
- * Assert that only the given message has been logged with a
- * priority <= INFO when running the given target.
- */
- public void expectLog(String target, String log) {
- executeTarget(target);
- String realLog = getLog();
- assertEquals(log, realLog);
- }
-
- /**
* Assert that the given substring is in the log messages.
*/
public void assertLogContaining(String substring) {
@@ -133,181 +120,19 @@ public abstract class BuildFileTest exte
}
/**
- * Assert that the given substring is in the output messages.
- *
- * @since Ant1.7
- */
- public void assertOutputContaining(String substring) {
- assertOutputContaining(null, substring);
- }
-
- /**
- * Assert that the given substring is in the output messages.
- *
- * @param message Print this message if the test fails. Defaults to
- * a meaningful text if <tt>null</tt> is passed.
- * @since Ant1.7
- */
- public void assertOutputContaining(String message, String substring) {
- assertContains("output: " + message, getOutput(), substring);
- }
-
- /**
- * Assert that the given substring is not in the output messages.
- *
- * @param message Print this message if the test fails. Defaults to
- * a meaningful text if <tt>null</tt> is passed.
- * @since Ant1.7
- */
- public void assertOutputNotContaining(String message, String substring) {
- assertNotContained(getOutput(), substring);
- }
-
- /**
- * Assert that the given message has been logged with a priority <= INFO when running the
- * given target.
- */
- public void expectLogContaining(String target, String log) {
- executeTarget(target);
- assertLogContaining(log);
- }
-
- /**
- * Assert that the given message has not been logged with a
- * priority <= INFO when running the given target.
- */
- public void expectLogNotContaining(String target, String log) {
- executeTarget(target);
- assertLogNotContaining(log);
- }
-
- /**
* Gets the log the BuildFileTest object.
* Only valid if configureProject() has been called.
*
* @return The log value
- * @pre logBuffer!=null
*/
public String getLog() {
return logBuffer.toString();
}
/**
- * Assert that the given message has been logged with a priority
- * >= VERBOSE when running the given target.
- */
- public void expectDebuglog(String target, String log) {
- executeTarget(target);
- String realLog = getFullLog();
- assertEquals(log, realLog);
- }
-
- /**
- * Assert that the given substring is in the log messages.
- */
- public void assertDebuglogContaining(String substring) {
- String realLog = getFullLog();
- assertContains("expecting debug log to contain \"" + substring
- + "\" log was \""
- + realLog + "\"",
- realLog, substring);
- }
-
- /**
- * Gets the log the BuildFileTest object.
- * <p>
- * Only valid if configureProject() has been called.
- *
- * @return The log value
- * @pre fullLogBuffer!=null
- */
- public String getFullLog() {
- return fullLogBuffer.toString();
- }
-
- /**
- * execute the target, verify output matches expectations
- *
- * @param target target to execute
- * @param output output to look for
- */
- public void expectOutput(String target, String output) {
- executeTarget(target);
- String realOutput = getOutput();
- assertEquals(output, realOutput.trim());
- }
-
- /**
- * Executes the target, verify output matches expectations
- * and that we got the named error at the end
- *
- * @param target target to execute
- * @param output output to look for
- * @param error Description of Parameter
- */
- public void expectOutputAndError(String target, String output, String error) {
- executeTarget(target);
- String realOutput = getOutput();
- assertEquals(output, realOutput);
- String realError = getError();
- assertEquals(error, realError);
- }
-
- public String getOutput() {
- return cleanBuffer(outBuffer);
- }
-
- public String getError() {
- return cleanBuffer(errBuffer);
- }
-
- public BuildException getBuildException() {
- return buildException;
- }
-
- private String cleanBuffer(StringBuilder buffer) {
- StringBuilder cleanedBuffer = new StringBuilder();
- for (int i = 0; i < buffer.length(); i++) {
- char ch = buffer.charAt(i);
- if (ch != '\r') {
- cleanedBuffer.append(ch);
- }
- }
- return cleanedBuffer.toString();
- }
-
- /**
- * Sets up to run the named project
- *
- * @param filename name of project file to run
- */
- public void configureProject(String filename) throws BuildException {
- configureProject(filename, Project.MSG_DEBUG);
- }
-
- /**
- * Sets up to run the named project
- *
- * @param filename name of project file to run
- */
- public void configureProject(String filename, int logLevel)
- throws BuildException {
- logBuffer = new StringBuilder();
- fullLogBuffer = new StringBuilder();
- project = new Project();
- project.init();
- project.setNewProperty("data.dir.name", getDataDir());
- File antFile = new File(System.getProperty("root"), filename);
- project.setUserProperty("ant.file", antFile.getAbsolutePath());
- project.addBuildListener(new AntTestListener(logLevel));
- ProjectHelper.configureProject(project, antFile);
- }
-
- /**
* Executes a target we have set up
*
* @param targetName target to run
- * @pre configureProject has been called
*/
public void executeTarget(String targetName) {
PrintStream sysOut = System.out;
@@ -315,10 +140,10 @@ public abstract class BuildFileTest exte
try {
sysOut.flush();
sysErr.flush();
- outBuffer = new StringBuilder();
+ StringBuilder outBuffer = new StringBuilder();
PrintStream out = new PrintStream(new AntOutputStream(outBuffer));
System.setOut(out);
- errBuffer = new StringBuilder();
+ StringBuilder errBuffer = new StringBuilder();
PrintStream err = new PrintStream(new AntOutputStream(errBuffer));
System.setErr(err);
logBuffer = new StringBuilder();
@@ -333,24 +158,6 @@ public abstract class BuildFileTest exte
}
/**
- * Get the project which has been configured for a test.
- *
- * @return the Project instance for this test.
- */
- public Project getProject() {
- return project;
- }
-
- /**
- * Gets the directory of the project.
- *
- * @return the base dir of the project
- */
- public File getProjectDir() {
- return project.getBaseDir();
- }
-
- /**
* Runs a target, wait for a build exception.
*
* @param target target to run
@@ -373,107 +180,6 @@ public abstract class BuildFileTest exte
fail("Should throw BuildException because: " + cause);
}
- /**
- * run a target, expect an exception string
- * containing the substring we look for (case sensitive match)
- *
- * @param target target to run
- * @param cause information string to reader of report
- * @param contains substring of the build exception to look for
- */
- public void expectBuildExceptionContaining(String target, String cause, String contains) {
- try {
- executeTarget(target);
- } catch (org.apache.tools.ant.BuildException ex) {
- buildException = ex;
- if ((null != contains) && (!ex.getMessage().contains(contains))) {
- fail("Should throw BuildException because '" + cause + "' with message containing '" + contains + "' (actual message '" + ex.getMessage() + "' instead)");
- }
- return;
- }
- fail("Should throw BuildException because: " + cause);
- }
-
- /**
- * call a target, verify property is as expected
- *
- * @param target build file target
- * @param property property name
- * @param value expected value
- */
- public void expectPropertySet(String target, String property, String value) {
- executeTarget(target);
- assertPropertyEquals(property, value);
- }
-
- /**
- * assert that a property equals a value; comparison is case sensitive.
- *
- * @param property property name
- * @param value expected value
- */
- public void assertPropertyEquals(String property, String value) {
- String result = project.getProperty(property);
- assertEquals("property " + property, value, result);
- }
-
- /**
- * assert that a property equals "true".
- *
- * @param property property name
- */
- public void assertPropertySet(String property) {
- assertPropertyEquals(property, "true");
- }
-
- /**
- * assert that a property is null.
- *
- * @param property property name
- */
- public void assertPropertyUnset(String property) {
- String result = project.getProperty(property);
- if (result != null) {
- fail("Expected property " + property
- + " to be unset, but it is set to the value: " + result);
- }
- }
-
- /**
- * call a target, verify named property is "true".
- *
- * @param target build file target
- * @param property property name
- */
- public void expectPropertySet(String target, String property) {
- expectPropertySet(target, property, "true");
- }
-
- /**
- * Call a target, verify property is null.
- *
- * @param target build file target
- * @param property property name
- */
- public void expectPropertyUnset(String target, String property) {
- expectPropertySet(target, property, null);
- }
-
- /**
- * Retrieve a resource from the caller classloader to avoid
- * assuming a vm working directory. The resource path must be
- * relative to the package name or absolute from the root path.
- *
- * @param resource the resource to retrieve its url.
- * @throws junit.framework.AssertionFailedError
- * if the resource is not found.
- */
- public URL getResource(String resource) {
- URL url = getClass().getResource(resource);
- assertNotNull("Could not find resource :" + resource, url);
- return url;
- }
-
public static String getDataDir() {
String dataDirName = System.getProperty(POIDataSamples.TEST_PROPERTY);
return dataDirName == null ? "test-data" : dataDirName;
@@ -590,4 +296,103 @@ public abstract class BuildFileTest exte
}
}
+ @Test
+ public void testMissingFilename() {
+ expectSpecificBuildException("test-nofile", "required argument not specified",
+ "fileName attribute must be set!");
+ }
+
+ @Test
+ public void testFileNotFound() {
+ expectSpecificBuildException("test-filenotfound", "required argument not specified",
+ "Cannot load file invalid.xls. Make sure the path and file permissions are correct.");
+ }
+
+ @Test
+ public void testEvaluate() {
+ executeTarget("test-evaluate");
+ assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
+ assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
+ }
+
+ @Test
+ public void testEvaluateNoDetails() {
+ executeTarget("test-evaluate-nodetails");
+ assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
+ assertLogNotContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
+ }
+
+ @Test
+ public void testPrecision() {
+ executeTarget("test-precision");
+
+ assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
+ assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4. " +
+ "It evaluated to 2285.5761494145563 when the value of 2285.576149 with precision of 1.0E-4");
+ assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4. " +
+ "It evaluated to 2285.5761494145563 when the value of 2285.576149 with precision of 1.0E-5");
+ assertLogContaining("Failed to evaluate cell 'MortgageCalculator'!$B$4. " +
+ "It evaluated to 2285.5761494145563 when the value of 2285.576149 with precision of 1.0E-10 was expected.");
+ assertLogContaining("2/3 tests passed");
+ }
+
+ @Test
+ public void testPrecisionFail() {
+ expectSpecificBuildException("test-precision-fails", "precision not matched",
+ "\tFailed to evaluate cell 'MortgageCalculator'!$B$4. It evaluated to 2285.5761494145563 when the value of 2285.576149 with precision of 1.0E-10 was expected.");
+ }
+
+ @Test
+ public void testPassOnError() {
+ executeTarget("test-passonerror");
+ }
+
+ @Test
+ public void testFailOnError() {
+ expectBuildException("test-failonerror", "fail on error");
+ assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
+ assertLogNotContaining("failed because 1 of 0 evaluations failed to evaluate correctly. Failed to evaluate cell 'MortageCalculatorFunction'!$D$3");
+ }
+
+ @Test
+ public void testFailOnErrorNoDetails() {
+ expectBuildException("test-failonerror-nodetails", "fail on error");
+ assertLogNotContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
+ assertLogNotContaining("failed because 1 of 0 evaluations failed to evaluate correctly. Failed to evaluate cell 'MortageCalculatorFunction'!$D$3");
+ }
+
+ @Test
+ public void testUdf() {
+ executeTarget("test-udf");
+ assertLogContaining("1/1 tests passed");
+ }
+
+ @Test
+ public void testSetText() {
+ executeTarget("test-settext");
+ assertLogContaining("1/1 tests passed");
+ }
+
+ @Test
+ public void testAddHandler() {
+ executeTarget("test-addhandler");
+ assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
+ assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
+
+ assertNotNull("The workbook should have been passed to the handler", MockExcelAntWorkbookHandler.workbook);
+ assertTrue("The handler should have been executed", MockExcelAntWorkbookHandler.executed);
+ }
+
+ @Test
+ public void testAddHandlerWrongClass() {
+ executeTarget("test-addhandler-wrongclass");
+ assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
+ assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
+ }
+
+ @Test
+ public void testAddHandlerFails() {
+ expectSpecificBuildException("test-addhandler-fails", "NullPointException", null);
+ }
+
}
Modified: poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntPrecision.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntPrecision.java?rev=1872041&r1=1872040&r2=1872041&view=diff
==============================================================================
--- poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntPrecision.java (original)
+++ poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntPrecision.java Fri Dec 27 23:00:13 2019
@@ -16,32 +16,38 @@
==================================================================== */
package org.apache.poi.ss.excelant;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestExcelAntPrecision {
-public class TestExcelAntPrecision extends TestCase {
-
private ExcelAntPrecision fixture ;
- @Override
+ @Before
public void setUp() {
fixture = new ExcelAntPrecision() ;
}
-
- @Override
+
+ @After
public void tearDown() {
fixture = null ;
}
-
+
+ @Test
public void testVerifyPrecision() {
-
+
double value = 1.0E-1 ;
-
+
fixture.setValue( value ) ;
-
+
double result = fixture.getValue() ;
-
+
assertTrue( result > 0 ) ;
-
+
assertEquals( value, result, 0.0 ) ;
}
Modified: poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSet.java?rev=1872041&r1=1872040&r2=1872041&view=diff
==============================================================================
--- poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSet.java (original)
+++ poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSet.java Fri Dec 27 23:00:13 2019
@@ -16,48 +16,54 @@
==================================================================== */
package org.apache.poi.ss.excelant;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil;
import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtilFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-public class TestExcelAntSet extends TestCase {
+public class TestExcelAntSet {
-
- // This is abstract in nature, so we'll use a
+
+ // This is abstract in nature, so we'll use a
// concrete instance to test the set methods.
private ExcelAntSet fixture ;
-
+
private static final String mortgageCalculatorFileName =
- BuildFileTest.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
-
- @Override
+ TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
+
+ @Before
public void setUp() {
fixture = new ExcelAntSetDoubleCell() ;
}
-
- @Override
+
+ @After
public void tearDown() {
fixture = null ;
}
-
+
+ @Test
public void testSetter() {
String cell = "simpleCellRef!$F$1" ;
-
+
fixture.setCell( cell ) ;
-
+
String cellStr = fixture.getCell() ;
-
+
assertNotNull( cellStr ) ;
assertEquals( cell, cellStr ) ;
}
-
+
+ @Test
public void testSetWorkbookUtil() {
ExcelAntWorkbookUtil util = ExcelAntWorkbookUtilFactory.getInstance(
mortgageCalculatorFileName ) ;
-
+
assertNotNull( util ) ;
-
+
fixture.setWorkbookUtil( util ) ;
}
}
Modified: poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java?rev=1872041&r1=1872040&r2=1872041&view=diff
==============================================================================
--- poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java (original)
+++ poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java Fri Dec 27 23:00:13 2019
@@ -16,51 +16,55 @@
==================================================================== */
package org.apache.poi.ss.excelant;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil;
import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtilFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestExcelAntSetDoubleCell {
-public class TestExcelAntSetDoubleCell extends TestCase {
-
private ExcelAntSetDoubleCell fixture ;
-
+
private ExcelAntWorkbookUtil util ;
private static final String mortgageCalculatorFileName =
- BuildFileTest.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
+ TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
- @Override
+ @Before
public void setUp() {
fixture = new ExcelAntSetDoubleCell() ;
- util = ExcelAntWorkbookUtilFactory.getInstance(
- mortgageCalculatorFileName ) ;
+ util = ExcelAntWorkbookUtilFactory.getInstance(mortgageCalculatorFileName ) ;
fixture.setWorkbookUtil( util ) ;
}
-
- @Override
+
+ @After
public void tearDown() {
fixture = null ;
}
-
+
+ @Test
public void testSetDouble() {
String cellId = "'Sheet3'!$A$1" ;
double testValue = 1.1 ;
-
+
fixture.setCell( cellId ) ;
fixture.setValue( testValue ) ;
-
+
double value = fixture.getCellValue() ;
-
+
assertTrue( value > 0 ) ;
assertEquals( testValue, value, 0.0 ) ;
-
+
fixture.execute() ;
-
+
double setValue = util.getCellAsDouble( cellId ) ;
-
+
assertEquals( setValue, testValue, 0.0 ) ;
}
-
+
}
Modified: poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java?rev=1872041&r1=1872040&r2=1872041&view=diff
==============================================================================
--- poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java (original)
+++ poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java Fri Dec 27 23:00:13 2019
@@ -16,6 +16,13 @@
==================================================================== */
package org.apache.poi.ss.excelant.util;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -23,166 +30,178 @@ import java.util.Date;
import java.util.List;
import org.apache.poi.ss.examples.formula.CalculateMortgageFunction;
-import org.apache.poi.ss.excelant.BuildFileTest;
+import org.apache.poi.ss.excelant.TestBuildFile;
import org.apache.poi.ss.formula.udf.UDFFinder;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.tools.ant.BuildException;
+import org.junit.After;
+import org.junit.Test;
-import junit.framework.TestCase;
+public class TestExcelAntWorkbookUtil {
-public class TestExcelAntWorkbookUtil extends TestCase {
-
private static final String mortgageCalculatorFileName =
- BuildFileTest.getDataDir() + "/spreadsheet/excelant.xls" ;
+ TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls" ;
private ExcelAntWorkbookUtilTestHelper fixture ;
-
-
- @Override
+
+
+ @After
public void tearDown() {
fixture = null ;
}
+ @Test
public void testStringConstructor() {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
+ fixture = new ExcelAntWorkbookUtilTestHelper(mortgageCalculatorFileName);
+
assertNotNull(fixture);
}
+ @Test
public void testLoadNotExistingFile() {
try {
new ExcelAntWorkbookUtilTestHelper("notexistingFile");
fail("Should catch exception here");
} catch (BuildException e) {
- assertTrue(e.getMessage().contains("notexistingFile"));
+ assertTrue(e.getMessage().contains("notexistingFile"));
}
}
-
+
+ @Test
public void testWorkbookConstructor() throws IOException {
File workbookFile = new File(mortgageCalculatorFileName);
FileInputStream fis = new FileInputStream(workbookFile);
Workbook workbook = WorkbookFactory.create(fis);
fixture = new ExcelAntWorkbookUtilTestHelper(workbook);
-
+
assertNotNull(fixture);
}
-
+
+ @Test
public void testAddFunction() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
assertNotNull(fixture);
-
+
fixture.addFunction("h2_ZFactor", new CalculateMortgageFunction());
-
+
UDFFinder functions = fixture.getFunctions();
-
+
assertNotNull(functions);
assertNotNull(functions.findFunction("h2_ZFactor"));
}
+ @Test
public void testAddFunctionClassName() throws Exception {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
assertNotNull(fixture);
-
+
fixture.addFunction("h2_ZFactor", CalculateMortgageFunction.class.getName());
-
+
UDFFinder functions = fixture.getFunctions();
-
+
assertNotNull(functions);
assertNotNull(functions.findFunction("h2_ZFactor"));
}
+ @Test
public void testAddFunctionInvalidClassName() throws Exception {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
assertNotNull(fixture);
-
+
fixture.addFunction("h2_ZFactor", String.class.getName());
-
+
UDFFinder functions = fixture.getFunctions();
-
+
assertNotNull(functions);
assertNull(functions.findFunction("h2_ZFactor"));
}
+ @Test
public void testGetWorkbook() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
-
+
assertNotNull(fixture);
-
+
Workbook workbook = fixture.getWorkbook();
-
+
assertNotNull(workbook);
}
-
+
+ @Test
public void testFileName() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
-
+
assertNotNull(fixture);
String fileName = fixture.getFileName();
-
+
assertNotNull(fileName);
-
+
assertEquals(mortgageCalculatorFileName, fileName);
-
+
}
-
+
+ @Test
public void testGetEvaluator() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
-
+
FormulaEvaluator evaluator = fixture.getEvaluator(
mortgageCalculatorFileName);
-
+
assertNotNull(evaluator);
}
+ @Test
public void testGetEvaluatorWithUDF() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
fixture.addFunction("h2_ZFactor", new CalculateMortgageFunction());
-
+
FormulaEvaluator evaluator = fixture.getEvaluator(
mortgageCalculatorFileName);
-
+
assertNotNull(evaluator);
}
-
+
+ @Test
public void testGetEvaluatorXLSX() {
fixture = new ExcelAntWorkbookUtilTestHelper(
- BuildFileTest.getDataDir() + "/spreadsheet/sample.xlsx");
-
+ TestBuildFile.getDataDir() + "/spreadsheet/sample.xlsx");
+
FormulaEvaluator evaluator = fixture.getEvaluator(
- BuildFileTest.getDataDir() + "/spreadsheet/sample.xlsx");
-
+ TestBuildFile.getDataDir() + "/spreadsheet/sample.xlsx");
+
assertNotNull(evaluator);
}
+ @Test
public void testGetEvaluatorXLSXWithFunction() {
fixture = new ExcelAntWorkbookUtilTestHelper(
- BuildFileTest.getDataDir() + "/spreadsheet/sample.xlsx");
-
+ TestBuildFile.getDataDir() + "/spreadsheet/sample.xlsx");
+
fixture.addFunction("h2_ZFactor", new CalculateMortgageFunction());
-
+
FormulaEvaluator evaluator = fixture.getEvaluator(
- BuildFileTest.getDataDir() + "/spreadsheet/sample.xlsx");
-
+ TestBuildFile.getDataDir() + "/spreadsheet/sample.xlsx");
+
assertNotNull(evaluator);
}
+ @Test
public void testEvaluateCell() {
String cell = "'MortgageCalculator'!B4" ;
double expectedValue = 790.79 ;
@@ -191,8 +210,8 @@ public class TestExcelAntWorkbookUtil ex
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
- ExcelAntEvaluationResult result = fixture.evaluateCell(cell,
- expectedValue,
+ ExcelAntEvaluationResult result = fixture.evaluateCell(cell,
+ expectedValue,
precision);
//System.out.println(result);
@@ -204,7 +223,8 @@ public class TestExcelAntWorkbookUtil ex
assertFalse(result.evaluationCompleteWithError());
assertTrue(result.didTestPass());
}
-
+
+ @Test
public void testEvaluateCellFailedPrecision() {
String cell = "'MortgageCalculator'!B4" ;
double expectedValue = 790.79 ;
@@ -213,8 +233,8 @@ public class TestExcelAntWorkbookUtil ex
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
- ExcelAntEvaluationResult result = fixture.evaluateCell(cell,
- expectedValue,
+ ExcelAntEvaluationResult result = fixture.evaluateCell(cell,
+ expectedValue,
precision);
//System.out.println(result);
@@ -226,7 +246,8 @@ public class TestExcelAntWorkbookUtil ex
assertFalse(result.evaluationCompleteWithError());
assertFalse(result.didTestPass());
}
-
+
+ @Test
public void testEvaluateCellWithError() {
String cell = "'ErrorCell'!A1" ;
double expectedValue = 790.79 ;
@@ -235,8 +256,8 @@ public class TestExcelAntWorkbookUtil ex
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
- ExcelAntEvaluationResult result = fixture.evaluateCell(cell,
- expectedValue,
+ ExcelAntEvaluationResult result = fixture.evaluateCell(cell,
+ expectedValue,
precision);
System.out.println(result);
@@ -248,35 +269,38 @@ public class TestExcelAntWorkbookUtil ex
assertTrue(result.evaluationCompleteWithError());
assertFalse(result.didTestPass());
}
-
+
+ @Test
public void testGetSheets() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
-
+
List<String> sheets = fixture.getSheets();
-
+
assertNotNull(sheets);
- assertEquals(sheets.size(), 3);
+ assertEquals(sheets.size(), 3);
}
-
+
+ @Test
public void testSetString() {
String cell = "'MortgageCalculator'!C14" ;
String cellValue = "testString" ;
-
+
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
-
+
fixture.setStringValue(cell, cellValue);
-
+
String value = fixture.getCellAsString(cell);
-
+
assertNotNull(value);
assertEquals(cellValue, value);
}
-
+
+ @Test
public void testSetNotExistingSheet() {
String cell = "'NotexistingSheet'!C14" ;
-
+
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
try {
@@ -287,68 +311,72 @@ public class TestExcelAntWorkbookUtil ex
}
}
+ @Test
public void testSetFormula() {
String cell = "'MortgageCalculator'!C14" ;
String cellValue = "SUM(B14:B18)" ;
-
+
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
-
+
fixture.setFormulaValue(cell, cellValue);
-
+
double value = fixture.getCellAsDouble(cell);
-
- assertEquals(0.0, value);
+
+ assertEquals(0.0, value, 0);
}
-
+
+ @Test
public void testSetDoubleValue() {
String cell = "'MortgageCalculator'!C14" ;
double cellValue = 1.2;
-
+
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
-
+
fixture.setDoubleValue(cell, cellValue);
-
- Double value = fixture.getCellAsDouble(cell);
-
- assertNotNull(value);
- assertEquals(cellValue, value);
+
+ double value = fixture.getCellAsDouble(cell);
+
+ assertEquals(cellValue, value, 0);
}
-
+
+ @Test
public void testSetDate() {
String cell = "'MortgageCalculator'!C14" ;
Date cellValue = new Date();
-
+
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
-
+
fixture.setDateValue(cell, cellValue);
-
+
double value = fixture.getCellAsDouble(cell);
-
- assertEquals(DateUtil.getExcelDate(cellValue, false), value);
+
+ assertEquals(DateUtil.getExcelDate(cellValue, false), value, 0);
}
+ @Test
public void testGetNonexistingString() {
String cell = "'MortgageCalculator'!C33" ;
-
+
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
-
+
String value = fixture.getCellAsString(cell);
-
+
assertEquals("", value);
}
+ @Test
public void testGetNonexistingDouble() {
String cell = "'MortgageCalculator'!C33" ;
-
+
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
-
+
double value = fixture.getCellAsDouble(cell);
-
- assertEquals(0.0, value);
+
+ assertEquals(0.0, value, 0);
}
}
Modified: poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java?rev=1872041&r1=1872040&r2=1872041&view=diff
==============================================================================
--- poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java (original)
+++ poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java Fri Dec 27 23:00:13 2019
@@ -19,23 +19,19 @@ package org.apache.poi.ss.excelant.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import org.apache.poi.ss.excelant.BuildFileTest;
+import org.apache.poi.ss.excelant.TestBuildFile;
import org.junit.Test;
/**
* Tests for the ExcelAntWorbookUtilFactory.
- *
- * @author Jon Svede (jon [at] loquatic [dot] com)
- * @author Brian Bush (brian [dot] bush [at] nrel [dot] gov)
- *
*/
public class TestExcelAntWorkbookUtilFactory {
private static final String mortgageCalculatorWorkbookFile =
- BuildFileTest.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
-
-
+ TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
+
+
/**
* Simple test to determine if the factory properly returns an non-null
* instance of the ExcelAntWorkbookUtil class.
@@ -44,29 +40,29 @@ public class TestExcelAntWorkbookUtilFac
public void testGetNewWorkbookUtilInstance() {
ExcelAntWorkbookUtil util = ExcelAntWorkbookUtilFactory.getInstance(
mortgageCalculatorWorkbookFile) ;
-
+
assertNotNull(util) ;
}
-
-
+
+
/**
* Test whether or not the factory will properly return the same reference
* to an ExcelAnt WorkbookUtil when two different Strings, that point to
- * the same resource, are passed in.
+ * the same resource, are passed in.
*/
@Test
public void testVerifyEquivalence() {
- String sameFileName = BuildFileTest.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
-
+ String sameFileName = TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
+
ExcelAntWorkbookUtil util = ExcelAntWorkbookUtilFactory.getInstance(
mortgageCalculatorWorkbookFile) ;
ExcelAntWorkbookUtil util2 = ExcelAntWorkbookUtilFactory.getInstance(
sameFileName) ;
-
+
assertNotNull(util) ;
assertNotNull(util2) ;
-
+
assertEquals(util, util2) ;
}
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java?rev=1872041&r1=1872040&r2=1872041&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java Fri Dec 27 23:00:13 2019
@@ -30,6 +30,7 @@ import org.apache.poi.hssf.record.String
import org.apache.poi.hssf.record.aggregates.RecordAggregate.RecordVisitor;
import org.apache.poi.ss.formula.FormulaShifter;
import org.apache.poi.ss.formula.ptg.Ptg;
+import org.apache.poi.util.Removal;
/**
*
@@ -357,6 +358,10 @@ public final class ValueRecordsAggregate
return new ValueIterator();
}
+ @Override
+ @SuppressWarnings("squid:S2975")
+ @Deprecated
+ @Removal(version = "5.0.0")
public Object clone() {
throw new RuntimeException("clone() should not be called. ValueRecordsAggregate should be copied via Sheet.cloneSheet()");
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=1872041&r1=1872040&r2=1872041&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java Fri Dec 27 23:00:13 2019
@@ -51,7 +51,6 @@ import org.apache.poi.hssf.record.aggreg
import org.apache.poi.hssf.record.aggregates.RecordAggregate.RecordVisitor;
import org.apache.poi.hssf.record.aggregates.WorksheetProtectionBlock;
import org.apache.poi.hssf.usermodel.helpers.HSSFColumnShifter;
-
import org.apache.poi.hssf.usermodel.helpers.HSSFRowShifter;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.formula.FormulaShifter;
@@ -76,6 +75,7 @@ import org.apache.poi.ss.util.SSCellRang
import org.apache.poi.ss.util.SheetUtil;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Configurator;
+import org.apache.poi.util.Internal;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -95,7 +95,7 @@ public final class HSSFSheet implements
*/
private static final float PX_MODIFIED = 36.56f;
-
+
/**
* Used for compile-time optimization. This is the initial size for the collection of
* rows. It is currently set to 20. If you generate larger sheets you may benefit
@@ -501,25 +501,25 @@ public final class HSSFSheet implements
/**
* Set the width (in units of 1/256th of a character width)<p>
- *
+ *
* The maximum column width for an individual cell is 255 characters.
* This value represents the number of characters that can be displayed
* in a cell that is formatted with the standard font (first font in the workbook).<p>
- *
+ *
* Character width is defined as the maximum digit width
* of the numbers <code>0, 1, 2, ... 9</code> as rendered
* using the default font (first font in the workbook).<p>
- *
+ *
* Unless you are using a very special font, the default character is '0' (zero),
* this is true for Arial (default font font in HSSF) and Calibri (default font in XSSF)<p>
- *
+ *
* Please note, that the width set by this method includes 4 pixels of margin padding (two on each side),
* plus 1 pixel padding for the gridlines (Section 3.3.1.12 of the OOXML spec).
* This results is a slightly less value of visible characters than passed to this method (approx. 1/2 of a character).<p>
- *
+ *
* To compute the actual number of visible characters,
* Excel uses the following formula (Section 3.3.1.12 of the OOXML spec):<p>
- *
+ *
* <code>
* width = Truncate([{Number of Visible Characters} *
* {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256
@@ -561,7 +561,7 @@ public final class HSSFSheet implements
return cw/px;
}
-
+
/**
* get the default column width for the sheet (if the columns do not define their own width) in
* characters
@@ -730,7 +730,7 @@ public final class HSSFSheet implements
// throw IllegalStateException if the argument CellRangeAddress intersects with
// a multi-cell array formula defined in this sheet
validateArrayFormulas(region);
-
+
// Throw IllegalStateException if the argument CellRangeAddress intersects with
// a merged region already in this sheet
validateMergedRegions(region);
@@ -752,7 +752,7 @@ public final class HSSFSheet implements
for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) {
HSSFRow row = getRow(rowIn);
if (row == null) continue;
-
+
for (int colIn = firstColumn; colIn <= lastColumn; colIn++) {
HSSFCell cell = row.getCell(colIn);
if (cell == null) continue;
@@ -814,11 +814,11 @@ public final class HSSFSheet implements
/**
* Control if Excel should be asked to recalculate all formulas on this sheet
* when the workbook is opened.<p>
- *
+ *
* Calculating the formula values with {@link org.apache.poi.ss.usermodel.FormulaEvaluator} is the
* recommended solution, but this may be used for certain cases where
* evaluation in POI is not possible.<p>
- *
+ *
* It is recommended to force recalcuation of formulas on workbook level using
* {@link org.apache.poi.ss.usermodel.Workbook#setForceFormulaRecalculation(boolean)}
* to ensure that all cross-worksheet formuals and external dependencies are updated.
@@ -909,7 +909,7 @@ public final class HSSFSheet implements
public void removeMergedRegion(int index) {
_sheet.removeMergedRegion(index);
}
-
+
/**
* Removes a number of merged regions of cells (hence letting them free)
*
@@ -981,7 +981,8 @@ public final class HSSFSheet implements
*
* @return Sheet - low level representation of this HSSFSheet.
*/
- /*package*/ InternalSheet getSheet() {
+ @Internal
+ public InternalSheet getSheet() {
return _sheet;
}
@@ -1222,7 +1223,7 @@ public final class HSSFSheet implements
public void setPrintGridlines(boolean show) {
getSheet().getPrintGridlines().setPrintGridlines(show);
}
-
+
/**
* Returns whether row and column headings are printed.
*
@@ -1408,7 +1409,7 @@ public final class HSSFSheet implements
sclRecord.setDenominator((short) denominator);
getSheet().setSCLRecord(sclRecord);
}
-
+
/**
* Window zoom magnification for current view representing percent values.
* Valid values range from 10 to 400. Horizontal & Vertical scale together.
@@ -1464,7 +1465,7 @@ public final class HSSFSheet implements
public void showInPane(int topRow, int leftCol) {
int maxrow = SpreadsheetVersion.EXCEL97.getLastRowIndex();
if (topRow > maxrow) throw new IllegalArgumentException("Maximum row number is " + maxrow);
-
+
showInPane((short) topRow, (short) leftCol);
}
/**
@@ -1478,10 +1479,10 @@ public final class HSSFSheet implements
_sheet.setTopRow(toprow);
_sheet.setLeftCol(leftcol);
}
-
+
/**
* Shifts, grows, or shrinks the merged regions due to a row shift
- *
+ *
* @param startRow the start-index of the rows to shift, zero-based
* @param endRow the end-index of the rows to shift, zero-based
* @param n how far to shift, negative to shift up
@@ -1497,9 +1498,9 @@ public final class HSSFSheet implements
* Shifts rows between startRow and endRow n number of rows.
* If you use a negative number, it will shift rows up.
* Code ensures that rows don't wrap around.<p>
- *
+ *
* Calls {@code shiftRows(startRow, endRow, n, false, false);}<p>
- *
+ *
* Additionally shifts merged regions that are completely defined in these
* rows (ie. merged 2 cells on a row to be shifted).
*
@@ -1516,11 +1517,11 @@ public final class HSSFSheet implements
* Shifts rows between startRow and endRow n number of rows.
* If you use a negative number, it will shift rows up.
* Code ensures that rows don't wrap around<p>
- *
+ *
* Additionally shifts merged regions that are completely defined in these
* rows (ie. merged 2 cells on a row to be shifted). All merged regions that are
* completely overlaid by shifting will be deleted.<p>
- *
+ *
* TODO Might want to add bounds checking here
*
* @param startRow the row to start shifting
@@ -1533,7 +1534,7 @@ public final class HSSFSheet implements
public void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight) {
shiftRows(startRow, endRow, n, copyRowHeight, resetOriginalRowHeight, true);
}
-
+
/**
* bound a row number between 0 and last row index (65535)
*
@@ -1549,10 +1550,10 @@ public final class HSSFSheet implements
* Shifts rows between startRow and endRow n number of rows.
* If you use a negative number, it will shift rows up.
* Code ensures that rows don't wrap around<p>
- *
+ *
* Additionally shifts merged regions that are completely defined in these
* rows (ie. merged 2 cells on a row to be shifted).<p>
- *
+ *
* TODO Might want to add bounds checking here
*
* @param startRow the row to start shifting
@@ -1578,9 +1579,9 @@ public final class HSSFSheet implements
// Nothing to do
return;
}
-
+
final RowShifter rowShifter = new HSSFRowShifter(this);
-
+
// Move comments from the source row to the
// destination row. Note that comments can
// exist for cells which are null
@@ -1594,10 +1595,10 @@ public final class HSSFSheet implements
// Shift Merged Regions
rowShifter.shiftMergedRegions(startRow, endRow, n);
-
+
// Shift Row Breaks
_sheet.getPageSettings().shiftRowBreaks(startRow, endRow, n);
-
+
// Delete overwritten hyperlinks
deleteOverwrittenHyperlinksForRowShift(startRow, endRow, n);
@@ -1747,30 +1748,30 @@ public final class HSSFSheet implements
}
}
}
-
+
/**
* Shifts columns in range [startColumn, endColumn] for n places to the right.
* For n < 0, it will shift columns left.
* Additionally adjusts formulas.
- * Probably should also process other features (hyperlinks, comments...) in the way analog to shiftRows method
+ * Probably should also process other features (hyperlinks, comments...) in the way analog to shiftRows method
* @param startColumn the column to start shifting
* @param endColumn the column to end shifting
* @param n the number of columns to shift
*/
@Beta
@Override
- public void shiftColumns(int startColumn, int endColumn, int n){
- HSSFColumnShifter columnShifter = new HSSFColumnShifter(this);
- columnShifter.shiftColumns(startColumn, endColumn, n);
-
+ public void shiftColumns(int startColumn, int endColumn, int n){
+ HSSFColumnShifter columnShifter = new HSSFColumnShifter(this);
+ columnShifter.shiftColumns(startColumn, endColumn, n);
+
int sheetIndex = _workbook.getSheetIndex(this);
short externSheetIndex = _book.checkExternSheet(sheetIndex);
String sheetName = _workbook.getSheetName(sheetIndex);
FormulaShifter formulaShifter = FormulaShifter.createForColumnShift(
externSheetIndex, sheetName, startColumn, endColumn, n, SpreadsheetVersion.EXCEL97);
- updateFormulasForShift(formulaShifter);
- // add logic for hyperlinks etc, like in shiftRows()
- }
+ updateFormulasForShift(formulaShifter);
+ // add logic for hyperlinks etc, like in shiftRows()
+ }
protected void insertChartRecords(List<Record> records) {
int window2Loc = _sheet.findFirstRecordLocBySid(WindowTwoRecord.sid);
@@ -1790,7 +1791,7 @@ public final class HSSFSheet implements
/**
* Creates a split (freezepane). Any existing freezepane or split pane is overwritten.<p>
- *
+ *
* If both colSplit and rowSplit are zero then the existing freeze pane is removed
*
* @param colSplit Horizonatal position of split.
@@ -1811,7 +1812,7 @@ public final class HSSFSheet implements
/**
* Creates a split (freezepane). Any existing freezepane or split pane is overwritten.<p>
- *
+ *
* If both colSplit and rowSplit are zero then the existing freeze pane is removed
*
* @param colSplit Horizonatal position of split.
@@ -1914,7 +1915,7 @@ public final class HSSFSheet implements
/**
* Sets a page break at the indicated row
* Breaks occur above the specified row and left of the specified column inclusive.<p>
- *
+ *
* For example, <code>sheet.setColumnBreak(2);</code> breaks the sheet into two parts
* with columns A,B,C in the first and D,E,... in the second. Simuilar, <code>sheet.setRowBreak(2);</code>
* breaks the sheet into two parts with first three rows (rownum=1...3) in the first part
@@ -1966,7 +1967,7 @@ public final class HSSFSheet implements
/**
* Sets a page break at the indicated column.
* Breaks occur above the specified row and left of the specified column inclusive.<p>
- *
+ *
* For example, <code>sheet.setColumnBreak(2);</code> breaks the sheet into two parts
* with columns A,B,C in the first and D,E,... in the second. Simuilar, {@code sheet.setRowBreak(2);}
* breaks the sheet into two parts with first three rows (rownum=1...3) in the first part
@@ -2079,9 +2080,9 @@ public final class HSSFSheet implements
}
/**
- * Creates the top-level drawing patriarch.
+ * Creates the top-level drawing patriarch.
* <p>This may then be used to add graphics or charts.</p>
- * <p>Note that this will normally have the effect of removing
+ * <p>Note that this will normally have the effect of removing
* any existing drawings on this sheet.</p>
*
* @return The new patriarch.
@@ -2189,7 +2190,7 @@ public final class HSSFSheet implements
/**
* Adjusts the column width to fit the contents.<p>
- *
+ *
* This process can be relatively slow on large sheets, so this should
* normally only be called once per column, at the end of your
* processing.
@@ -2203,11 +2204,11 @@ public final class HSSFSheet implements
/**
* Adjusts the column width to fit the contents.<p>
- *
+ *
* This process can be relatively slow on large sheets, so this should
* normally only be called once per column, at the end of your
* processing.<p>
- *
+ *
* You can specify whether the content of merged cells should be considered or ignored.
* Default is to ignore merged cells.
*
@@ -2227,7 +2228,7 @@ public final class HSSFSheet implements
setColumnWidth(column, (int) (width));
}
}
-
+
/**
* Returns cell comment for the specified row and column
*
@@ -2237,7 +2238,7 @@ public final class HSSFSheet implements
public HSSFComment getCellComment(CellAddress ref) {
return findCellComment(ref.getRow(), ref.getColumn());
}
-
+
/**
* Get a Hyperlink in this sheet anchored at row, column
*
@@ -2257,7 +2258,7 @@ public final class HSSFSheet implements
}
return null;
}
-
+
/**
* Get a Hyperlink in this sheet located in a cell specified by {code addr}
*
@@ -2269,7 +2270,7 @@ public final class HSSFSheet implements
public HSSFHyperlink getHyperlink(CellAddress addr) {
return getHyperlink(addr.getRow(), addr.getColumn());
}
-
+
/**
* Get a list of Hyperlinks in this sheet
*
@@ -2286,7 +2287,7 @@ public final class HSSFSheet implements
}
return hyperlinkList;
}
-
+
/**
* Remove the underlying HyperlinkRecord from this sheet.
* If multiple HSSFHyperlinks refer to the same HyperlinkRecord, all HSSFHyperlinks will be removed.
@@ -2296,7 +2297,7 @@ public final class HSSFSheet implements
protected void removeHyperlink(HSSFHyperlink link) {
removeHyperlink(link.record);
}
-
+
/**
* Remove the underlying HyperlinkRecord from this sheet
*
@@ -2415,7 +2416,7 @@ public final class HSSFSheet implements
}
int firstRow = range.getFirstRow();
-
+
// if row was not given when constructing the range...
if(firstRow == -1) {
firstRow = 0;
@@ -2485,7 +2486,7 @@ public final class HSSFSheet implements
if (null == patriarch) {
patriarch = createDrawingPatriarch();
}
-
+
Map<CellAddress, HSSFComment> locations = new TreeMap<>();
findCellCommentLocations(patriarch, locations);
return locations;
@@ -2663,7 +2664,7 @@ public final class HSSFSheet implements
}
return _workbook.getNameRecord(recIndex);
}
-
+
/**
* Returns the column outline level. Increased as you
* put it into more groups (outlines), reduced as
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org