commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r796003 - /commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java
Date Mon, 20 Jul 2009 20:51:56 GMT
Author: luc
Date: Mon Jul 20 20:51:56 2009
New Revision: 796003

URL: http://svn.apache.org/viewvc?rev=796003&view=rev
Log:
delegate creation of tested class to a factory so that the derived class
SynchronizedDescriptiveStatisticsTest can override it and ... really test
SynchronizedDescriptiveStatistics

Modified:
    commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java?rev=796003&r1=796002&r2=796003&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java
Mon Jul 20 20:51:56 2009
@@ -37,9 +37,13 @@
         suite.setName("DescriptiveStatistics Tests");
         return suite;
     }
-    
+
+    protected DescriptiveStatistics createDescriptiveStatistics() {
+        return new DescriptiveStatistics();
+    }
+
     public void testSetterInjection() throws Exception {
-        DescriptiveStatistics stats = new DescriptiveStatistics();
+        DescriptiveStatistics stats = createDescriptiveStatistics();
         stats.addValue(1);
         stats.addValue(3);
         assertEquals(2, stats.getMean(), 1E-10);
@@ -49,7 +53,7 @@
     }
     
     public void testPercentileSetter() throws Exception {
-        DescriptiveStatistics stats = new DescriptiveStatistics();
+        DescriptiveStatistics stats = createDescriptiveStatistics();
         stats.addValue(1);
         stats.addValue(2);
         stats.addValue(3);
@@ -73,7 +77,7 @@
     }
     public void testRemoval() {
 
-        final DescriptiveStatistics dstat = new DescriptiveStatistics();
+        final DescriptiveStatistics dstat = createDescriptiveStatistics();
 
         checkremoval(dstat, 1, 6.0, 0.0, Double.NaN);
         checkremoval(dstat, 3, 5.0, 3.0, 4.5);



Mime
View raw message