poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1702659 [1/3] - in /poi/trunk/src: examples/src/org/apache/poi/hssf/view/ examples/src/org/apache/poi/poifs/poibrowser/ java/org/apache/poi/hssf/model/ java/org/apache/poi/hssf/record/ java/org/apache/poi/hssf/usermodel/ java/org/apache/po...
Date Sat, 12 Sep 2015 18:45:09 GMT
Author: kiwiwings
Date: Sat Sep 12 18:45:07 2015
New Revision: 1702659

URL: http://svn.apache.org/r1702659
Log:
fix eclipse warning - mostly generics cosmetics
close resources in tests
junit4 conversions
convert spreadsheet based formular test to junit parameterized tests

Added:
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/AllSpreadsheetBasedTests.java
Modified:
    poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableModel.java
    poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/ExtendableTreeCellRenderer.java
    poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java
    poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/PropertySetDescriptorRenderer.java
    poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java
    poi/trunk/src/java/org/apache/poi/hssf/record/Record.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java
    poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java
    poi/trunk/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java
    poi/trunk/src/java/org/apache/poi/sl/draw/geom/ExpressionParser.java
    poi/trunk/src/java/org/apache/poi/ss/formula/Formula.java
    poi/trunk/src/java/org/apache/poi/ss/formula/eval/OperandResolver.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFDataValidation.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataValidation.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFName.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java
    poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/AllEventUserModelTests.java
    poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestFormatTrackingHSSFListener.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTDeserializer.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestChartTitleFormatRecord.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFName.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestSanityChecker.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/AllPOIFSStorageTests.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestPropertyBlock.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestFormulaBugs.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/function/AllFormulaFunctionTests.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/function/ExcelFileFormatDocFunctionExtractor.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/function/TestParseMissingBuiltInFuncs.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/BaseTestFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestCodeFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestComplexFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDGetFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDStarFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDeltaFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestFactDoubleFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestFixedFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestImRealFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestImaginaryFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestIndexFunctionFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestIndirectFunctionFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestLookupFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestMatchFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestQuotientFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestReptFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestRomanFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestWeekNumFunctionsFromSpreadsheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestWeekNumFunctionsFromSpreadsheet2013.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/ptg/TestExternalFunctionFormulas.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataValidation.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestNamedRange.java
    poi/trunk/src/testcases/org/apache/poi/ss/util/NumberRenderingSpreadsheetGenerator.java

Modified: poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableModel.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableModel.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableModel.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableModel.java Sat Sep 12 18:45:07 2015
@@ -25,6 +25,7 @@ import javax.swing.table.*;
 
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 
 /**
@@ -43,7 +44,7 @@ public class SVTableModel extends Abstra
 
   public SVTableModel(HSSFSheet st) {
     this.st = st;
-    Iterator i = st.rowIterator();
+    Iterator<Row> i = st.rowIterator();
 
     while (i.hasNext()) {
       HSSFRow row = (HSSFRow)i.next();
@@ -69,7 +70,7 @@ public class SVTableModel extends Abstra
     return st.getLastRowNum() + 1;
   }
 
-  public Class getColumnClass(int c) {
+  public Class<?> getColumnClass(int c) {
 	return HSSFCell.class;
   }
 

Modified: poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/ExtendableTreeCellRenderer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/ExtendableTreeCellRenderer.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/ExtendableTreeCellRenderer.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/ExtendableTreeCellRenderer.java Sat Sep 12 18:45:07 2015
@@ -43,18 +43,18 @@ public class ExtendableTreeCellRenderer
     /**
      * <p>Maps classes to renderers.</p>
      */
