You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2014/12/30 15:23:10 UTC
svn commit: r1648534 -
/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
Author: sebb
Date: Tue Dec 30 14:23:10 2014
New Revision: 1648534
URL: http://svn.apache.org/r1648534
Log:
Document how test arrays are currently used
Modified:
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
Modified: commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java?rev=1648534&r1=1648533&r2=1648534&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java (original)
+++ commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java Tue Dec 30 14:23:10 2014
@@ -45,10 +45,36 @@ public abstract class AbstractCheckDigit
/** Check digit routine being tested */
protected CheckDigit routine;
- /** Array of valid code values */
+ /**
+ * Array of valid code values
+ * These must contain valid strings *including* the check digit.
+ *
+ * They are passed to:
+ * CheckDigit.isValid(expects string including checkdigit)
+ * which is expected to return true
+ * and
+ * AbstractCheckDigitTest.createInvalidCodes() which
+ * mangles the last character to check that the result is now invalid.
+ * and
+ * the truncated string is passed to
+ * CheckDigit.calculate(expects string without checkdigit)
+ * the result is compared with the last character
+ */
protected String[] valid;
- /** Array of invalid code values */
+ /**
+ * Array of invalid code values
+ *
+ * These are currently passed to both
+ * CheckDigit.calculate(expects a string without checkdigit)
+ * which is expected to throw an exception
+ * However that only applies if the string is syntactically incorrect;
+ * and
+ * CheckDigit.isValid(expects a string including checkdigit)
+ * which is expected to return false
+ *
+ * See https://issues.apache.org/jira/browse/VALIDATOR-344 for some dicussion on this
+ */
protected String[] invalid = new String[] {"12345678A"};
/** code value which sums to zero */