commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (VALIDATOR-320) CodeValidator - EAN13CheckDigit doesn't work
Date Thu, 30 Jan 2014 13:50:11 GMT

     [ https://issues.apache.org/jira/browse/VALIDATOR-320?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sebb closed VALIDATOR-320.
--------------------------


> CodeValidator - EAN13CheckDigit doesn't work
> --------------------------------------------
>
>                 Key: VALIDATOR-320
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-320
>             Project: Commons Validator
>          Issue Type: Bug
>          Components: Routines
>    Affects Versions: 1.4.0 Release
>            Reporter: Rodrigo Augusto Carlos Bispo
>            Priority: Critical
>              Labels: documentation, features
>
> Hi,
> This link show how to create a validator to validate EAN-13 codes (numeric, with a length
of 13)
> http://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/package-summary.html#other.code
> However I tested the method and always returns "false", like this...
> public boolean isCodeEAN13Valid(String code) {
> 	CodeValidator validator = new CodeValidator("^[0-9]*$", 13, EAN13CheckDigit.EAN13_CHECK_DIGIT);
> 	return = validator.isValid(code);
> }
> @Test
> public void shouldBeAnValidCodeEAN13() {
> 	assertTrue(object.isCodeEAN13Valid("7501031311309"));
> }
> 1. Note that I used EAN13CheckDigit.EAN13_CHECK_DIGIT and not EAN13CheckDigit.INSTANCE.
> 2. I did not found information about EAN13CheckDigit.INSTANCE. Is it from what release
of commons.validator?
> 3. My constructor of CodeValidator and how it was applied and used in example is really
right?



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message