Class AbstractCheckDigitTest
- java.lang.Object
-
- org.apache.bval.extras.constraints.checkdigit.AbstractCheckDigitTest
-
- Direct Known Subclasses:
ABANumberValidatorTest
,CUSIPValidatorTest
,EAN13CheckDigitTest
,IBANCheckDigitTest
,ISBN10CheckDigitTest
,LuhnCheckDigitTest
,SedolCheckDigitTest
,VerhoeffCheckDigitTest
public abstract class AbstractCheckDigitTest extends Object
-
-
Constructor Summary
Constructors Constructor Description AbstractCheckDigitTest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
checkDigit(String code)
Returns the check digit (i.e.protected String[]
createInvalidCodes(String[] codes)
Returns an array of codes with invalid check digits.int
getCheckDigitLth()
protected abstract jakarta.validation.ConstraintValidator<? extends Annotation,? super String>
getConstraint()
protected String[]
getInvalid()
String
getMissingMessage()
protected abstract String[]
getValid()
protected String
getZeroSum()
protected String
removeCheckDigit(String code)
Returns a code with the Check Digit (i.e.void
setUp()
void
tearDown()
Tear Down - clears routine and valid codes.void
testIsValidFalse()
Test isValid() for invalid values.void
testIsValidTrue()
Test isValid() for valid values.void
testMissingCode()
Test missing codevoid
testZeroSum()
Test zero sum
-
-
-
Method Detail
-
getCheckDigitLth
public int getCheckDigitLth()
-
getConstraint
protected abstract jakarta.validation.ConstraintValidator<? extends Annotation,? super String> getConstraint()
-
getValid
protected abstract String[] getValid()
-
getInvalid
protected String[] getInvalid()
-
getZeroSum
protected String getZeroSum()
-
getMissingMessage
public String getMissingMessage()
-
setUp
public void setUp()
-
tearDown
public void tearDown()
Tear Down - clears routine and valid codes.
-
testIsValidTrue
public void testIsValidTrue()
Test isValid() for valid values.
-
testIsValidFalse
public void testIsValidFalse()
Test isValid() for invalid values.
-
testMissingCode
public void testMissingCode()
Test missing code
-
testZeroSum
public void testZeroSum()
Test zero sum
-
createInvalidCodes
protected String[] createInvalidCodes(String[] codes)
Returns an array of codes with invalid check digits.- Parameters:
codes
- Codes with valid check digits- Returns:
- Codes with invalid check digits
-
removeCheckDigit
protected String removeCheckDigit(String code)
Returns a code with the Check Digit (i.e. last character) removed.- Parameters:
code
- The code- Returns:
- The code without the check digit
-
-