You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by to...@apache.org on 2004/05/23 02:33:41 UTC
cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate ListUnivariateImpl.java
tobrien 2004/05/22 17:33:41
Modified: math/src/test/org/apache/commons/math/distribution
GammaDistributionTest.java
ExponentialDistributionTest.java
FDistributionTest.java
math/src/test/org/apache/commons/math/util
BeanTransformerTest.java
DefaultTransformerTest.java
math/src/test/org/apache/commons/math/stat/univariate
ListUnivariateImpl.java
Log:
Got rid of a number of those pesky "Auto-generated catch block" comments from test code.
PR:
Obtained from:
Submitted by:
Reviewed by:
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.15 +1 -3 jakarta-commons/math/src/test/org/apache/commons/math/distribution/GammaDistributionTest.java
Index: GammaDistributionTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/distribution/GammaDistributionTest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- GammaDistributionTest.java 21 Feb 2004 21:35:17 -0000 1.14
+++ GammaDistributionTest.java 23 May 2004 00:33:40 -0000 1.15
@@ -52,7 +52,6 @@
.cumulativeProbability(x);
assertEquals("probability for " + x, expected, actual, 10e-4);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -66,7 +65,6 @@
.inverseCumulativeProbability(p);
assertEquals("critical value for " + p, expected, actual, 10e-4);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
1.13 +1 -4 jakarta-commons/math/src/test/org/apache/commons/math/distribution/ExponentialDistributionTest.java
Index: ExponentialDistributionTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/distribution/ExponentialDistributionTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ExponentialDistributionTest.java 21 Feb 2004 21:35:17 -0000 1.12
+++ ExponentialDistributionTest.java 23 May 2004 00:33:40 -0000 1.13
@@ -161,7 +161,6 @@
double actual = exp.cumulativeProbability(0.25, 0.75);
assertEquals(0.0905214, actual, 10e-4);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
@@ -172,7 +171,6 @@
double actual = exp.cumulativeProbability(x);
TestUtils.assertEquals(expected, actual, 10e-4);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -182,7 +180,6 @@
double actual = exp.inverseCumulativeProbability(p);
TestUtils.assertEquals(expected, actual, 10e-4);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
1.12 +1 -3 jakarta-commons/math/src/test/org/apache/commons/math/distribution/FDistributionTest.java
Index: FDistributionTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/distribution/FDistributionTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- FDistributionTest.java 21 Feb 2004 21:35:17 -0000 1.11
+++ FDistributionTest.java 23 May 2004 00:33:40 -0000 1.12
@@ -82,7 +82,6 @@
double actual = f.cumulativeProbability(x);
assertEquals("probability for " + x, expected, actual, 1e-3);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -92,7 +91,6 @@
double actual = f.inverseCumulativeProbability(p);
assertEquals("value for " + p, expected, actual, 1e-2);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
1.10 +1 -3 jakarta-commons/math/src/test/org/apache/commons/math/util/BeanTransformerTest.java
Index: BeanTransformerTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/util/BeanTransformerTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- BeanTransformerTest.java 21 Feb 2004 21:35:18 -0000 1.9
+++ BeanTransformerTest.java 23 May 2004 00:33:41 -0000 1.10
@@ -77,7 +77,6 @@
try {
value = b.transform(target);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
TestUtils.assertEquals(1.0, value, 1.0e-2);
@@ -93,7 +92,6 @@
try {
b.transform(target);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
fail("Expecting ClassCastException");
1.11 +1 -5 jakarta-commons/math/src/test/org/apache/commons/math/util/DefaultTransformerTest.java
Index: DefaultTransformerTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/util/DefaultTransformerTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DefaultTransformerTest.java 23 May 2004 00:30:01 -0000 1.10
+++ DefaultTransformerTest.java 23 May 2004 00:33:41 -0000 1.11
@@ -35,7 +35,6 @@
try {
assertEquals(expected, t.transform(input), 1.0e-4);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -63,7 +62,6 @@
try {
assertEquals(expected, t.transform(input), 1.0e-4);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -78,7 +76,6 @@
try {
assertEquals(expected, t.transform(input), 1.0e-4);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -93,7 +90,6 @@
try {
assertEquals(expected, t.transform(input), 1.0e-4);
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
1.3 +1 -2 jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/ListUnivariateImpl.java
Index: ListUnivariateImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/ListUnivariateImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ListUnivariateImpl.java 24 Apr 2004 21:41:02 -0000 1.2
+++ ListUnivariateImpl.java 23 May 2004 00:33:41 -0000 1.3
@@ -105,7 +105,6 @@
try {
value = transformer.transform(list.get(calcIndex));
} catch (MathException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate
ListUnivariateImpl.java
Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
+1
Phil Steitz wrote:
> We should also fix the "swallowing" behavior -- i.e., a test case should
> never swallow an exception and just dump a stack trace. If the test
> case throws an unexpected exception, the test should fail. I have been
> fixing these by changing the test method signature to throws Exception.
> This also eliminates the need to import MathException everywhere.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
--
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
RE: cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate ListUnivariateImpl.java
Posted by Tim O'Brien <to...@discursive.com>.
Agreed, ( but ListUnivariateImpl is somewhat of a throw-away test fixture ).
In general, I agree that tests should not swallow exceptions. I've just
commit'd a change in the same vein.
> -----Original Message-----
> From: Phil Steitz [mailto:phil@steitz.com]
> Sent: Saturday, May 22, 2004 8:41 PM
> To: Jakarta Commons Developers List
> Subject: Re: cvs commit: jakarta-
> commons/math/src/test/org/apache/commons/math/stat/univariate
> ListUnivariateImpl.java
>
> We should also fix the "swallowing" behavior -- i.e., a test case should
> never swallow an exception and just dump a stack trace. If the test case
> throws an unexpected exception, the test should fail. I have been fixing
> these by changing the test method signature to throws Exception. This
> also eliminates the need to import MathException everywhere.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate
ListUnivariateImpl.java
Posted by Phil Steitz <ph...@steitz.com>.
We should also fix the "swallowing" behavior -- i.e., a test case should
never swallow an exception and just dump a stack trace. If the test case
throws an unexpected exception, the test should fail. I have been fixing
these by changing the test method signature to throws Exception. This
also eliminates the need to import MathException everywhere.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
RE: cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate ListUnivariateImpl.java
Posted by Tim O'Brien <to...@discursive.com>.
Apologies for the nasty auto-generated CVS comments. Ick. Upgraded to a
new machine, and forgot to tweak Eclipse. It may be time to return to
Emacs....
Tim
> -----Original Message-----
> From: tobrien@apache.org [mailto:tobrien@apache.org]
> Sent: Saturday, May 22, 2004 7:34 PM
> To: jakarta-commons-cvs@apache.org
> Subject: cvs commit: jakarta-
> commons/math/src/test/org/apache/commons/math/stat/univariate
> ListUnivariateImpl.java
>
> tobrien 2004/05/22 17:33:41
>
> Modified: math/src/test/org/apache/commons/math/distribution
> GammaDistributionTest.java
> ExponentialDistributionTest.java
> FDistributionTest.java
> math/src/test/org/apache/commons/math/util
> BeanTransformerTest.java
> DefaultTransformerTest.java
> math/src/test/org/apache/commons/math/stat/univariate
> ListUnivariateImpl.java
> Log:
> Got rid of a number of those pesky "Auto-generated catch block" comments
> from test code.
> PR:
> Obtained from:
> Submitted by:
> Reviewed by:
> CVS: -------------------------------------------------------------------
> ---
> CVS: PR:
> CVS: If this change addresses a PR in the problem report tracking
> CVS: database, then enter the PR number(s) here.
> CVS: Obtained from:
> CVS: If this change has been taken from another system, such as NCSA,
> CVS: then name the system in this line, otherwise delete it.
> CVS: Submitted by:
> CVS: If this code has been contributed to Apache by someone else;
> i.e.,
> CVS: they sent us a patch or a new module, then include their
> name/email
> CVS: address here. If this is your work then delete this line.
> CVS: Reviewed by:
> CVS: If we are doing pre-commit code reviews and someone else has
> CVS: reviewed your changes, include their name(s) here.
> CVS: If you have not had it reviewed then delete this line.
>
> Revision Changes Path
> 1.15 +1 -3 jakarta-
> commons/math/src/test/org/apache/commons/math/distribution/GammaDistributi
> onTest.java
>
> Index: GammaDistributionTest.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
> commons/math/src/test/org/apache/commons/math/distribution/GammaDistributi
> onTest.java,v
> retrieving revision 1.14
> retrieving revision 1.15
> diff -u -r1.14 -r1.15
> --- GammaDistributionTest.java 21 Feb 2004 21:35:17 -0000 1.14
> +++ GammaDistributionTest.java 23 May 2004 00:33:40 -0000 1.15
> @@ -52,7 +52,6 @@
> .cumulativeProbability(x);
> assertEquals("probability for " + x, expected, actual, 10e-
> 4);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> @@ -66,7 +65,6 @@
> .inverseCumulativeProbability(p);
> assertEquals("critical value for " + p, expected, actual,
> 10e-4);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
>
>
> 1.13 +1 -4 jakarta-
> commons/math/src/test/org/apache/commons/math/distribution/ExponentialDist
> ributionTest.java
>
> Index: ExponentialDistributionTest.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
> commons/math/src/test/org/apache/commons/math/distribution/ExponentialDist
> ributionTest.java,v
> retrieving revision 1.12
> retrieving revision 1.13
> diff -u -r1.12 -r1.13
> --- ExponentialDistributionTest.java 21 Feb 2004 21:35:17 -0000
> 1.12
> +++ ExponentialDistributionTest.java 23 May 2004 00:33:40 -0000
> 1.13
> @@ -161,7 +161,6 @@
> double actual = exp.cumulativeProbability(0.25, 0.75);
> assertEquals(0.0905214, actual, 10e-4);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> @@ -172,7 +171,6 @@
> double actual = exp.cumulativeProbability(x);
> TestUtils.assertEquals(expected, actual, 10e-4);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> @@ -182,7 +180,6 @@
> double actual = exp.inverseCumulativeProbability(p);
> TestUtils.assertEquals(expected, actual, 10e-4);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
>
>
> 1.12 +1 -3 jakarta-
> commons/math/src/test/org/apache/commons/math/distribution/FDistributionTe
> st.java
>
> Index: FDistributionTest.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
> commons/math/src/test/org/apache/commons/math/distribution/FDistributionTe
> st.java,v
> retrieving revision 1.11
> retrieving revision 1.12
> diff -u -r1.11 -r1.12
> --- FDistributionTest.java 21 Feb 2004 21:35:17 -0000 1.11
> +++ FDistributionTest.java 23 May 2004 00:33:40 -0000 1.12
> @@ -82,7 +82,6 @@
> double actual = f.cumulativeProbability(x);
> assertEquals("probability for " + x, expected, actual, 1e-
> 3);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> @@ -92,7 +91,6 @@
> double actual = f.inverseCumulativeProbability(p);
> assertEquals("value for " + p, expected, actual, 1e-2);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
>
>
> 1.10 +1 -3 jakarta-
> commons/math/src/test/org/apache/commons/math/util/BeanTransformerTest.jav
> a
>
> Index: BeanTransformerTest.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
> commons/math/src/test/org/apache/commons/math/util/BeanTransformerTest.jav
> a,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -u -r1.9 -r1.10
> --- BeanTransformerTest.java 21 Feb 2004 21:35:18 -0000 1.9
> +++ BeanTransformerTest.java 23 May 2004 00:33:41 -0000 1.10
> @@ -77,7 +77,6 @@
> try {
> value = b.transform(target);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> TestUtils.assertEquals(1.0, value, 1.0e-2);
> @@ -93,7 +92,6 @@
> try {
> b.transform(target);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> fail("Expecting ClassCastException");
>
>
>
> 1.11 +1 -5 jakarta-
> commons/math/src/test/org/apache/commons/math/util/DefaultTransformerTest.
> java
>
> Index: DefaultTransformerTest.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
> commons/math/src/test/org/apache/commons/math/util/DefaultTransformerTest.
> java,v
> retrieving revision 1.10
> retrieving revision 1.11
> diff -u -r1.10 -r1.11
> --- DefaultTransformerTest.java 23 May 2004 00:30:01 -0000 1.10
> +++ DefaultTransformerTest.java 23 May 2004 00:33:41 -0000 1.11
> @@ -35,7 +35,6 @@
> try {
> assertEquals(expected, t.transform(input), 1.0e-4);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> @@ -63,7 +62,6 @@
> try {
> assertEquals(expected, t.transform(input), 1.0e-4);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> @@ -78,7 +76,6 @@
> try {
> assertEquals(expected, t.transform(input), 1.0e-4);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> @@ -93,7 +90,6 @@
> try {
> assertEquals(expected, t.transform(input), 1.0e-4);
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
>
>
> 1.3 +1 -2 jakarta-
> commons/math/src/test/org/apache/commons/math/stat/univariate/ListUnivaria
> teImpl.java
>
> Index: ListUnivariateImpl.java
> ===================================================================
> RCS file: /home/cvs/jakarta-
> commons/math/src/test/org/apache/commons/math/stat/univariate/ListUnivaria
> teImpl.java,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- ListUnivariateImpl.java 24 Apr 2004 21:41:02 -0000 1.2
> +++ ListUnivariateImpl.java 23 May 2004 00:33:41 -0000 1.3
> @@ -105,7 +105,6 @@
> try {
> value = transformer.transform(list.get(calcIndex));
> } catch (MathException e) {
> - // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org