-    protected Map renderers;
+    protected Map<Class<?>,TreeCellRenderer> renderers;
 
 
 
     public ExtendableTreeCellRenderer()
     {
-        renderers = new HashMap();
+        renderers = new HashMap<Class<?>,TreeCellRenderer>();
         register(Object.class, new DefaultTreeCellRenderer()
             {
                 public Component getTreeCellRendererComponent
-                    (JTree tree, Object value, boolean selected,
-                     boolean expanded, boolean leaf, int row, boolean hasFocus)
+                    (JTree tree, Object value, boolean selectedCell,
+                     boolean expanded, boolean leaf, int row, boolean hasCellFocus)
                 {
                     final String s = value.toString();
                     final JLabel l = new JLabel(s + "  ");
@@ -73,7 +73,7 @@ public class ExtendableTreeCellRenderer
     /**
      * <p>Registers a renderer for a class.</p>
      **/
-    public void register(final Class c, final TreeCellRenderer renderer)
+    public void register(final Class<?> c, final TreeCellRenderer renderer)
     {
         renderers.put(c, renderer);
     }
@@ -84,7 +84,7 @@ public class ExtendableTreeCellRenderer
      * <p>Unregisters a renderer for a class. The renderer for the
      * {@link Object} class cannot be unregistered.</p>
      */
-    public void unregister(final Class c)
+    public void unregister(final Class<?> c)
     {
         if (c == Object.class)
             throw new IllegalArgumentException
@@ -127,15 +127,15 @@ public class ExtendableTreeCellRenderer
     /**
      * <p>Find the renderer for the specified class.</p>
      */
-    protected TreeCellRenderer findRenderer(final Class c)
+    protected TreeCellRenderer findRenderer(final Class<?> c)
     {
-        final TreeCellRenderer r = (TreeCellRenderer) renderers.get(c);
+        final TreeCellRenderer r = renderers.get(c);
         if (r != null)
             /* The class has a renderer. */
             return r;
 
         /* The class has no renderer, try the superclass, if any. */
-        final Class superclass = c.getSuperclass();
+        final Class<?> superclass = c.getSuperclass();
         if (superclass != null) {
             return findRenderer(superclass);
         }

Modified: poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java Sat Sep 12 18:45:07 2015
@@ -89,19 +89,16 @@ public class POIBrowser extends JFrame
         for (int i = 0; i < args.length; i++)
         {
             final String filename = args[i];
-            try
-            {
+            try {
+                FileInputStream fis = new FileInputStream(filename);
                 POIFSReader r = new POIFSReader();
                 r.registerListener(new TreeReaderListener(filename, rootNode));
-                r.read(new FileInputStream(filename));
+                r.read(fis);
+                fis.close();
                 displayedFiles++;
-            }
-            catch (IOException ex)
-            {
+            } catch (IOException ex) {
                 System.err.println(filename + ": " + ex);
-            }
-            catch (Exception t)
-            {
+            } catch (Exception t) {
                 System.err.println("Unexpected exception while reading \"" +
                                    filename + "\":");
                 t.printStackTrace(System.err);

Modified: poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/PropertySetDescriptorRenderer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/PropertySetDescriptorRenderer.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/PropertySetDescriptorRenderer.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/PropertySetDescriptorRenderer.java Sat Sep 12 18:45:07 2015
@@ -45,11 +45,11 @@ public class PropertySetDescriptorRender
 
     public Component getTreeCellRendererComponent(final JTree tree,
                                                   final Object value,
-                                                  final boolean selected,
+                                                  final boolean selectedCell,
                                                   final boolean expanded,
                                                   final boolean leaf,
                                                   final int row,
-                                                  final boolean hasFocus)
+                                                  final boolean hasCellFocus)
     {
         final PropertySetDescriptor d = (PropertySetDescriptor)
             ((DefaultMutableTreeNode) value).getUserObject();
@@ -96,7 +96,7 @@ public class PropertySetDescriptorRender
             text.append("\nSecurity:            " + si.getSecurity());
         }
 
-        if (selected)
+        if (selectedCell)
             Util.invert(text);
         return p;
     }
@@ -107,13 +107,13 @@ public class PropertySetDescriptorRender
      * <p>Returns a string representation of a list of {@link
      * Section}s.</p>
      */
-    protected String sectionsToString(final List sections)
+    protected String sectionsToString(final List<Section> sections)
     {
         final StringBuffer b = new StringBuffer();
         int count = 1;
-        for (Iterator i = sections.iterator(); i.hasNext();)
+        for (Iterator<Section>  i = sections.iterator(); i.hasNext();)
         {
-            Section s = (Section) i.next();
+            Section s = i.next();
             String d = toString(s, "Section " + count++);
             b.append(d);
         }

Modified: poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java Sat Sep 12 18:45:07 2015
@@ -254,12 +254,12 @@ public final class InternalSheet {
 
             if (recSid == BOFRecord.sid) {
                 ChartSubstreamRecordAggregate chartAgg = new ChartSubstreamRecordAggregate(rs);
-                if (false) {
-                    // TODO - would like to keep the chart aggregate packed, but one unit test needs attention
-                    records.add(chartAgg);
-                } else {
+//                if (false) {
+//                    // TODO - would like to keep the chart aggregate packed, but one unit test needs attention
+//                    records.add(chartAgg);
+//                } else {
                     spillAggregate(chartAgg, records);
-                }
+//                }
                 continue;
             }
 

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/Record.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/Record.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/Record.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/Record.java Sat Sep 12 18:45:07 2015
@@ -62,14 +62,14 @@ public abstract class Record extends Rec
 
     @Override
     public Object clone() {
-        if (false) {
-            // TODO - implement clone in a more standardised way
-            try {
-                return super.clone();
-            } catch (CloneNotSupportedException e) {
-                throw new RuntimeException(e);
-            }
-        }
+//        if (false) {
+//            // TODO - implement clone in a more standardised way
+//            try {
+//                return super.clone();
+//            } catch (CloneNotSupportedException e) {
+//                throw new RuntimeException(e);
+//            }
+//        }
         throw new RuntimeException("The class "+getClass().getName()+" needs to define a clone method");
     }
 

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java Sat Sep 12 18:45:07 2015
@@ -54,9 +54,9 @@ public class HSSFFormulaEvaluator implem
 	@Deprecated
     public HSSFFormulaEvaluator(HSSFSheet sheet, HSSFWorkbook workbook) {
 		this(workbook);
-		if (false) {
-			sheet.toString(); // suppress unused parameter compiler warning
-		}
+//		if (false) {
+//			sheet.toString(); // suppress unused parameter compiler warning
+//		}
 		this._book = workbook;
 	}
 	public HSSFFormulaEvaluator(HSSFWorkbook workbook) {
@@ -122,9 +122,9 @@ public class HSSFFormulaEvaluator implem
 	@Deprecated
     public void setCurrentRow(HSSFRow row) {
 		// do nothing
-		if (false) {
-			row.getClass(); // suppress unused parameter compiler warning
-		}
+//		if (false) {
+//			row.getClass(); // suppress unused parameter compiler warning
+//		}
 	}
 
 	/**

Modified: poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java Sat Sep 12 18:45:07 2015
@@ -90,14 +90,14 @@ public class HSSFColor implements Color
                 // most colors don't have a second index
                 continue;
             }
-            if (result.containsKey(index2)) {
-                if (false) { // Many of the second indexes clash
-                    HSSFColor prevColor = (HSSFColor)result.get(index2);
-                    throw new RuntimeException("Dup color index (" + index2
-                            + ") for colors (" + prevColor.getClass().getName()
-                            + "),(" + color.getClass().getName() + ")");
-                }
-            }
+//            if (result.containsKey(index2)) {
+//                if (false) { // Many of the second indexes clash
+//                    HSSFColor prevColor = (HSSFColor)result.get(index2);
+//                    throw new RuntimeException("Dup color index (" + index2
+//                            + ") for colors (" + prevColor.getClass().getName()
+//                            + "),(" + color.getClass().getName() + ")");
+//                }
+//            }
             result.put(index2, color);
         }
         return result;

Modified: poi/trunk/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java Sat Sep 12 18:45:07 2015
@@ -36,20 +36,20 @@ class POIFSReaderRegistry
 {
 
     // the POIFSReaderListeners who listen to all POIFSReaderEvents
-    private Set omnivorousListeners;
+    private Set<POIFSReaderListener> omnivorousListeners;
 
     // Each mapping in this Map has a key consisting of a
     // POIFSReaderListener and a value cosisting of a Set of
     // DocumentDescriptors for the documents that POIFSReaderListener
     // is interested in; used to efficiently manage the registry
-    private Map selectiveListeners;
+    private Map<POIFSReaderListener, Set<DocumentDescriptor>> selectiveListeners;
 
     // Each mapping in this Map has a key consisting of a
     // DocumentDescriptor and a value consisting of a Set of
     // POIFSReaderListeners for the document matching that
     // DocumentDescriptor; used when a document is found, to quickly
     // get the listeners interested in that document
-    private Map chosenDocumentDescriptors;
+    private Map<DocumentDescriptor,Set<POIFSReaderListener>> chosenDocumentDescriptors;
 
     /**
      * Construct the registry
@@ -57,9 +57,9 @@ class POIFSReaderRegistry
 
     POIFSReaderRegistry()
     {
-        omnivorousListeners       = new HashSet();
-        selectiveListeners        = new HashMap();
-        chosenDocumentDescriptors = new HashMap();
+        omnivorousListeners       = new HashSet<POIFSReaderListener>();
+        selectiveListeners        = new HashMap<POIFSReaderListener, Set<DocumentDescriptor>>();
+        chosenDocumentDescriptors = new HashMap<DocumentDescriptor,Set<POIFSReaderListener>>();
     }
 
     /**
@@ -79,13 +79,13 @@ class POIFSReaderRegistry
 
             // not an omnivorous listener (if it was, this method is a
             // no-op)
-            Set descriptors = ( Set ) selectiveListeners.get(listener);
+            Set<DocumentDescriptor> descriptors = selectiveListeners.get(listener);
 
             if (descriptors == null)
             {
 
                 // this listener has not registered before
-                descriptors = new HashSet();
+                descriptors = new HashSet<DocumentDescriptor>();
                 selectiveListeners.put(listener, descriptors);
             }
             DocumentDescriptor descriptor = new DocumentDescriptor(path,
@@ -97,14 +97,14 @@ class POIFSReaderRegistry
                 // this listener wasn't already listening for this
                 // document -- add the listener to the set of
                 // listeners for this document
-                Set listeners =
-                    ( Set ) chosenDocumentDescriptors.get(descriptor);
+                Set<POIFSReaderListener> listeners =
+                    chosenDocumentDescriptors.get(descriptor);
 
                 if (listeners == null)
                 {
 
                     // nobody was listening for this document before
-                    listeners = new HashSet();
+                    listeners = new HashSet<POIFSReaderListener>();
                     chosenDocumentDescriptors.put(descriptor, listeners);
                 }
                 listeners.add(listener);
@@ -141,31 +141,30 @@ class POIFSReaderRegistry
      * @return an Iterator POIFSReaderListeners; may be empty
      */
 
-    Iterator getListeners(final POIFSDocumentPath path, final String name)
+    Iterator<POIFSReaderListener> getListeners(final POIFSDocumentPath path, final String name)
     {
-        Set rval               = new HashSet(omnivorousListeners);
-        Set selectiveListeners =
-            ( Set ) chosenDocumentDescriptors.get(new DocumentDescriptor(path,
-                name));
+        Set<POIFSReaderListener> rval = new HashSet<POIFSReaderListener>(omnivorousListeners);
+        Set<POIFSReaderListener> selectiveListenersInner =
+            chosenDocumentDescriptors.get(new DocumentDescriptor(path, name));
 
-        if (selectiveListeners != null)
+        if (selectiveListenersInner != null)
         {
-            rval.addAll(selectiveListeners);
+            rval.addAll(selectiveListenersInner);
         }
         return rval.iterator();
     }
 
     private void removeSelectiveListener(final POIFSReaderListener listener)
     {
-        Set selectedDescriptors = ( Set ) selectiveListeners.remove(listener);
+        Set<DocumentDescriptor> selectedDescriptors = selectiveListeners.remove(listener);
 
         if (selectedDescriptors != null)
         {
-            Iterator iter = selectedDescriptors.iterator();
+            Iterator<DocumentDescriptor> iter = selectedDescriptors.iterator();
 
             while (iter.hasNext())
             {
-                dropDocument(listener, ( DocumentDescriptor ) iter.next());
+                dropDocument(listener, iter.next());
             }
         }
     }
@@ -173,7 +172,7 @@ class POIFSReaderRegistry
     private void dropDocument(final POIFSReaderListener listener,
                               final DocumentDescriptor descriptor)
     {
-        Set listeners = ( Set ) chosenDocumentDescriptors.get(descriptor);
+        Set<POIFSReaderListener> listeners = chosenDocumentDescriptors.get(descriptor);
 
         listeners.remove(listener);
         if (listeners.size() == 0)

Modified: poi/trunk/src/java/org/apache/poi/sl/draw/geom/ExpressionParser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/draw/geom/ExpressionParser.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/draw/geom/ExpressionParser.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/draw/geom/ExpressionParser.java Sat Sep 12 18:45:07 2015
@@ -29,7 +29,9 @@ import java.util.regex.Pattern;
  * @author Yegor Kozlov
  */
 public class ExpressionParser {
-    static final HashMap<String, Class> impls = new HashMap<String, Class>();
+    static final HashMap<String, Class<? extends Expression>> impls =
+        new HashMap<String, Class<? extends Expression>>();
+    
     static {
         impls.put("\\*/ +([\\-\\w]+) +([\\-\\w]+) +([\\-\\w]+)", MultiplyDivideExpression.class);
         impls.put("\\+- +([\\-\\w]+) +([\\-\\w]+) +([\\-\\w]+)( 0)?", AddSubtractExpression.class);
@@ -56,9 +58,9 @@ public class ExpressionParser {
             Pattern ptrn = Pattern.compile(regexp);
             Matcher m = ptrn.matcher(str);
             if(m.matches()) {
-                Class c = impls.get(regexp);
+                Class<? extends Expression> c = impls.get(regexp);
                 try {
-                    return (Expression)c.getDeclaredConstructor(Matcher.class).newInstance(m);
+                    return c.getDeclaredConstructor(Matcher.class).newInstance(m);
                 } catch (Exception e){
                     throw new RuntimeException(e);
                 }

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/Formula.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/Formula.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/Formula.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/Formula.java Sat Sep 12 18:45:07 2015
@@ -44,19 +44,19 @@ public class Formula {
 	private Formula(byte[] byteEncoding, int encodedTokenLen) {
 		_byteEncoding = byteEncoding;
 		_encodedTokenLen = encodedTokenLen;
-		if (false) { // set to true to eagerly check Ptg decoding
-			LittleEndianByteArrayInputStream in = new LittleEndianByteArrayInputStream(byteEncoding);
-			Ptg.readTokens(encodedTokenLen, in);
-			int nUnusedBytes = _byteEncoding.length - in.getReadIndex();
-			if (nUnusedBytes > 0) {
-				// TODO - this seems to occur when IntersectionPtg is present
-				// This example file "IntersectionPtg.xls"
-				// used by test: TestIntersectionPtg.testReading()
-				// has 10 bytes unused at the end of the formula
-				// 10 extra bytes are just 0x01 and 0x00
-				System.out.println(nUnusedBytes + " unused bytes at end of formula");
-			}
-		}
+//		if (false) { // set to true to eagerly check Ptg decoding
+//			LittleEndianByteArrayInputStream in = new LittleEndianByteArrayInputStream(byteEncoding);
+//			Ptg.readTokens(encodedTokenLen, in);
+//			int nUnusedBytes = _byteEncoding.length - in.getReadIndex();
+//			if (nUnusedBytes > 0) {
+//				// TODO - this seems to occur when IntersectionPtg is present
+//				// This example file "IntersectionPtg.xls"
+//				// used by test: TestIntersectionPtg.testReading()
+//				// has 10 bytes unused at the end of the formula
+//				// 10 extra bytes are just 0x01 and 0x00
+//				System.out.println(nUnusedBytes + " unused bytes at end of formula");
+//			}
+//		}
 	}
 	/**
 	 * Convenience method for {@link #read(int, LittleEndianInput, int)}

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/eval/OperandResolver.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/eval/OperandResolver.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/eval/OperandResolver.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/eval/OperandResolver.java Sat Sep 12 18:45:07 2015
@@ -130,28 +130,28 @@ public final class OperandResolver {
 	private static ValueEval chooseSingleElementFromAreaInternal(AreaEval ae,
 			int srcCellRow, int srcCellCol) throws EvaluationException {
 
-		if(false) {
-			// this is too simplistic
-			if(ae.containsRow(srcCellRow) && ae.containsColumn(srcCellCol)) {
-				throw new EvaluationException(ErrorEval.CIRCULAR_REF_ERROR);
-			}
-		/*
-		Circular references are not dealt with directly here, but it is worth noting some issues.
-
-		ANY one of the return statements in this method could return a cell that is identical
-		to the one immediately being evaluated.  The evaluating cell is identified by srcCellRow,
-		srcCellRow AND sheet.  The sheet is not available in any nearby calling method, so that's
-		one reason why circular references are not easy to detect here. (The sheet of the returned
-		cell can be obtained from ae if it is an Area3DEval.)
-
-		Another reason there's little value in attempting to detect circular references here is
-		that only direct circular references could be detected.  If the cycle involved two or more
-		cells this method could not detect it.
-
-		Logic to detect evaluation cycles of all kinds has been coded in EvaluationCycleDetector
-		(and FormulaEvaluator).
-		 */
-		}
+//		if(false) {
+//			// this is too simplistic
+//			if(ae.containsRow(srcCellRow) && ae.containsColumn(srcCellCol)) {
+//				throw new EvaluationException(ErrorEval.CIRCULAR_REF_ERROR);
+//			}
+//		/*
+//		Circular references are not dealt with directly here, but it is worth noting some issues.
+//
+//		ANY one of the return statements in this method could return a cell that is identical
+//		to the one immediately being evaluated.  The evaluating cell is identified by srcCellRow,
+//		srcCellRow AND sheet.  The sheet is not available in any nearby calling method, so that's
+//		one reason why circular references are not easy to detect here. (The sheet of the returned
+//		cell can be obtained from ae if it is an Area3DEval.)
+//
+//		Another reason there's little value in attempting to detect circular references here is
+//		that only direct circular references could be detected.  If the cycle involved two or more
+//		cells this method could not detect it.
+//
+//		Logic to detect evaluation cycles of all kinds has been coded in EvaluationCycleDetector
+//		(and FormulaEvaluator).
+//		 */
+//		}
 
 		if (ae.isColumn()) {
 			if(ae.isRow()) {

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java Sat Sep 12 18:45:07 2015
@@ -17,25 +17,27 @@
 
 package org.apache.poi.openxml4j.opc;
 
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
 import java.util.TreeMap;
 
 import org.apache.poi.openxml4j.opc.internal.FileHelper;
-
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * Test TestFileHelper class.
  *
  * @author Julien Chable
  */
-public final class TestFileHelper extends TestCase {
+public final class TestFileHelper {
 
 	/**
 	 * TODO - use simple JDK methods on {@link File} instead:<br/>
 	 * {@link File#getParentFile()} instead of {@link FileHelper#getDirectory(File)
 	 * {@link File#getName()} instead of {@link FileHelper#getFilename(File)
 	 */
+    @Test
 	public void testGetDirectory() {
 		TreeMap<String, String> expectedValue = new TreeMap<String, String>();
 		expectedValue.put("/dir1/test.doc", "/dir1");
@@ -45,11 +47,11 @@ public final class TestFileHelper extend
 			File f1 = new File(expectedValue.get(filename));
 			File f2 = FileHelper.getDirectory(new File(filename));
 
-			if (false) {
-				// YK: The original version asserted expected values against File#getAbsolutePath():
-				assertTrue(expectedValue.get(filename).equalsIgnoreCase(f2.getAbsolutePath()));
-				// This comparison is platform dependent. A better approach is below
-			}
+//			if (false) {
+//				// YK: The original version asserted expected values against File#getAbsolutePath():
+//				assertTrue(expectedValue.get(filename).equalsIgnoreCase(f2.getAbsolutePath()));
+//				// This comparison is platform dependent. A better approach is below
+//			}
 			assertTrue(f1.equals(f2));
 		}
 	}

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFDataValidation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFDataValidation.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFDataValidation.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFDataValidation.java Sat Sep 12 18:45:07 2015
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.xssf.streaming;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.List;
 
 import org.apache.poi.ss.usermodel.BaseTestDataValidation;
@@ -25,6 +27,7 @@ import org.apache.poi.ss.usermodel.DataV
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.util.CellRangeAddressList;
 import org.apache.poi.xssf.SXSSFITestDataProvider;
+import org.junit.Test;
 
 public class TestSXSSFDataValidation extends BaseTestDataValidation {
 
@@ -32,6 +35,7 @@ public class TestSXSSFDataValidation ext
         super(SXSSFITestDataProvider.instance);
     }
 
+    @Test
     public void test53965() throws Exception {
         SXSSFWorkbook wb = new SXSSFWorkbook();
         try {

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataValidation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataValidation.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataValidation.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataValidation.java Sat Sep 12 18:45:07 2015
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.xssf.usermodel;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.List;
@@ -34,6 +36,7 @@ import org.apache.poi.ss.util.CellRangeA
 import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.xssf.XSSFITestDataProvider;
 import org.apache.poi.xssf.XSSFTestDataSamples;
+import org.junit.Test;
 
 public class TestXSSFDataValidation extends BaseTestDataValidation {
 
@@ -41,9 +44,10 @@ public class TestXSSFDataValidation exte
         super(XSSFITestDataProvider.instance);
     }
 
+    @Test
 	public void testAddValidations() throws Exception {
-		XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("DataValidations-49244.xlsx");
-		Sheet sheet = workbook.getSheetAt(0);
+		XSSFWorkbook wb1 = XSSFTestDataSamples.openSampleWorkbook("DataValidations-49244.xlsx");
+		Sheet sheet = wb1.getSheetAt(0);
 		List<XSSFDataValidation> dataValidations = ((XSSFSheet)sheet).getDataValidations();
 		
 /**
@@ -232,9 +236,11 @@ public class TestXSSFDataValidation exte
 			}
 		}
 
-		workbook = XSSFTestDataSamples.writeOutAndReadBack(workbook);
-		Sheet sheetAt = workbook.getSheetAt(0);
+		XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb1);
+		wb1.close();
+		Sheet sheetAt = wb2.getSheetAt(0);
 		assertEquals(lastKnownNumValidations,((XSSFSheet)sheetAt).getDataValidations().size());
+		wb2.close();
 	}
 
 	protected void setOtherValidationParameters(DataValidation validation) {
@@ -247,6 +253,7 @@ public class TestXSSFDataValidation exte
 		validation.setSuppressDropDownArrow(yesNo);
 	}
 
+	@Test
     public void test53965() throws Exception {
         XSSFWorkbook wb = new XSSFWorkbook();
         try {
@@ -271,6 +278,7 @@ public class TestXSSFDataValidation exte
         }
     }
 
+	@Test
     public void testDefaultAllowBlank() throws IOException {
         XSSFWorkbook wb = new XSSFWorkbook();
         try {
@@ -286,6 +294,7 @@ public class TestXSSFDataValidation exte
         }
     }
 
+	@Test
     public void testSetAllowBlankToFalse() throws IOException {
         XSSFWorkbook wb = new XSSFWorkbook();
         try {
@@ -303,6 +312,7 @@ public class TestXSSFDataValidation exte
         }
     }
 
+	@Test
     public void testSetAllowBlankToTrue() throws IOException {
         XSSFWorkbook wb = new XSSFWorkbook();
         try {

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFName.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFName.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFName.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFName.java Sat Sep 12 18:45:07 2015
@@ -18,7 +18,11 @@
 package org.apache.poi.xssf.usermodel;
 
 import org.apache.poi.xssf.XSSFTestDataSamples;
+import org.junit.Test;
 import org.apache.poi.xssf.XSSFITestDataProvider;
+
+import static org.junit.Assert.*;
+
 import org.apache.poi.ss.usermodel.BaseTestNamedRange;
 import org.apache.poi.ss.util.CellRangeAddress;
 
@@ -32,7 +36,8 @@ public final class TestXSSFName extends
     }
 
     //TODO combine testRepeatingRowsAndColums() for HSSF and XSSF
-    public void testRepeatingRowsAndColums() {
+    @Test
+    public void testRepeatingRowsAndColums() throws Exception {
         // First test that setting RR&C for same sheet more than once only creates a
         // single  Print_Titles built-in record
         XSSFWorkbook wb = new XSSFWorkbook();
@@ -69,7 +74,8 @@ public final class TestXSSFName extends
 
         // Save and re-open
         XSSFWorkbook nwb = XSSFTestDataSamples.writeOutAndReadBack(wb);
-
+        wb.close();
+        
         assertEquals(1, nwb.getNumberOfNames());
         nr1 = nwb.getNameAt(0);
 
@@ -90,5 +96,6 @@ public final class TestXSSFName extends
 
         sheet2.setRepeatingRows(null);
         sheet2.setRepeatingColumns(null);
+        nwb.close();
     }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java Sat Sep 12 18:45:07 2015
@@ -244,7 +244,7 @@ public final class SlideShowRecordDumper
 		String rHexType = reverseHex(hexType);
 
 		// Grab the hslf.record type
-		Class c = r.getClass();
+		Class<? extends Record> c = r.getClass();
 		String cname = c.toString();
 		if(cname.startsWith("class ")) {
 			cname = cname.substring(6);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/AllEventUserModelTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/AllEventUserModelTests.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/AllEventUserModelTests.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/AllEventUserModelTests.java Sat Sep 12 18:45:07 2015
@@ -17,22 +17,18 @@
 
 package org.apache.poi.hssf.eventusermodel;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 /**
  * Collects all tests for <tt>org.apache.poi.hssf.eventusermodel</tt>.
- * 
- * @author Josh Micich
  */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TestEventWorkbookBuilder.class,
+    TestFormatTrackingHSSFListener.class,
+    TestHSSFEventFactory.class,
+    TestMissingRecordAwareHSSFListener.class
+})
 public class AllEventUserModelTests {
-	
-	public static Test suite() {
-		TestSuite result = new TestSuite(AllEventUserModelTests.class.getName());
-		result.addTestSuite(TestEventWorkbookBuilder.class);
-		result.addTestSuite(TestFormatTrackingHSSFListener.class);
-		result.addTestSuite(TestHSSFEventFactory.class);
-		result.addTestSuite(TestMissingRecordAwareHSSFListener.class);
-		return result;
-	}
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestFormatTrackingHSSFListener.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestFormatTrackingHSSFListener.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestFormatTrackingHSSFListener.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestFormatTrackingHSSFListener.java Sat Sep 12 18:45:07 2015
@@ -16,23 +16,25 @@
 ==================================================================== */
 
 package org.apache.poi.hssf.eventusermodel;
-import java.io.IOException;
-import java.io.InputStream;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.record.CellValueRecordInterface;
 import org.apache.poi.hssf.record.FormulaRecord;
 import org.apache.poi.hssf.record.NumberRecord;
 import org.apache.poi.hssf.record.Record;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.junit.Test;
 /**
  * Tests for FormatTrackingHSSFListener
  */
-public final class TestFormatTrackingHSSFListener extends TestCase {
+public final class TestFormatTrackingHSSFListener {
 	private FormatTrackingHSSFListener listener;
 	private MockHSSFListener mockListen;
 
@@ -42,16 +44,14 @@ public final class TestFormatTrackingHSS
 		listener = new FormatTrackingHSSFListener(mockListen);
 		req.addListenerForAllRecords(listener);
 		
+        File file = HSSFTestDataSamples.getSampleFile(filename);
 		HSSFEventFactory factory = new HSSFEventFactory();
-		try {
-			InputStream is = HSSFTestDataSamples.openSampleFileStream(filename);
-			POIFSFileSystem fs = new POIFSFileSystem(is);
-			factory.processWorkbookEvents(req, fs);
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
+		POIFSFileSystem fs = new POIFSFileSystem(file);
+		factory.processWorkbookEvents(req, fs);
+		fs.close();
 	} 
 	
+	@Test
 	public void testFormats() throws Exception {
 		processFile("MissingBits.xls");
 
@@ -68,6 +68,7 @@ public final class TestFormatTrackingHSS
 	 *  exceptions thrown, but in future we might also
 	 *  want to check the exact strings!
 	 */
+	@Test
 	public void testTurnToString() throws Exception {
 		String[] files = new String[] { 
 				"45365.xls", "45365-2.xls", "MissingBits.xls" 
@@ -81,8 +82,7 @@ public final class TestFormatTrackingHSS
 			
 			// Now check we can turn all the numeric
 			//  cells into strings without error
-			for(int i=0; i<mockListen._records.size(); i++) {
-				Record r = (Record)mockListen._records.get(i);
+			for(Record r : mockListen._records) {
 				CellValueRecordInterface cvr = null;
 				
 				if(r instanceof NumberRecord) {
@@ -106,7 +106,7 @@ public final class TestFormatTrackingHSS
 	
 	private static final class MockHSSFListener implements HSSFListener {
 		public MockHSSFListener() {}
-		private final List _records = new ArrayList();
+		private final List<Record> _records = new ArrayList<Record>();
 
 		public void processRecord(Record record) {
 			_records.add(record);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTDeserializer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTDeserializer.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTDeserializer.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/TestSSTDeserializer.java Sat Sep 12 18:45:07 2015
@@ -17,21 +17,23 @@
 
 package org.apache.poi.hssf.record;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.IOException;
 import java.io.InputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.hssf.record.common.UnicodeString;
 import org.apache.poi.util.HexRead;
 import org.apache.poi.util.IntMapper;
+import org.junit.Test;
 
 /**
  * Exercise the SSTDeserializer class.
  *
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public final class TestSSTDeserializer extends TestCase {
+public final class TestSSTDeserializer {
 	private static final int FAKE_SID = -5555;
 
     private static byte[] concat(byte[] a, byte[] b) {
@@ -41,36 +43,36 @@ public final class TestSSTDeserializer e
         return result;
     }
     
-    private static byte[] readSampleHexData(String sampleFileName, String sectionName, int recSid) {
+    private static byte[] readSampleHexData(String sampleFileName, String sectionName, int recSid)
+    throws IOException {
         InputStream is = HSSFTestDataSamples.openSampleFileStream(sampleFileName);
-        byte[] data;
-        try {
-			data = HexRead.readData(is, sectionName);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-        return TestcaseRecordInputStream.mergeDataAndSid(recSid, data.length, data);
+        byte[] data = HexRead.readData(is, sectionName);
+        byte[] result = TestcaseRecordInputStream.mergeDataAndSid(recSid, data.length, data);
+        is.close();
+        return result;
     }
 
-    public void testSpanRichTextToPlainText() {
+    @Test
+    public void testSpanRichTextToPlainText() throws IOException {
         byte[] header = readSampleHexData("richtextdata.txt", "header", FAKE_SID);
         byte[] continueBytes = readSampleHexData("richtextdata.txt", "continue1", ContinueRecord.sid);
         RecordInputStream in = TestcaseRecordInputStream.create(concat(header, continueBytes));
       
 
-        IntMapper strings = new IntMapper();
+        IntMapper<UnicodeString> strings = new IntMapper<UnicodeString>();
         SSTDeserializer deserializer = new SSTDeserializer( strings );
         deserializer.manufactureStrings(1, in );
 
         assertEquals( "At a dinner party orAt At At ", strings.get( 0 ) + "" );
     }
 
-    public void testContinuationWithNoOverlap() {
+    @Test
+    public void testContinuationWithNoOverlap() throws IOException {
         byte[] header = readSampleHexData("evencontinuation.txt", "header", FAKE_SID);
         byte[] continueBytes = readSampleHexData("evencontinuation.txt", "continue1", ContinueRecord.sid);
         RecordInputStream in = TestcaseRecordInputStream.create(concat(header, continueBytes));
 
-        IntMapper strings = new IntMapper();
+        IntMapper<UnicodeString> strings = new IntMapper<UnicodeString>();
         SSTDeserializer deserializer = new SSTDeserializer( strings );
         deserializer.manufactureStrings( 2, in);
 
@@ -81,14 +83,15 @@ public final class TestSSTDeserializer e
     /**
      * Strings can actually span across more than one continuation.
      */
-    public void testStringAcross2Continuations() {
+    @Test
+    public void testStringAcross2Continuations() throws IOException {
         byte[] header = readSampleHexData("stringacross2continuations.txt", "header", FAKE_SID);
         byte[] continue1 = readSampleHexData("stringacross2continuations.txt", "continue1", ContinueRecord.sid);
         byte[] continue2 = readSampleHexData("stringacross2continuations.txt", "continue2", ContinueRecord.sid);
         
         RecordInputStream in = TestcaseRecordInputStream.create(concat(header, concat(continue1, continue2)));
 
-        IntMapper strings = new IntMapper();
+        IntMapper<UnicodeString> strings = new IntMapper<UnicodeString>();
         SSTDeserializer deserializer = new SSTDeserializer( strings );
         deserializer.manufactureStrings( 2, in);
 
@@ -96,12 +99,13 @@ public final class TestSSTDeserializer e
         assertEquals( "At a dinner partyAt a dinner party", strings.get( 1 ) + "" );
     }
 
-    public void testExtendedStrings() {
+    @Test
+    public void testExtendedStrings() throws IOException {
         byte[] header = readSampleHexData("extendedtextstrings.txt", "rich-header", FAKE_SID);
         byte[] continueBytes = readSampleHexData("extendedtextstrings.txt", "rich-continue1", ContinueRecord.sid);
         RecordInputStream in = TestcaseRecordInputStream.create(concat(header, continueBytes));
         
-        IntMapper strings = new IntMapper();
+        IntMapper<UnicodeString> strings = new IntMapper<UnicodeString>();
         SSTDeserializer deserializer = new SSTDeserializer( strings );
         deserializer.manufactureStrings( 1, in);
 
@@ -112,7 +116,7 @@ public final class TestSSTDeserializer e
         continueBytes = readSampleHexData("extendedtextstrings.txt", "norich-continue1", ContinueRecord.sid);
         in = TestcaseRecordInputStream.create(concat(header, continueBytes));
         
-        strings = new IntMapper();
+        strings = new IntMapper<UnicodeString>();
         deserializer = new SSTDeserializer( strings );
         deserializer.manufactureStrings( 1, in);
 

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java Sat Sep 12 18:45:07 2015
@@ -17,23 +17,23 @@
 
 package org.apache.poi.hssf.record.aggregates;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
 import org.apache.poi.hssf.record.ColumnInfoRecord;
 import org.apache.poi.hssf.record.Record;
 import org.apache.poi.hssf.record.RecordBase;
 import org.apache.poi.hssf.record.aggregates.RecordAggregate.RecordVisitor;
+import org.junit.Test;
+
+import junit.framework.AssertionFailedError;
 
-/**
- * @author Glen Stampoultzis
- */
-public final class TestColumnInfoRecordsAggregate extends TestCase {
+public final class TestColumnInfoRecordsAggregate {
 
-	public void testGetRecordSize() {
+	@Test
+    public void testGetRecordSize() {
 		ColumnInfoRecordsAggregate agg = new ColumnInfoRecordsAggregate();
 		agg.insertColumn(createColInfo(1, 3));
 		agg.insertColumn(createColInfo(4, 7));
@@ -64,23 +64,22 @@ public final class TestColumnInfoRecords
 
 	private static final class CIRCollector implements RecordVisitor {
 
-		private List _list;
-		public CIRCollector() {
-			_list = new ArrayList();
-		}
+		private List<Record> _list = new ArrayList<Record>();
+
 		public void visitRecord(Record r) {
 			_list.add(r);
 		}
+
 		public static ColumnInfoRecord[] getRecords(ColumnInfoRecordsAggregate agg) {
 			CIRCollector circ = new CIRCollector();
 			agg.visitContainedRecords(circ);
-			List list = circ._list;
-			ColumnInfoRecord[] result = new ColumnInfoRecord[list.size()];
-			list.toArray(result);
+			ColumnInfoRecord[] result =
+	            circ._list.toArray(new ColumnInfoRecord[circ._list.size()]);
 			return result;
 		}
 	}
 
+	@Test
 	public void testGroupColumns_bug45639() {
 		ColumnInfoRecordsAggregate agg = new ColumnInfoRecordsAggregate();
 		agg.groupColumnRange( 7, 9, true);
@@ -102,6 +101,7 @@ public final class TestColumnInfoRecords
 	/**
 	 * Check that an inner group remains hidden
 	 */
+	@Test
 	public void testHiddenAfterExpanding() {
 		ColumnInfoRecordsAggregate agg = new ColumnInfoRecordsAggregate();
 		agg.groupColumnRange(1, 15, true);
@@ -134,6 +134,7 @@ public final class TestColumnInfoRecords
 		confirmCIR(cirs, 2, 13, 15, 1, true, false);
 		confirmCIR(cirs, 3, 16, 16, 0, false, true);
 	}
+	
 	private static void confirmCIR(ColumnInfoRecord[] cirs, int ix, int startColIx, int endColIx, int level, boolean isHidden, boolean isCollapsed) {
 		ColumnInfoRecord cir = cirs[ix];
 		assertEquals("startColIx", startColIx, cir.getFirstColumn());

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java Sat Sep 12 18:45:07 2015
@@ -17,56 +17,51 @@
 
 package org.apache.poi.hssf.record.chart;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 /**
  * Collects all tests for package <tt>org.apache.poi.hssf.record.class</tt>.
- * 
- * @author Josh Micich
  */
-public final class AllChartRecordTests {
-	
-	public static Test suite() {
-		TestSuite result = new TestSuite(AllChartRecordTests.class.getName());
-
-		result.addTestSuite(TestAreaFormatRecord.class);
-		result.addTestSuite(TestAreaRecord.class);
-		result.addTestSuite(TestAxisLineFormatRecord.class);
-		result.addTestSuite(TestAxisOptionsRecord.class);
-		result.addTestSuite(TestAxisParentRecord.class);
-		result.addTestSuite(TestAxisRecord.class);
-		result.addTestSuite(TestAxisUsedRecord.class);
-		result.addTestSuite(TestBarRecord.class);
-		result.addTestSuite(TestCategorySeriesAxisRecord.class);
-		result.addTestSuite(TestChartFormatRecord.class);
-		result.addTestSuite(TestChartRecord.class);
-		result.addTestSuite(TestChartTitleFormatRecord.class);
-		result.addTestSuite(TestDatRecord.class);
-		result.addTestSuite(TestDataFormatRecord.class);
-		result.addTestSuite(TestDefaultDataLabelTextPropertiesRecord.class);
-		result.addTestSuite(TestFontBasisRecord.class);
-		result.addTestSuite(TestFontIndexRecord.class);
-		result.addTestSuite(TestFrameRecord.class);
-		result.addTestSuite(TestLegendRecord.class);
-		result.addTestSuite(TestLineFormatRecord.class);
-		result.addTestSuite(TestLinkedDataRecord.class);
-		result.addTestSuite(TestNumberFormatIndexRecord.class);
-		result.addTestSuite(TestObjectLinkRecord.class);
-		result.addTestSuite(TestPlotAreaRecord.class);
-		result.addTestSuite(TestPlotGrowthRecord.class);
-		result.addTestSuite(TestSeriesChartGroupIndexRecord.class);
-		result.addTestSuite(TestSeriesIndexRecord.class);
-		result.addTestSuite(TestSeriesLabelsRecord.class);
-		result.addTestSuite(TestSeriesListRecord.class);
-		result.addTestSuite(TestSeriesRecord.class);
-		result.addTestSuite(TestSeriesTextRecord.class);
-		result.addTestSuite(TestSeriesToChartGroupRecord.class);
-		result.addTestSuite(TestSheetPropertiesRecord.class);
-		result.addTestSuite(TestTextRecord.class);
-		result.addTestSuite(TestTickRecord.class);
-		result.addTestSuite(TestUnitsRecord.class);
-		result.addTestSuite(TestValueRangeRecord.class);
-		return result;
-	}
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TestAreaFormatRecord.class,
+    TestAreaRecord.class,
+    TestAxisLineFormatRecord.class,
+    TestAxisOptionsRecord.class,
+    TestAxisParentRecord.class,
+    TestAxisRecord.class,
+    TestAxisUsedRecord.class,
+    TestBarRecord.class,
+    TestCategorySeriesAxisRecord.class,
+    TestChartFormatRecord.class,
+    TestChartRecord.class,
+    TestChartTitleFormatRecord.class,
+    TestDatRecord.class,
+    TestDataFormatRecord.class,
+    TestDefaultDataLabelTextPropertiesRecord.class,
+    TestFontBasisRecord.class,
+    TestFontIndexRecord.class,
+    TestFrameRecord.class,
+    TestLegendRecord.class,
+    TestLineFormatRecord.class,
+    TestLinkedDataRecord.class,
+    TestNumberFormatIndexRecord.class,
+    TestObjectLinkRecord.class,
+    TestPlotAreaRecord.class,
+    TestPlotGrowthRecord.class,
+    TestSeriesChartGroupIndexRecord.class,
+    TestSeriesIndexRecord.class,
+    TestSeriesLabelsRecord.class,
+    TestSeriesListRecord.class,
+    TestSeriesRecord.class,
+    TestSeriesTextRecord.class,
+    TestSeriesToChartGroupRecord.class,
+    TestSheetPropertiesRecord.class,
+    TestTextRecord.class,
+    TestTickRecord.class,
+    TestUnitsRecord.class,
+    TestValueRangeRecord.class
+})
+public class AllChartRecordTests {
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestChartTitleFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestChartTitleFormatRecord.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestChartTitleFormatRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestChartTitleFormatRecord.java Sat Sep 12 18:45:07 2015
@@ -17,27 +17,27 @@
 
 package org.apache.poi.hssf.record.chart;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.eventusermodel.HSSFEventFactory;
 import org.apache.poi.hssf.eventusermodel.HSSFListener;
 import org.apache.poi.hssf.eventusermodel.HSSFRequest;
 import org.apache.poi.hssf.record.Record;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-/**
- * 
- */
-public final class TestChartTitleFormatRecord extends TestCase {
-
-	public void testRecord() throws Exception {
-		POIFSFileSystem fs = new POIFSFileSystem(
-				HSSFTestDataSamples.openSampleFileStream("WithFormattedGraphTitle.xls"));
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.junit.Test;
+
+public final class TestChartTitleFormatRecord {
+
+	@Test
+    public void testRecord() throws Exception {
+		NPOIFSFileSystem fs = new NPOIFSFileSystem(
+				HSSFTestDataSamples.getSampleFile("WithFormattedGraphTitle.xls"));
 		
 		// Check we can open the file via usermodel
 		HSSFWorkbook hssf = new HSSFWorkbook(fs);
@@ -55,23 +55,24 @@ public final class TestChartTitleFormatR
 		// Should've found one
 		assertEquals(1, grabber.chartTitleFormatRecords.size());
 		// And it should be of something interesting
-		ChartTitleFormatRecord r =
-			(ChartTitleFormatRecord)grabber.chartTitleFormatRecords.get(0);
+		ChartTitleFormatRecord r = grabber.chartTitleFormatRecords.get(0);
 		assertEquals(3, r.getFormatCount());
+		
+		hssf.close();
+		fs.close();
+		
 	}
 	
 	private static final class ChartTitleFormatRecordGrabber implements HSSFListener {
-		private final List chartTitleFormatRecords;
+		private final List<ChartTitleFormatRecord> chartTitleFormatRecords;
 		
 		public ChartTitleFormatRecordGrabber() {
-			chartTitleFormatRecords = new ArrayList();
+			chartTitleFormatRecords = new ArrayList<ChartTitleFormatRecord>();
 		}
 
 		public void processRecord(Record record) {
 			if(record instanceof ChartTitleFormatRecord) {
-				chartTitleFormatRecords.add(
-						record
-				);
+				chartTitleFormatRecords.add((ChartTitleFormatRecord)record);
 			}
 		}
 		

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java Sat Sep 12 18:45:07 2015
@@ -19,27 +19,75 @@
 
 package org.apache.poi.hssf.usermodel;
 
-import junit.framework.Assert;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
 import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.model.InternalWorkbook;
-import org.apache.poi.hssf.record.*;
+import org.apache.poi.hssf.record.BOFRecord;
+import org.apache.poi.hssf.record.BackupRecord;
+import org.apache.poi.hssf.record.BookBoolRecord;
+import org.apache.poi.hssf.record.BoundSheetRecord;
+import org.apache.poi.hssf.record.CalcModeRecord;
+import org.apache.poi.hssf.record.CodepageRecord;
+import org.apache.poi.hssf.record.CountryRecord;
+import org.apache.poi.hssf.record.DSFRecord;
+import org.apache.poi.hssf.record.DateWindow1904Record;
+import org.apache.poi.hssf.record.DefaultColWidthRecord;
+import org.apache.poi.hssf.record.DefaultRowHeightRecord;
+import org.apache.poi.hssf.record.DeltaRecord;
+import org.apache.poi.hssf.record.DimensionsRecord;
+import org.apache.poi.hssf.record.EOFRecord;
+import org.apache.poi.hssf.record.ExtSSTRecord;
+import org.apache.poi.hssf.record.ExtendedFormatRecord;
+import org.apache.poi.hssf.record.ExternSheetRecord;
+import org.apache.poi.hssf.record.FnGroupCountRecord;
+import org.apache.poi.hssf.record.FontRecord;
+import org.apache.poi.hssf.record.FormatRecord;
+import org.apache.poi.hssf.record.GridsetRecord;
+import org.apache.poi.hssf.record.GutsRecord;
+import org.apache.poi.hssf.record.HideObjRecord;
+import org.apache.poi.hssf.record.InterfaceEndRecord;
+import org.apache.poi.hssf.record.InterfaceHdrRecord;
+import org.apache.poi.hssf.record.IterationRecord;
+import org.apache.poi.hssf.record.MMSRecord;
+import org.apache.poi.hssf.record.NameRecord;
+import org.apache.poi.hssf.record.PasswordRev4Record;
+import org.apache.poi.hssf.record.PrecisionRecord;
+import org.apache.poi.hssf.record.PrintGridlinesRecord;
+import org.apache.poi.hssf.record.PrintHeadersRecord;
+import org.apache.poi.hssf.record.ProtectRecord;
+import org.apache.poi.hssf.record.Record;
+import org.apache.poi.hssf.record.RecordBase;
+import org.apache.poi.hssf.record.RefModeRecord;
+import org.apache.poi.hssf.record.RefreshAllRecord;
+import org.apache.poi.hssf.record.SSTRecord;
+import org.apache.poi.hssf.record.SaveRecalcRecord;
+import org.apache.poi.hssf.record.SelectionRecord;
+import org.apache.poi.hssf.record.StyleRecord;
+import org.apache.poi.hssf.record.SupBookRecord;
+import org.apache.poi.hssf.record.TabIdRecord;
+import org.apache.poi.hssf.record.UseSelFSRecord;
+import org.apache.poi.hssf.record.WSBoolRecord;
+import org.apache.poi.hssf.record.WindowOneRecord;
+import org.apache.poi.hssf.record.WindowProtectRecord;
+import org.apache.poi.hssf.record.WindowTwoRecord;
+import org.apache.poi.hssf.record.WriteAccessRecord;
 import org.apache.poi.hssf.record.aggregates.PageSettingsBlock;
 
-import java.util.List;
-
 /**
  * Designed to check wither the records written actually make sense.
  */
-public class SanityChecker
-        extends Assert
-{
+public class SanityChecker {
     static class CheckRecord
     {
-        Class record;
+        Class<? extends RecordBase> record;
         char occurance;  // 1 = one time, M = 1..many times, * = 0..many, 0 = optional
         private boolean together;
 
-        public CheckRecord( Class record, char occurance )
+        public CheckRecord( Class<? extends RecordBase> record, char occurance )
         {
             this(record, occurance, true);
         }
@@ -49,14 +97,14 @@ public class SanityChecker
          * @param occurance     The occurance 1 = occurs once, M = occurs many times
          * @param together
          */
-        public CheckRecord(Class record, char occurance, boolean together)
+        public CheckRecord(Class<? extends RecordBase> record, char occurance, boolean together)
         {
             this.record = record;
             this.occurance = occurance;
             this.together = together;
         }
 
-        public Class getRecord()
+        public Class<? extends RecordBase> getRecord()
         {
             return record;
         }
@@ -86,7 +134,7 @@ public class SanityChecker
             return occurance == '*' || occurance == 'M';
         }
 
-        public int match( List records, int recordIdx )
+        public int match( List<? extends RecordBase> records, int recordIdx )
         {
             int firstRecord = findFirstRecord(records, getRecord(), recordIdx);
             if (isRequired())
@@ -96,7 +144,7 @@ public class SanityChecker
             return matchOptional( firstRecord, records, recordIdx );
         }
 
-        private int matchOptional( int firstRecord, List records, int recordIdx )
+        private int matchOptional( int firstRecord, List<? extends RecordBase> records, int recordIdx )
         {
             if (firstRecord == -1)
             {
@@ -106,7 +154,7 @@ public class SanityChecker
             return matchOneOrMany( records, firstRecord );
         }
 
-        private int matchRequired( int firstRecord, List records, int recordIdx )
+        private int matchRequired( int firstRecord, List<? extends RecordBase> records, int recordIdx )
         {
             if (firstRecord == -1)
             {
@@ -116,7 +164,7 @@ public class SanityChecker
             return matchOneOrMany( records, firstRecord );
         }
 
-        private int matchOneOrMany( List records, int recordIdx )
+        private int matchOneOrMany( List<? extends RecordBase> records, int recordIdx )
         {
             if (isZeroOrOne())
             {
@@ -210,7 +258,7 @@ public class SanityChecker
 
     private void checkWorkbookRecords(InternalWorkbook workbook)
     {
-        List records = workbook.getRecords();
+        List<Record> records = workbook.getRecords();
         assertTrue(records.get(0) instanceof BOFRecord);
         assertTrue(records.get(records.size() - 1) instanceof EOFRecord);
 
@@ -219,7 +267,7 @@ public class SanityChecker
     }
 
     private void checkSheetRecords(InternalSheet sheet) {
-        List records = sheet.getRecords();
+        List<RecordBase> records = sheet.getRecords();
         assertTrue(records.get(0) instanceof BOFRecord);
         assertTrue(records.get(records.size() - 1) instanceof EOFRecord);
 
@@ -266,7 +314,7 @@ public class SanityChecker
         }
     } */
 
-    /* package */ static int findFirstRecord( List records, Class record, int startIndex )
+    /* package */ static int findFirstRecord( List<? extends RecordBase> records, Class<? extends RecordBase> record, int startIndex )
     {
         for (int i = startIndex; i < records.size(); i++)
         {
@@ -276,7 +324,7 @@ public class SanityChecker
         return -1;
     }
 
-    void checkRecordOrder(List records, CheckRecord[] check)
+    void checkRecordOrder(List<? extends RecordBase> records, CheckRecord[] check)
     {
         int recordIdx = 0;
         for ( int checkIdx = 0; checkIdx < check.length; checkIdx++ )

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java Sat Sep 12 18:45:07 2015
@@ -17,29 +17,37 @@
 
 package org.apache.poi.hssf.usermodel;
 
-import java.util.Iterator;
+import static org.junit.Assert.assertNotNull;
 
-import junit.framework.TestCase;
+import java.util.Iterator;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.record.FormulaRecord;
 import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate;
-import org.apache.poi.ss.formula.ptg.Ptg;
 import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.ss.formula.ptg.Ptg;
+import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellValue;
+import org.apache.poi.ss.usermodel.Row;
+import org.junit.Test;
 
 /**
  *
  */
-public final class TestBug42464 extends TestCase {
+public final class TestBug42464 {
 
-	public void testOKFile() {
+    @Test
+	public void testOKFile() throws Exception {
 		HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("42464-ExpPtg-ok.xls");
 		process(wb);
+		wb.close();
 	}
-	public void testExpSharedBadFile() {
+    
+    @Test
+	public void testExpSharedBadFile() throws Exception {
 		HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("42464-ExpPtg-bad.xls");
 		process(wb);
+		wb.close();
 	}
 
 	private static void process(HSSFWorkbook wb) {
@@ -47,7 +55,7 @@ public final class TestBug42464 extends
 		for(int i=0; i<wb.getNumberOfSheets(); i++) {
 			HSSFSheet s = wb.getSheetAt(i);
 
-			Iterator it = s.rowIterator();
+			Iterator<Row> it = s.rowIterator();
 			while(it.hasNext()) {
 				HSSFRow r = (HSSFRow)it.next();
 				process(r, eval);
@@ -56,7 +64,7 @@ public final class TestBug42464 extends
 	}
 
 	private static void process(HSSFRow row, HSSFFormulaEvaluator eval) {
-		Iterator it = row.cellIterator();
+		Iterator<Cell> it = row.cellIterator();
 		while(it.hasNext()) {
 			HSSFCell cell = (HSSFCell)it.next();
 			if(cell.getCellType() != HSSFCell.CELL_TYPE_FORMULA) {
@@ -67,15 +75,15 @@ public final class TestBug42464 extends
 			Ptg[] ptgs = r.getParsedExpression();
 
 			String cellRef = new CellReference(row.getRowNum(), cell.getColumnIndex(), false, false).formatAsString();
-			if(false && cellRef.equals("BP24")) { // TODO - replace System.out.println()s with asserts
-				System.out.print(cellRef);
-				System.out.println(" - has " + ptgs.length + " ptgs:");
-				for(int i=0; i<ptgs.length; i++) {
-					String c = ptgs[i].getClass().toString();
-					System.out.println("\t" + c.substring(c.lastIndexOf('.')+1) );
-				}
-				System.out.println("-> " + cell.getCellFormula());
-			}
+//			if(false && cellRef.equals("BP24")) { // TODO - replace System.out.println()s with asserts
+//				System.out.print(cellRef);
+//				System.out.println(" - has " + ptgs.length + " ptgs:");
+//				for(int i=0; i<ptgs.length; i++) {
+//					String c = ptgs[i].getClass().toString();
+//					System.out.println("\t" + c.substring(c.lastIndexOf('.')+1) );
+//				}
+//				System.out.println("-> " + cell.getCellFormula());
+//			}
 
 			CellValue evalResult = eval.evaluate(cell);
 			assertNotNull(evalResult);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java?rev=1702659&r1=1702658&r2=1702659&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java Sat Sep 12 18:45:07 2015
@@ -17,26 +17,23 @@
 
 package org.apache.poi.hssf.usermodel;
 
-import java.io.ByteArrayInputStream;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.PrintStream;
 import java.util.List;
 
-import junit.framework.AssertionFailedError;
-
 import org.apache.poi.hssf.HSSFITestDataProvider;
 import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.hssf.eventmodel.ERFListener;
-import org.apache.poi.hssf.eventmodel.EventRecordFactory;
 import org.apache.poi.hssf.record.DVRecord;
-import org.apache.poi.hssf.record.RecordFormatException;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.ss.usermodel.BaseTestDataValidation;
 import org.apache.poi.ss.usermodel.DataValidation;
+import org.apache.poi.ss.usermodel.DataValidation.ErrorStyle;
 import org.apache.poi.ss.usermodel.DataValidationConstraint;
 import org.apache.poi.ss.usermodel.DataValidationConstraint.OperatorType;
 import org.apache.poi.ss.usermodel.DataValidationConstraint.ValidationType;
@@ -45,10 +42,8 @@ import org.apache.poi.ss.usermodel.DateU
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.ss.util.CellRangeAddress;
-import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.ss.usermodel.DataValidation.ErrorStyle;
-import org.apache.poi.ss.usermodel.DataValidationConstraint.OperatorType;
 import org.apache.poi.ss.util.CellRangeAddressList;
+import org.junit.Test;
 
 /**
  * Class for testing Excel's data validation mechanism
@@ -73,11 +68,11 @@ public final class TestDataValidation ex
 		}
 		byte[] generatedContent = baos.toByteArray();
 		boolean isSame;
-		if (false) {
-			// TODO - add proof spreadsheet and compare
-			InputStream proofStream = HSSFTestDataSamples.openSampleFileStream("TestDataValidation.xls");
-			isSame = compareStreams(proofStream, generatedContent);
-		}
+//		if (false) {
+//			// TODO - add proof spreadsheet and compare
+//			InputStream proofStream = HSSFTestDataSamples.openSampleFileStream("TestDataValidation.xls");
+//			isSame = compareStreams(proofStream, generatedContent);
+//		}
 		isSame = true;
 		
 		if (isSame) {
@@ -112,37 +107,38 @@ public final class TestDataValidation ex
 		
 	}
 	
-	private static boolean compareStreams(InputStream isA, byte[] generatedContent) {
-
-		InputStream isB = new ByteArrayInputStream(generatedContent);
-
-		// The allowable regions where the generated file can differ from the 
-		// proof should be small (i.e. much less than 1K)
-		int[] allowableDifferenceRegions = { 
-				0x0228, 16,  // a region of the file containing the OS username
-				0x506C, 8,   // See RootProperty (super fields _seconds_2 and _days_2)
-		};
-		int[] diffs = StreamUtility.diffStreams(isA, isB, allowableDifferenceRegions);
-		if (diffs == null) {
-			return true;
-		}
-		System.err.println("Diff from proof: ");
-		for (int i = 0; i < diffs.length; i++) {
-			System.err.println("diff at offset: 0x" + Integer.toHexString(diffs[i]));
-		}
-		return false;
-	}
+//	private static boolean compareStreams(InputStream isA, byte[] generatedContent) {
+//
+//		InputStream isB = new ByteArrayInputStream(generatedContent);
+//
+//		// The allowable regions where the generated file can differ from the 
+//		// proof should be small (i.e. much less than 1K)
+//		int[] allowableDifferenceRegions = { 
+//				0x0228, 16,  // a region of the file containing the OS username
+//				0x506C, 8,   // See RootProperty (super fields _seconds_2 and _days_2)
+//		};
+//		int[] diffs = StreamUtility.diffStreams(isA, isB, allowableDifferenceRegions);
+//		if (diffs == null) {
+//			return true;
+//		}
+//		System.err.println("Diff from proof: ");
+//		for (int i = 0; i < diffs.length; i++) {
+//			System.err.println("diff at offset: 0x" + Integer.toHexString(diffs[i]));
+//		}
+//		return false;
+//	}
   
 
 
 
 
-  /* package */ static void setCellValue(HSSFCell cell, String text) {
+    /* package */ static void setCellValue(HSSFCell cell, String text) {
 	  cell.setCellValue(new HSSFRichTextString(text));
 	  
-  }
+    }
   
-	public void testAddToExistingSheet() {
+	@Test
+    public void testAddToExistingSheet() throws Exception {
 
 		// dvEmpty.xls is a simple one sheet workbook.  With a DataValidations header record but no 
 		// DataValidations.  It's important that the example has one SHEETPROTECTION record.
@@ -164,27 +160,23 @@ public final class TestDataValidation ex
 		sheet.addValidationData(dv);
 		
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		try {
-			wb.write(baos);
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
+		wb.write(baos);
 		
 		byte[] wbData = baos.toByteArray();
 		
-		if (false) { // TODO (Jul 2008) fix EventRecordFactory to process unknown records, (and DV records for that matter)
-
-			ERFListener erfListener = null; // new MyERFListener();
-			EventRecordFactory erf = new EventRecordFactory(erfListener, null);
-			try {
-				POIFSFileSystem fs = new POIFSFileSystem(new ByteArrayInputStream(baos.toByteArray()));
-				erf.processRecords(fs.createDocumentInputStream("Workbook"));
-			} catch (RecordFormatException e) {
-				throw new RuntimeException(e);
-			} catch (IOException e) {
-				throw new RuntimeException(e);
-			}
-		}
+//		if (false) { // TODO (Jul 2008) fix EventRecordFactory to process unknown records, (and DV records for that matter)
+//
+//			ERFListener erfListener = null; // new MyERFListener();
+//			EventRecordFactory erf = new EventRecordFactory(erfListener, null);
+//			try {
+//				POIFSFileSystem fs = new POIFSFileSystem(new ByteArrayInputStream(baos.toByteArray()));
+//				erf.processRecords(fs.createDocumentInputStream("Workbook"));
+//			} catch (RecordFormatException e) {
+//				throw new RuntimeException(e);
+//			} catch (IOException e) {
+//				throw new RuntimeException(e);
+//			}
+//		}
 		// else verify record ordering by navigating the raw bytes
 		
 		byte[] dvHeaderRecStart= { (byte)0xB2, 0x01, 0x12, 0x00, };
@@ -199,10 +191,13 @@ public final class TestDataValidation ex
 		// and the DV records, Excel will not be able to open the workbook without error.
 		
 		if (nextSid == 0x0867) {
-			throw new AssertionFailedError("Identified bug 45519");
+			fail("Identified bug 45519");
 		}
 		assertEquals(DVRecord.sid, nextSid);
+		
+		wb.close();
 	}
+	
 	private int findIndex(byte[] largeData, byte[] searchPattern) {
 		byte firstByte = searchPattern[0];
 		for (int i = 0; i < largeData.length; i++) {
@@ -223,7 +218,8 @@ public final class TestDataValidation ex
 		return -1;
 	}
 
-    public void testGetDataValidationsAny() {
+	@Test
+    public void testGetDataValidationsAny() throws Exception {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet = wb.createSheet();
         List<HSSFDataValidation> list = sheet.getDataValidations();
@@ -265,9 +261,12 @@ public final class TestDataValidation ex
         DataValidationConstraint c = dv.getValidationConstraint();
         assertEquals(ValidationType.ANY, c.getValidationType());
         assertEquals(OperatorType.IGNORED, c.getOperator());
+        
+        wb.close();
     }
 
-    public void testGetDataValidationsIntegerFormula() {
+	@Test
+    public void testGetDataValidationsIntegerFormula() throws Exception {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet = wb.createSheet();
         List<HSSFDataValidation> list = sheet.getDataValidations();
@@ -291,9 +290,12 @@ public final class TestDataValidation ex
         assertEquals("A3", c.getFormula2());
         assertEquals(null, c.getValue1());
         assertEquals(null, c.getValue2());
+        
+        wb.close();
     }
 
-    public void testGetDataValidationsIntegerValue() {
+	@Test
+    public void testGetDataValidationsIntegerValue() throws Exception {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet = wb.createSheet();
         List<HSSFDataValidation> list = sheet.getDataValidations();
@@ -317,9 +319,12 @@ public final class TestDataValidation ex
         assertEquals(null, c.getFormula2());
         assertEquals(new Double("100"), c.getValue1());
         assertEquals(new Double("200"), c.getValue2());
+        
+        wb.close();
     }
 
-    public void testGetDataValidationsDecimal() {
+	@Test
+    public void testGetDataValidationsDecimal() throws Exception {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet = wb.createSheet();
         List<HSSFDataValidation> list = sheet.getDataValidations();
@@ -343,9 +348,12 @@ public final class TestDataValidation ex
         assertEquals(null, c.getFormula2());
         assertEquals(null, c.getValue1());
         assertEquals(new Double("200"), c.getValue2());
+        
+        wb.close();
     }
 
-    public void testGetDataValidationsDate() {
+	@Test
+    public void testGetDataValidationsDate() throws Exception {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet = wb.createSheet();
         List<HSSFDataValidation> list = sheet.getDataValidations();
@@ -367,11 +375,14 @@ public final class TestDataValidation ex
         assertEquals(OperatorType.EQUAL, c.getOperator());
         assertEquals(null, c.getFormula1());
         assertEquals(null, c.getFormula2());
-        assertEquals(DateUtil.getExcelDate(DateUtil.parseYYYYMMDDDate("2014/10/25")), c.getValue1());
+        assertEquals(DateUtil.getExcelDate(DateUtil.parseYYYYMMDDDate("2014/10/25")), c.getValue1(), 0);
         assertEquals(null, c.getValue2());
+        
+        wb.close();
     }
 
-    public void testGetDataValidationsListExplicit() {
+	@Test
+    public void testGetDataValidationsListExplicit() throws Exception {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet = wb.createSheet();
         List<HSSFDataValidation> list = sheet.getDataValidations();
@@ -402,9 +413,12 @@ public final class TestDataValidation ex
         assertEquals("aaa", values[0]);
         assertEquals("bbb", values[1]);
         assertEquals("ccc", values[2]);
+        
+        wb.close();
     }
 
-    public void testGetDataValidationsListFormula() {
+	@Test
+    public void testGetDataValidationsListFormula() throws Exception {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet = wb.createSheet();
         List<HSSFDataValidation> list = sheet.getDataValidations();
@@ -429,9 +443,12 @@ public final class TestDataValidation ex
         assertEquals(null, c.getFormula2());
         assertEquals(null, c.getValue1());
         assertEquals(null, c.getValue2());
+        
+        wb.close();
     }
 
-    public void testGetDataValidationsFormula() {
+	@Test
+    public void testGetDataValidationsFormula() throws Exception {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet = wb.createSheet();
         List<HSSFDataValidation> list = sheet.getDataValidations();
@@ -453,5 +470,6 @@ public final class TestDataValidation ex
         assertEquals(null, c.getFormula2());
         assertEquals(null, c.getValue1());
         assertEquals(null, c.getValue2());
+        wb.close();
     }
 }



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


Mime
View raw message