Modified tests to reflect changes addressing PR #25972.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141052 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e8098d425e
commit
d0ac3d2a5f
|
@ -65,13 +65,14 @@ import org.apache.commons.math.stat.StorelessDescriptiveStatisticsImpl;
|
|||
/**
|
||||
* Test cases for the EmpiricalDistribution class
|
||||
*
|
||||
* @version $Revision: 1.7 $ $Date: 2003/11/15 16:01:40 $
|
||||
* @version $Revision: 1.8 $ $Date: 2004/01/11 07:26:51 $
|
||||
*/
|
||||
|
||||
public final class EmpiricalDistributionTest extends TestCase {
|
||||
|
||||
private EmpiricalDistribution empiricalDistribution = null;
|
||||
private File file = null;
|
||||
protected EmpiricalDistribution empiricalDistribution = null;
|
||||
protected File file = null;
|
||||
protected URL url = null;
|
||||
|
||||
public EmpiricalDistributionTest(String name) {
|
||||
super(name);
|
||||
|
@ -79,7 +80,7 @@ public final class EmpiricalDistributionTest extends TestCase {
|
|||
|
||||
public void setUp() {
|
||||
empiricalDistribution = new EmpiricalDistributionImpl(100);
|
||||
URL url = getClass().getResource("testData.txt");
|
||||
url = getClass().getResource("testData.txt");
|
||||
file = new File(url.getFile());
|
||||
}
|
||||
|
||||
|
@ -95,7 +96,7 @@ public final class EmpiricalDistributionTest extends TestCase {
|
|||
* the sample data file.
|
||||
*/
|
||||
public void testLoad() throws Exception {
|
||||
empiricalDistribution.load(file);
|
||||
empiricalDistribution.load(url);
|
||||
// testData File has 10000 values, with mean ~ 5.0, std dev ~ 1
|
||||
// Make sure that loaded distribution matches this
|
||||
assertEquals(empiricalDistribution.getSampleStats().getN(),1000,10E-7);
|
||||
|
@ -156,8 +157,5 @@ public final class EmpiricalDistributionTest extends TestCase {
|
|||
assertEquals
|
||||
("std dev", stats.getStandardDeviation(),1.0173699343977738,tolerance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ import org.apache.commons.math.stat.StorelessDescriptiveStatisticsImpl;
|
|||
/**
|
||||
* Test cases for the ValueServer class.
|
||||
*
|
||||
* @version $Revision: 1.8 $ $Date: 2003/11/15 16:01:40 $
|
||||
* @version $Revision: 1.9 $ $Date: 2004/01/11 07:26:51 $
|
||||
*/
|
||||
|
||||
public final class ValueServerTest extends TestCase {
|
||||
|
@ -79,7 +79,7 @@ public final class ValueServerTest extends TestCase {
|
|||
vs.setMode(ValueServer.DIGEST_MODE);
|
||||
try {
|
||||
URL url = getClass().getResource("testData.txt");
|
||||
vs.setValuesFileURL(url.toExternalForm());
|
||||
vs.setValuesFileURL(url);
|
||||
} catch (Exception ex) {
|
||||
fail("malformed test URL");
|
||||
}
|
||||
|
@ -137,18 +137,6 @@ public final class ValueServerTest extends TestCase {
|
|||
} catch (IllegalStateException ex) {;}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure exception thrown if nextReplay() is attempted
|
||||
* before opening replay file.
|
||||
*/
|
||||
public void testNextReplayFail() throws Exception {
|
||||
try {
|
||||
vs.setMode(ValueServer.REPLAY_MODE);
|
||||
vs.getNext();
|
||||
fail("Expecting IllegalStateException");
|
||||
} catch (IllegalStateException ex) {;}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ValueServer REPLAY_MODE using values in testData file.<br>
|
||||
* Check that the values 1,2,1001,1002 match data file values 1 and 2.
|
||||
|
@ -229,13 +217,8 @@ public final class ValueServerTest extends TestCase {
|
|||
vs.setMode(ValueServer.CONSTANT_MODE);
|
||||
assertEquals("mode test",ValueServer.CONSTANT_MODE,vs.getMode());
|
||||
vs.setValuesFileURL("http://www.apache.org");
|
||||
String s = vs.getValuesFileURL();
|
||||
assertEquals("valuesFileURL test","http://www.apache.org",s);
|
||||
URL url = vs.getValuesFileURL();
|
||||
assertEquals("valuesFileURL test","http://www.apache.org",url.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue