Class AbstractCheckDigitTest

    • Constructor Detail

      • AbstractCheckDigitTest

        public AbstractCheckDigitTest()
    • 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
      • checkDigit

        protected String checkDigit​(String code)
        Returns the check digit (i.e. last character) for a code.
        Parameters:
        code - The code
        Returns:
        The check digit