incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1228528 - in /incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit: ABANumberValidatorTest.java AbstractCheckDigitTest.java
Date Sat, 07 Jan 2012 00:59:39 GMT
Author: simonetripodi
Date: Sat Jan  7 00:59:39 2012
New Revision: 1228528

URL: http://svn.apache.org/viewvc?rev=1228528&view=rev
Log:
adjusting check digit tests design

Modified:
    incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
    incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java

Modified: incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java?rev=1228528&r1=1228527&r2=1228528&view=diff
==============================================================================
--- incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
(original)
+++ incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
Sat Jan  7 00:59:39 2012
@@ -16,27 +16,30 @@
  */
 package org.apache.bval.extras.constraints.checkdigit;
 
-import org.junit.Before;
+import java.lang.annotation.Annotation;
+
+import javax.validation.ConstraintValidator;
 
 /**
  * ABA Number Validator Test.
  */
 public class ABANumberValidatorTest extends AbstractCheckDigitTest {
 
-    /**
-     * Set up routine & valid codes.
-     */
-    @Before
-    public void setUp() throws Exception {
-        routine = new ABANumberValidator();
-        valid = new String[] {
-                "123456780",
-                "123123123",
-                "011000015",
-                "111000038",
-                "231381116",
-                "121181976"
-                };
+    @Override
+    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+        return new ABANumberValidator();
+    }
+
+    @Override
+    protected String[] getValid() {
+        return new String[] {
+            "123456780",
+            "123123123",
+            "011000015",
+            "111000038",
+            "231381116",
+            "121181976"
+        };
     }
 
 }

Modified: incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java?rev=1228528&r1=1228527&r2=1228528&view=diff
==============================================================================
--- incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java
(original)
+++ incubator/bval/trunk/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java
Sat Jan  7 00:59:39 2012
@@ -38,10 +38,10 @@ public abstract class AbstractCheckDigit
     protected int checkDigitLth = 1;
 
     /** Check digit routine being tested */
-    protected ConstraintValidator<? extends Annotation, String> routine;
+    private ConstraintValidator<? extends Annotation, String> routine;
 
     /** Array of valid code values */
-    protected String[] valid;
+    private String[] valid;
 
     /** Array of invalid code values */
     protected String[] invalid = new String[] {"12345678A"};
@@ -52,6 +52,17 @@ public abstract class AbstractCheckDigit
     /** Prefix for error messages */
     protected String missingMessage = "Code is missing";
 
+
+    protected abstract ConstraintValidator<? extends Annotation, String> getConstraint();
+
+    protected abstract String[] getValid();
+
+    @Before
+    public void setUp() {
+        routine = getConstraint();
+        valid = getValid();
+    }
+
     /**
      * Tear Down - clears routine and valid codes.
      */



Mime
View raw message