delegate creation of tested class to a factory so that the derived class
SynchronizedDescriptiveStatisticsTest can override it and ... really test SynchronizedDescriptiveStatistics git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@796003 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7b6cd406a2
commit
be3c1e1170
|
@ -38,8 +38,12 @@ public class DescriptiveStatisticsTest extends TestCase {
|
|||
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 class DescriptiveStatisticsTest extends TestCase {
|
|||
}
|
||||
|
||||
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 class DescriptiveStatisticsTest extends TestCase {
|
|||
}
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue