psteitz 2004/01/10 23:26:51
Modified: math/src/test/org/apache/commons/math/random
EmpiricalDistributionTest.java ValueServerTest.java
Log:
Modified tests to reflect changes addressing PR #25972.
Revision Changes Path
1.8 +7 -9
jakarta-commons/math/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java
Index: EmpiricalDistributionTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- EmpiricalDistributionTest.java 15 Nov 2003 16:01:40 -0000 1.7
+++ EmpiricalDistributionTest.java 11 Jan 2004 07:26:51 -0000 1.8
@@ -70,8 +70,9 @@
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 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 @@
* 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 @@
assertEquals
("std dev", stats.getStandardDeviation(),1.0173699343977738,tolerance);
}
-
-
-
-
+
}
1.9 +5 -22
jakarta-commons/math/src/test/org/apache/commons/math/random/ValueServerTest.java
Index: ValueServerTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/random/ValueServerTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ValueServerTest.java 15 Nov 2003 16:01:40 -0000 1.8
+++ ValueServerTest.java 11 Jan 2004 07:26:51 -0000 1.9
@@ -79,7 +79,7 @@
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");
}
@@ -138,18 +138,6 @@
}
/**
- * 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.
* the sample data file.
@@ -229,13 +217,8 @@
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());
}
-
-
-
-
-
-
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]