You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/12/01 14:28:50 UTC
(commons-validator) 22/23: Start porting to JUnit 5 Add @Test annotations
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git
commit 46859adb2ba4e617783338ea4429d24dac308f98
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Dec 1 09:23:02 2023 -0500
Start porting to JUnit 5 Add @Test annotations
---
.../commons/validator/AbstractNumberTest.java | 3 +++
.../org/apache/commons/validator/ByteTest.java | 8 +++++++
.../commons/validator/CreditCardValidatorTest.java | 4 ++++
.../validator/CustomValidatorResourcesTest.java | 3 +++
.../org/apache/commons/validator/DateTest.java | 3 +++
.../org/apache/commons/validator/DoubleTest.java | 6 +++++
.../org/apache/commons/validator/EmailTest.java | 28 +++++++++++++++-------
.../apache/commons/validator/EntityImportTest.java | 4 ++++
.../apache/commons/validator/ExceptionTest.java | 2 ++
.../apache/commons/validator/ExtensionTest.java | 10 ++++++++
.../org/apache/commons/validator/FieldTest.java | 11 +++++++++
.../org/apache/commons/validator/FloatTest.java | 6 +++++
.../validator/GenericTypeValidatorTest.java | 10 +++++---
.../commons/validator/GenericValidatorTest.java | 4 ++++
.../commons/validator/ISBNValidatorTest.java | 3 +++
.../org/apache/commons/validator/IntegerTest.java | 8 +++++++
.../org/apache/commons/validator/LocaleTest.java | 6 +++++
.../org/apache/commons/validator/LongTest.java | 8 +++++++
.../commons/validator/MultipleConfigFilesTest.java | 10 ++++++--
.../org/apache/commons/validator/MultipleTest.java | 25 ++++++++++++-------
.../apache/commons/validator/ParameterTest.java | 2 ++
.../apache/commons/validator/RequiredIfTest.java | 16 +++++++++----
.../apache/commons/validator/RequiredNameTest.java | 19 ++++++++++-----
.../apache/commons/validator/RetrieveFormTest.java | 10 ++++++--
.../org/apache/commons/validator/ShortTest.java | 14 +++++++----
.../java/org/apache/commons/validator/UrlTest.java | 20 +++++++++++-----
.../commons/validator/ValidatorResourcesTest.java | 3 +++
.../commons/validator/ValidatorResultsTest.java | 7 ++++--
.../apache/commons/validator/ValidatorTest.java | 12 +++++++---
.../java/org/apache/commons/validator/VarTest.java | 4 +++-
.../routines/AbstractCalendarValidatorTest.java | 8 +++++++
.../routines/AbstractNumberValidatorTest.java | 12 ++++++++++
.../routines/BigDecimalValidatorTest.java | 4 ++++
.../routines/BigIntegerValidatorTest.java | 4 ++++
.../validator/routines/ByteValidatorTest.java | 4 ++++
.../validator/routines/CalendarValidatorTest.java | 7 ++++++
.../validator/routines/CodeValidatorTest.java | 8 +++++++
.../routines/CreditCardValidatorTest.java | 21 ++++++++++++++++
.../validator/routines/CurrencyValidatorTest.java | 8 +++++++
.../validator/routines/DateValidatorTest.java | 5 ++++
.../validator/routines/DomainValidatorTest.java | 20 ++++++++++++++++
.../validator/routines/DoubleValidatorTest.java | 4 ++++
.../validator/routines/FloatValidatorTest.java | 5 ++++
.../validator/routines/ISBNValidatorTest.java | 14 +++++++++++
.../validator/routines/ISINValidatorTest.java | 6 +++++
.../validator/routines/ISSNValidatorTest.java | 10 ++++++++
.../routines/InetAddressValidatorTest.java | 10 ++++++++
.../validator/routines/IntegerValidatorTest.java | 5 ++++
.../validator/routines/LongValidatorTest.java | 4 ++++
.../validator/routines/PercentValidatorTest.java | 5 ++++
.../validator/routines/RegexValidatorTest.java | 10 ++++++++
.../validator/routines/ShortValidatorTest.java | 4 ++++
.../validator/routines/TimeValidatorTest.java | 9 +++++++
.../checkdigit/AbstractCheckDigitTest.java | 8 +++++++
.../routines/checkdigit/CUSIPCheckDigitTest.java | 4 ++++
.../routines/checkdigit/IBANCheckDigitTest.java | 3 +++
.../routines/checkdigit/ISBNCheckDigitTest.java | 3 +++
.../routines/checkdigit/ISINCheckDigitTest.java | 3 +++
.../checkdigit/ModulusTenCUSIPCheckDigitTest.java | 4 ++++
.../checkdigit/ModulusTenSedolCheckDigitTest.java | 3 +++
.../routines/checkdigit/SedolCheckDigitTest.java | 3 +++
.../checkdigit/VerhoeffCheckDigitTest.java | 3 +++
.../apache/commons/validator/util/FlagsTest.java | 15 ++++++++++++
63 files changed, 455 insertions(+), 50 deletions(-)
diff --git a/src/test/java/org/apache/commons/validator/AbstractNumberTest.java b/src/test/java/org/apache/commons/validator/AbstractNumberTest.java
index ec51f7e2..2d231492 100644
--- a/src/test/java/org/apache/commons/validator/AbstractNumberTest.java
+++ b/src/test/java/org/apache/commons/validator/AbstractNumberTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.validator;
import java.io.IOException;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -57,6 +58,7 @@ abstract public class AbstractNumberTest extends AbstractCommonTest {
/**
* Tests the number validation.
*/
+ @Test
public void testNumber() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -67,6 +69,7 @@ abstract public class AbstractNumberTest extends AbstractCommonTest {
/**
* Tests the float validation failure.
*/
+ @Test
public void testNumberFailure() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
diff --git a/src/test/java/org/apache/commons/validator/ByteTest.java b/src/test/java/org/apache/commons/validator/ByteTest.java
index d23da7ea..c47b08c2 100644
--- a/src/test/java/org/apache/commons/validator/ByteTest.java
+++ b/src/test/java/org/apache/commons/validator/ByteTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator;
+import org.junit.Test;
+
/**
* Performs Validation Test for <code>byte</code> validations.
*/
@@ -30,6 +32,7 @@ public class ByteTest extends AbstractNumberTest {
/**
* Tests the byte validation.
*/
+ @Test
public void testByte() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -41,6 +44,7 @@ public class ByteTest extends AbstractNumberTest {
/**
* Tests the byte validation failure.
*/
+ @Test
public void testByteBeyondMax() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -52,6 +56,7 @@ public class ByteTest extends AbstractNumberTest {
/**
* Tests the byte validation failure.
*/
+ @Test
public void testByteBeyondMin() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -63,6 +68,7 @@ public class ByteTest extends AbstractNumberTest {
/**
* Tests the byte validation failure.
*/
+ @Test
public void testByteFailure() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -73,6 +79,7 @@ public class ByteTest extends AbstractNumberTest {
/**
* Tests the byte validation.
*/
+ @Test
public void testByteMax() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -84,6 +91,7 @@ public class ByteTest extends AbstractNumberTest {
/**
* Tests the byte validation.
*/
+ @Test
public void testByteMin() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
diff --git a/src/test/java/org/apache/commons/validator/CreditCardValidatorTest.java b/src/test/java/org/apache/commons/validator/CreditCardValidatorTest.java
index 34da9653..7a2ed5b1 100644
--- a/src/test/java/org/apache/commons/validator/CreditCardValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/CreditCardValidatorTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Test the CreditCardValidator class.
*
@@ -52,6 +54,7 @@ public class CreditCardValidatorTest extends TestCase {
super(name);
}
+ @Test
public void testAddAllowedCardType() {
final CreditCardValidator ccv = new CreditCardValidator(CreditCardValidator.NONE);
// Turned off all cards so even valid numbers should fail
@@ -65,6 +68,7 @@ public class CreditCardValidatorTest extends TestCase {
assertTrue(ccv.isValid(VALID_DINERS));
}
+ @Test
public void testIsValid() {
CreditCardValidator ccv = new CreditCardValidator();
diff --git a/src/test/java/org/apache/commons/validator/CustomValidatorResourcesTest.java b/src/test/java/org/apache/commons/validator/CustomValidatorResourcesTest.java
index 45f33060..3ddcb4cb 100644
--- a/src/test/java/org/apache/commons/validator/CustomValidatorResourcesTest.java
+++ b/src/test/java/org/apache/commons/validator/CustomValidatorResourcesTest.java
@@ -20,6 +20,8 @@ import java.io.InputStream;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Test custom ValidatorResources.
*/
@@ -50,6 +52,7 @@ public class CustomValidatorResourcesTest extends TestCase {
/**
* Test creating a custom validator resources.
*/
+ @Test
public void testCustomResources() {
// Load resources
InputStream in = null;
diff --git a/src/test/java/org/apache/commons/validator/DateTest.java b/src/test/java/org/apache/commons/validator/DateTest.java
index d606d1be..1076cecc 100644
--- a/src/test/java/org/apache/commons/validator/DateTest.java
+++ b/src/test/java/org/apache/commons/validator/DateTest.java
@@ -19,6 +19,7 @@ package org.apache.commons.validator;
import java.io.IOException;
import java.util.Locale;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -54,6 +55,7 @@ public class DateTest extends AbstractCommonTest {
/**
* Tests the date validation.
*/
+ @Test
public void testInvalidDate() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -64,6 +66,7 @@ public class DateTest extends AbstractCommonTest {
/**
* Tests the date validation.
*/
+ @Test
public void testValidDate() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
diff --git a/src/test/java/org/apache/commons/validator/DoubleTest.java b/src/test/java/org/apache/commons/validator/DoubleTest.java
index 0de2197f..78edbfc2 100644
--- a/src/test/java/org/apache/commons/validator/DoubleTest.java
+++ b/src/test/java/org/apache/commons/validator/DoubleTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator;
+import org.junit.Test;
+
/**
* Performs Validation Test for <code>double</code> validations.
*/
@@ -30,6 +32,7 @@ public class DoubleTest extends AbstractNumberTest {
/**
* Tests the double validation.
*/
+ @Test
public void testDouble() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -41,6 +44,7 @@ public class DoubleTest extends AbstractNumberTest {
/**
* Tests the double validation failure.
*/
+ @Test
public void testDoubleFailure() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -51,6 +55,7 @@ public class DoubleTest extends AbstractNumberTest {
/**
* Tests the double validation.
*/
+ @Test
public void testDoubleMax() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -62,6 +67,7 @@ public class DoubleTest extends AbstractNumberTest {
/**
* Tests the double validation.
*/
+ @Test
public void testDoubleMin() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
diff --git a/src/test/java/org/apache/commons/validator/EmailTest.java b/src/test/java/org/apache/commons/validator/EmailTest.java
index 55dff300..6d14cae9 100644
--- a/src/test/java/org/apache/commons/validator/EmailTest.java
+++ b/src/test/java/org/apache/commons/validator/EmailTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.validator;
import java.io.IOException;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -228,7 +229,8 @@ public void _testEmailUserName() throws ValidatorException {
/**
* Tests the e-mail validation.
*/
- public void testEmail() throws ValidatorException {
+ @Test
+ public void testEmail() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -239,7 +241,8 @@ public void _testEmailUserName() throws ValidatorException {
/**
* Tests the e-mail validation with a user at a TLD
*/
- public void testEmailAtTLD() throws ValidatorException {
+ @Test
+ public void testEmailAtTLD() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -256,6 +259,7 @@ public void _testEmailUserName() throws ValidatorException {
/**
* Tests the e-mail validation.
*/
+ @Test
public void testEmailExtension() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -289,7 +293,8 @@ public void _testEmailUserName() throws ValidatorException {
* Test that @localhost and @localhost.localdomain
* addresses aren't declared valid by default
*/
-public void testEmailLocalhost() throws ValidatorException {
+@Test
+ public void testEmailLocalhost() throws ValidatorException {
final ValueBean info = new ValueBean();
info.setValue("joe@localhost");
valueTest(info, false);
@@ -301,7 +306,8 @@ public void testEmailLocalhost() throws ValidatorException {
* Tests the e-mail validation with an RCS-noncompliant character in
* the address.
*/
-public void testEmailWithBogusCharacter() throws ValidatorException {
+@Test
+ public void testEmailWithBogusCharacter() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -323,6 +329,7 @@ public void testEmailWithBogusCharacter() throws ValidatorException {
/**
* Tests the email validation with commas.
*/
+ @Test
public void testEmailWithCommas() throws ValidatorException {
final ValueBean info = new ValueBean();
info.setValue("joeblow@apa,che.org");
@@ -338,6 +345,7 @@ public void testEmailWithBogusCharacter() throws ValidatorException {
* Tests the email validation with ASCII control characters.
* (i.e. ASCII chars 0 - 31 and 127)
*/
+ @Test
public void testEmailWithControlChars() {
final EmailValidator validator = new EmailValidator();
for (char c = 0; c < 32; c++) {
@@ -350,7 +358,8 @@ public void testEmailWithBogusCharacter() throws ValidatorException {
* <p>Tests the e-mail validation with a dash in
* the address.</p>
*/
- public void testEmailWithDash() throws ValidatorException {
+ @Test
+ public void testEmailWithDash() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -370,7 +379,8 @@ public void testEmailWithBogusCharacter() throws ValidatorException {
* Tests the e-mail validation with a dot at the end of
* the address.
*/
- public void testEmailWithDotEnd() throws ValidatorException {
+ @Test
+ public void testEmailWithDotEnd() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -382,7 +392,8 @@ public void testEmailWithBogusCharacter() throws ValidatorException {
/**
* Tests the email validation with numeric domains.
*/
- public void testEmailWithNumericAddress() throws ValidatorException {
+ @Test
+ public void testEmailWithNumericAddress() throws ValidatorException {
final ValueBean info = new ValueBean();
info.setValue("someone@[216.109.118.76]");
valueTest(info, true);
@@ -393,7 +404,8 @@ public void testEmailWithBogusCharacter() throws ValidatorException {
/**
* Tests the email validation with spaces.
*/
- public void testEmailWithSpaces() throws ValidatorException {
+ @Test
+ public void testEmailWithSpaces() throws ValidatorException {
final ValueBean info = new ValueBean();
info.setValue("joeblow @apache.org");
valueTest(info, false);
diff --git a/src/test/java/org/apache/commons/validator/EntityImportTest.java b/src/test/java/org/apache/commons/validator/EntityImportTest.java
index 93da7f5d..884be4ea 100644
--- a/src/test/java/org/apache/commons/validator/EntityImportTest.java
+++ b/src/test/java/org/apache/commons/validator/EntityImportTest.java
@@ -19,6 +19,8 @@ package org.apache.commons.validator;
import java.net.URL;
import java.util.Locale;
+import org.junit.Test;
+
/**
* Tests entity imports.
*/
@@ -31,6 +33,7 @@ public class EntityImportTest extends AbstractCommonTest {
/**
* Tests the entity import loading the <code>byteForm</code> form.
*/
+ @Test
public void testEntityImport() throws Exception {
final URL url = getClass().getResource("EntityImportTest-config.xml");
final ValidatorResources resources = new ValidatorResources(url.toExternalForm());
@@ -40,6 +43,7 @@ public class EntityImportTest extends AbstractCommonTest {
/**
* Tests loading ValidatorResources from a URL
*/
+ @Test
public void testParseURL() throws Exception {
final URL url = getClass().getResource("EntityImportTest-config.xml");
final ValidatorResources resources = new ValidatorResources(url);
diff --git a/src/test/java/org/apache/commons/validator/ExceptionTest.java b/src/test/java/org/apache/commons/validator/ExceptionTest.java
index 2efba95b..8cefb3ea 100644
--- a/src/test/java/org/apache/commons/validator/ExceptionTest.java
+++ b/src/test/java/org/apache/commons/validator/ExceptionTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.validator;
import java.io.IOException;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -53,6 +54,7 @@ public class ExceptionTest extends AbstractCommonTest {
* Tests handling of checked exceptions - should become
* ValidatorExceptions.
*/
+ @Test
public void testValidatorException() {
// Create bean to run test on.
final ValueBean info = new ValueBean();
diff --git a/src/test/java/org/apache/commons/validator/ExtensionTest.java b/src/test/java/org/apache/commons/validator/ExtensionTest.java
index b7aed668..91e7aa55 100644
--- a/src/test/java/org/apache/commons/validator/ExtensionTest.java
+++ b/src/test/java/org/apache/commons/validator/ExtensionTest.java
@@ -20,6 +20,8 @@ import java.io.InputStream;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* <p>Performs tests for extension in form definitions. Performs the same tests
* RequiredNameTest does but with an equivalent validation definition with extension
@@ -84,6 +86,7 @@ public class ExtensionTest extends TestCase {
* Tests if the order is mantained when extending a form. Parent form fields should
* preceed self form fields, except if we override the rules.
*/
+ @Test
public void testOrder() {
final Form form = resources.getForm(ValidatorResources.defaultLocale, FORM_KEY);
@@ -115,6 +118,7 @@ public class ExtensionTest extends TestCase {
* Tests if we can override a rule. We "can" override a rule if the message shown
* when the firstName required test fails and the lastName test is null.
*/
+ @Test
public void testOverrideRule() throws ValidatorException {
// Create bean to run test on.
@@ -144,6 +148,7 @@ public class ExtensionTest extends TestCase {
/**
* Tests the required validation failure.
*/
+ @Test
public void testRequired() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -179,6 +184,7 @@ public class ExtensionTest extends TestCase {
/**
* Tests the required validation for first name.
*/
+ @Test
public void testRequiredFirstName() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -211,6 +217,7 @@ public class ExtensionTest extends TestCase {
/**
* Tests the required validation for first name if it is blank.
*/
+ @Test
public void testRequiredFirstNameBlank() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -243,6 +250,7 @@ public class ExtensionTest extends TestCase {
/**
* Tests the required validation for last name.
*/
+ @Test
public void testRequiredLastName() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -276,6 +284,7 @@ public class ExtensionTest extends TestCase {
/**
* Tests the required validation for last name if it is blank.
*/
+ @Test
public void testRequiredLastNameBlank() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -308,6 +317,7 @@ public class ExtensionTest extends TestCase {
/**
* Tests the required validation for first and last name.
*/
+ @Test
public void testRequiredName() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
diff --git a/src/test/java/org/apache/commons/validator/FieldTest.java b/src/test/java/org/apache/commons/validator/FieldTest.java
index 690837c3..1191183b 100644
--- a/src/test/java/org/apache/commons/validator/FieldTest.java
+++ b/src/test/java/org/apache/commons/validator/FieldTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Test <code>Field</code> objects.
*/
@@ -93,6 +95,7 @@ public class FieldTest extends TestCase {
/**
* test Field with only 'default' arguments, position specified for one argument
*/
+ @Test
public void testDefaultOnePosition() {
field.addArg(createArg("default-position-0"));
@@ -110,6 +113,7 @@ public class FieldTest extends TestCase {
/**
* test Field with only 'default' arguments, no positions specified.
*/
+ @Test
public void testDefaultPositionImplied() {
field.addArg(createArg("default-position-0"));
@@ -126,6 +130,7 @@ public class FieldTest extends TestCase {
/**
* test Field with only 'default' arguments, some position specified.
*/
+ @Test
public void testDefaultSomePositions() {
field.addArg(createArg("default-position-0"));
@@ -144,6 +149,7 @@ public class FieldTest extends TestCase {
/**
* test Field with only 'default' arguments, positions specified.
*/
+ @Test
public void testDefaultUsingPositions() {
field.addArg(createArg("default-position-1", 1));
@@ -160,6 +166,7 @@ public class FieldTest extends TestCase {
/**
* test Field with no arguments
*/
+ @Test
public void testEmptyArgs() {
assertEquals("Empty Args(1) ", 0, field.getArgs("required").length);
@@ -169,6 +176,7 @@ public class FieldTest extends TestCase {
/**
* test Field with a 'default' argument overriden without positions specified.
*/
+ @Test
public void testOverridePositionImplied() {
field.addArg(createArg("default-position-0"));
@@ -198,6 +206,7 @@ public class FieldTest extends TestCase {
/**
* test Field with a 'default' argument overriden with some positions specified
*/
+ @Test
public void testOverrideSomePosition() {
field.addArg(createArg("default-position-0"));
@@ -232,6 +241,7 @@ public class FieldTest extends TestCase {
/**
* test Field with a 'default' argument overriden using 'position' property
*/
+ @Test
public void testOverrideUsingPositionA() {
field.addArg(createArg("default-position-0"));
@@ -255,6 +265,7 @@ public class FieldTest extends TestCase {
/**
* test Field with a 'default' argument overriden using 'position' property
*/
+ @Test
public void testOverrideUsingPositionB() {
field.addArg(createArg("required-position-3", "required", 3));
diff --git a/src/test/java/org/apache/commons/validator/FloatTest.java b/src/test/java/org/apache/commons/validator/FloatTest.java
index f6a1a455..92270f39 100644
--- a/src/test/java/org/apache/commons/validator/FloatTest.java
+++ b/src/test/java/org/apache/commons/validator/FloatTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator;
+import org.junit.Test;
+
/**
* Performs Validation Test for <code>float</code> validations.
*/
@@ -30,6 +32,7 @@ public class FloatTest extends AbstractNumberTest {
/**
* Tests the float validation.
*/
+ @Test
public void testFloat() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -41,6 +44,7 @@ public class FloatTest extends AbstractNumberTest {
/**
* Tests the float validation failure.
*/
+ @Test
public void testFloatFailure() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -51,6 +55,7 @@ public class FloatTest extends AbstractNumberTest {
/**
* Tests the float validation.
*/
+ @Test
public void testFloatMax() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -62,6 +67,7 @@ public class FloatTest extends AbstractNumberTest {
/**
* Tests the float validation.
*/
+ @Test
public void testFloatMin() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
diff --git a/src/test/java/org/apache/commons/validator/GenericTypeValidatorTest.java b/src/test/java/org/apache/commons/validator/GenericTypeValidatorTest.java
index 3b19b5da..37a8bed0 100644
--- a/src/test/java/org/apache/commons/validator/GenericTypeValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/GenericTypeValidatorTest.java
@@ -21,6 +21,7 @@ import java.util.Date;
import java.util.Locale;
import java.util.Map;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -100,7 +101,8 @@ protected void tearDown() {
/**
* Tests the fr locale.
*/
- public void testFRLocale() throws ValidatorException {
+ @Test
+ public void testFRLocale() throws ValidatorException {
// Create bean to run test on.
final TypeBean info = new TypeBean();
info.setByte("12");
@@ -118,7 +120,8 @@ protected void tearDown() {
/**
* Tests the byte validation.
*/
- public void testType() throws ValidatorException {
+ @Test
+ public void testType() throws ValidatorException {
// Create bean to run test on.
final TypeBean info = new TypeBean();
info.setByte("12");
@@ -170,7 +173,8 @@ protected void tearDown() {
/**
* Tests the us locale
*/
- public void testUSLocale() throws ValidatorException {
+ @Test
+ public void testUSLocale() throws ValidatorException {
// Create bean to run test on.
final TypeBean info = new TypeBean();
info.setByte("12");
diff --git a/src/test/java/org/apache/commons/validator/GenericValidatorTest.java b/src/test/java/org/apache/commons/validator/GenericValidatorTest.java
index a4e406bf..884cf468 100644
--- a/src/test/java/org/apache/commons/validator/GenericValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/GenericValidatorTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Test the GenericValidator class.
*/
@@ -30,6 +32,7 @@ public class GenericValidatorTest extends TestCase {
super(name);
}
+ @Test
public void testMaxLength() {
// Use 0 for line end length
@@ -51,6 +54,7 @@ public class GenericValidatorTest extends TestCase {
assertTrue("Max=7 End=2", GenericValidator.maxLength("12345\n\r", 7, 2));
}
+ @Test
public void testMinLength() {
// Use 0 for line end length
diff --git a/src/test/java/org/apache/commons/validator/ISBNValidatorTest.java b/src/test/java/org/apache/commons/validator/ISBNValidatorTest.java
index c38980a1..e5569552 100644
--- a/src/test/java/org/apache/commons/validator/ISBNValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/ISBNValidatorTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* ISBNValidator Test Case.
*
@@ -36,6 +38,7 @@ public class ISBNValidatorTest extends TestCase {
super(name);
}
+ @Test
public void testIsValid() throws Exception {
final ISBNValidator validator = new ISBNValidator();
assertFalse(validator.isValid(null));
diff --git a/src/test/java/org/apache/commons/validator/IntegerTest.java b/src/test/java/org/apache/commons/validator/IntegerTest.java
index 8c981587..21e0832d 100644
--- a/src/test/java/org/apache/commons/validator/IntegerTest.java
+++ b/src/test/java/org/apache/commons/validator/IntegerTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator;
+import org.junit.Test;
+
/**
* Performs Validation Test for <code>int</code> validations.
*/
@@ -30,6 +32,7 @@ public class IntegerTest extends AbstractNumberTest {
/**
* Tests the int validation.
*/
+ @Test
public void testInt() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -41,6 +44,7 @@ public class IntegerTest extends AbstractNumberTest {
/**
* Tests the int validation failure.
*/
+ @Test
public void testIntBeyondMax() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -52,6 +56,7 @@ public class IntegerTest extends AbstractNumberTest {
/**
* Tests the int validation failure.
*/
+ @Test
public void testIntBeyondMin() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -63,6 +68,7 @@ public class IntegerTest extends AbstractNumberTest {
/**
* Tests the int validation.
*/
+ @Test
public void testIntegerMax() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -74,6 +80,7 @@ public class IntegerTest extends AbstractNumberTest {
/**
* Tests the int validation failure.
*/
+ @Test
public void testIntFailure() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -84,6 +91,7 @@ public class IntegerTest extends AbstractNumberTest {
/**
* Tests the int validation.
*/
+ @Test
public void testIntMin() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
diff --git a/src/test/java/org/apache/commons/validator/LocaleTest.java b/src/test/java/org/apache/commons/validator/LocaleTest.java
index fa0d9171..9e7de2d6 100644
--- a/src/test/java/org/apache/commons/validator/LocaleTest.java
+++ b/src/test/java/org/apache/commons/validator/LocaleTest.java
@@ -19,6 +19,7 @@ package org.apache.commons.validator;
import java.io.IOException;
import java.util.Locale;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -67,6 +68,7 @@ public class LocaleTest extends AbstractCommonTest {
*
* @throws ValidatorException If something goes wrong
*/
+ @Test
public void testLocale1()
throws ValidatorException {
// Create bean to run test on.
@@ -83,6 +85,7 @@ public class LocaleTest extends AbstractCommonTest {
*
* @throws ValidatorException If something goes wrong
*/
+ @Test
public void testLocale2()
throws ValidatorException {
// Create bean to run test on.
@@ -99,6 +102,7 @@ public class LocaleTest extends AbstractCommonTest {
*
* @throws ValidatorException If something goes wrong
*/
+ @Test
public void testLocale3()
throws ValidatorException {
// Create bean to run test on.
@@ -116,6 +120,7 @@ public class LocaleTest extends AbstractCommonTest {
*
* @throws ValidatorException If something goes wrong
*/
+ @Test
public void testLocale4()
throws ValidatorException {
// Create bean to run test on.
@@ -131,6 +136,7 @@ public class LocaleTest extends AbstractCommonTest {
*
* @throws ValidatorException If something goes wrong
*/
+ @Test
public void testLocale5()
throws ValidatorException {
// Create bean to run test on.
diff --git a/src/test/java/org/apache/commons/validator/LongTest.java b/src/test/java/org/apache/commons/validator/LongTest.java
index f155740d..31a832b8 100644
--- a/src/test/java/org/apache/commons/validator/LongTest.java
+++ b/src/test/java/org/apache/commons/validator/LongTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator;
+import org.junit.Test;
+
/**
* Performs Validation Test for <code>long</code> validations.
*/
@@ -30,6 +32,7 @@ public class LongTest extends AbstractNumberTest {
/**
* Tests the long validation.
*/
+ @Test
public void testLong() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -41,6 +44,7 @@ public class LongTest extends AbstractNumberTest {
/**
* Tests the long validation failure.
*/
+ @Test
public void testLongBeyondMax() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -52,6 +56,7 @@ public class LongTest extends AbstractNumberTest {
/**
* Tests the long validation failure.
*/
+ @Test
public void testLongBeyondMin() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -63,6 +68,7 @@ public class LongTest extends AbstractNumberTest {
/**
* Tests the long validation failure.
*/
+ @Test
public void testLongFailure() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -73,6 +79,7 @@ public class LongTest extends AbstractNumberTest {
/**
* Tests the long validation.
*/
+ @Test
public void testLongMax() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
@@ -84,6 +91,7 @@ public class LongTest extends AbstractNumberTest {
/**
* Tests the long validation.
*/
+ @Test
public void testLongMin() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
diff --git a/src/test/java/org/apache/commons/validator/MultipleConfigFilesTest.java b/src/test/java/org/apache/commons/validator/MultipleConfigFilesTest.java
index b8b71f55..8a31ec58 100644
--- a/src/test/java/org/apache/commons/validator/MultipleConfigFilesTest.java
+++ b/src/test/java/org/apache/commons/validator/MultipleConfigFilesTest.java
@@ -21,6 +21,7 @@ import java.io.InputStream;
import junit.framework.TestCase;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -75,7 +76,8 @@ public class MultipleConfigFilesTest extends TestCase {
/**
* With nothing provided, we should fail both because both are required.
*/
-public void testBothBlank() throws ValidatorException {
+@Test
+ public void testBothBlank() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -112,7 +114,8 @@ public void testBothBlank() throws ValidatorException {
* Check the forms and constants from different config files have
* been merged into the same FormSet.
*/
- public void testMergedConfig() {
+ @Test
+ public void testMergedConfig() {
// *********** Default Locale *******************
@@ -158,6 +161,7 @@ public void testBothBlank() throws ValidatorException {
/**
* If the first name fails required, and the second test fails int, we should get two errors.
*/
+ @Test
public void testRequiredFirstNameBlankLastNameShort()
throws ValidatorException {
// Create bean to run test on.
@@ -192,6 +196,7 @@ public void testBothBlank() throws ValidatorException {
/**
* If first name is ok and last name is ok and is an int, no errors.
*/
+ @Test
public void testRequiredLastNameLong() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -225,6 +230,7 @@ public void testBothBlank() throws ValidatorException {
/**
* If the first name is there, and the last name fails int, we should get one error.
*/
+ @Test
public void testRequiredLastNameShort() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
diff --git a/src/test/java/org/apache/commons/validator/MultipleTest.java b/src/test/java/org/apache/commons/validator/MultipleTest.java
index 474ec9c5..5c426dc4 100644
--- a/src/test/java/org/apache/commons/validator/MultipleTest.java
+++ b/src/test/java/org/apache/commons/validator/MultipleTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.validator;
import java.io.IOException;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -57,7 +58,8 @@ protected void tearDown() {
/**
* With nothing provided, we should fail both because both are required.
*/
- public void testBothBlank() throws ValidatorException {
+ @Test
+ public void testBothBlank() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -96,7 +98,8 @@ protected void tearDown() {
*
* @throws ValidatorException
*/
- public void testFailingFirstDependentValidator() throws ValidatorException {
+ @Test
+ public void testFailingFirstDependentValidator() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -131,7 +134,8 @@ protected void tearDown() {
*
* @throws ValidatorException
*/
- public void testFailingNextDependentValidator() throws ValidatorException {
+ @Test
+ public void testFailingNextDependentValidator() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setMiddleName("TEST");
@@ -167,7 +171,8 @@ protected void tearDown() {
*
* @throws ValidatorException
*/
- public void testPassingDependentsFailingMain() throws ValidatorException {
+ @Test
+ public void testPassingDependentsFailingMain() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setMiddleName("-2534");
@@ -204,7 +209,8 @@ protected void tearDown() {
*
* @throws ValidatorException
*/
- public void testPassingDependentsPassingMain() throws ValidatorException {
+ @Test
+ public void testPassingDependentsPassingMain() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setMiddleName("2534");
@@ -238,7 +244,8 @@ protected void tearDown() {
/**
* If the first name fails required, and the second test fails int, we should get two errors.
*/
- public void testRequiredFirstNameBlankLastNameShort() throws ValidatorException {
+ @Test
+ public void testRequiredFirstNameBlankLastNameShort() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setFirstName("");
@@ -271,7 +278,8 @@ protected void tearDown() {
/**
* If first name is ok and last name is ok and is an int, no errors.
*/
- public void testRequiredLastNameLong() throws ValidatorException {
+ @Test
+ public void testRequiredLastNameLong() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setFirstName("Joe");
@@ -304,7 +312,8 @@ protected void tearDown() {
/**
* If the first name is there, and the last name fails int, we should get one error.
*/
- public void testRequiredLastNameShort() throws ValidatorException {
+ @Test
+ public void testRequiredLastNameShort() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setFirstName("Test");
diff --git a/src/test/java/org/apache/commons/validator/ParameterTest.java b/src/test/java/org/apache/commons/validator/ParameterTest.java
index 30f2dcb3..f8cceaa9 100644
--- a/src/test/java/org/apache/commons/validator/ParameterTest.java
+++ b/src/test/java/org/apache/commons/validator/ParameterTest.java
@@ -19,6 +19,7 @@ package org.apache.commons.validator;
import java.io.IOException;
import java.util.Locale;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -83,6 +84,7 @@ public class ParameterTest extends AbstractCommonTest {
/**
* Test all validations ran and passed.
*/
+ @Test
public void testAllValid() {
// Create bean to run test on.
diff --git a/src/test/java/org/apache/commons/validator/RequiredIfTest.java b/src/test/java/org/apache/commons/validator/RequiredIfTest.java
index 13e2a270..e018013d 100644
--- a/src/test/java/org/apache/commons/validator/RequiredIfTest.java
+++ b/src/test/java/org/apache/commons/validator/RequiredIfTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.validator;
import java.io.IOException;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -58,7 +59,8 @@ protected void tearDown() {
* With nothing provided, we should pass since the fields only fail on
* null if the other field is non-blank.
*/
- public void testRequired() throws ValidatorException {
+ @Test
+ public void testRequired() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -93,7 +95,8 @@ protected void tearDown() {
/**
* Tests the required validation for last name.
*/
- public void testRequiredFirstName() throws ValidatorException {
+ @Test
+ public void testRequiredFirstName() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setFirstName("Test");
@@ -126,7 +129,8 @@ protected void tearDown() {
/**
* Tests the required validation for first name if it is blank.
*/
- public void testRequiredFirstNameBlank() throws ValidatorException {
+ @Test
+ public void testRequiredFirstNameBlank() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setFirstName("");
@@ -159,7 +163,8 @@ protected void tearDown() {
/**
* Tests the required validation for last name.
*/
- public void testRequiredLastName() throws ValidatorException {
+ @Test
+ public void testRequiredLastName() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setFirstName("Joe");
@@ -193,7 +198,8 @@ protected void tearDown() {
/**
* Tests the required validation for last name if it is blank.
*/
- public void testRequiredLastNameBlank() throws ValidatorException {
+ @Test
+ public void testRequiredLastNameBlank() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setFirstName("Joe");
diff --git a/src/test/java/org/apache/commons/validator/RequiredNameTest.java b/src/test/java/org/apache/commons/validator/RequiredNameTest.java
index c29ff071..7e707255 100644
--- a/src/test/java/org/apache/commons/validator/RequiredNameTest.java
+++ b/src/test/java/org/apache/commons/validator/RequiredNameTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.validator;
import java.io.IOException;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -57,7 +58,8 @@ protected void tearDown() {
/**
* Tests the required validation failure.
*/
- public void testRequired() throws ValidatorException {
+ @Test
+ public void testRequired() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
@@ -92,7 +94,8 @@ protected void tearDown() {
/**
* Tests the required validation for first name.
*/
- public void testRequiredFirstName() throws ValidatorException {
+ @Test
+ public void testRequiredFirstName() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setFirstName("Joe");
@@ -124,7 +127,8 @@ protected void tearDown() {
/**
* Tests the required validation for first name if it is blank.
*/
- public void testRequiredFirstNameBlank() throws ValidatorException {
+ @Test
+ public void testRequiredFirstNameBlank() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setFirstName("");
@@ -156,7 +160,8 @@ protected void tearDown() {
/**
* Tests the required validation for last name.
*/
- public void testRequiredLastName() throws ValidatorException {
+ @Test
+ public void testRequiredLastName() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setLastName("Smith");
@@ -189,7 +194,8 @@ protected void tearDown() {
/**
* Tests the required validation for last name if it is blank.
*/
- public void testRequiredLastNameBlank() throws ValidatorException {
+ @Test
+ public void testRequiredLastNameBlank() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setLastName("");
@@ -221,7 +227,8 @@ protected void tearDown() {
/**
* Tests the required validation for first and last name.
*/
- public void testRequiredName() throws ValidatorException {
+ @Test
+ public void testRequiredName() throws ValidatorException {
// Create bean to run test on.
final NameBean name = new NameBean();
name.setFirstName("Joe");
diff --git a/src/test/java/org/apache/commons/validator/RetrieveFormTest.java b/src/test/java/org/apache/commons/validator/RetrieveFormTest.java
index 6501b7cd..d80ea672 100644
--- a/src/test/java/org/apache/commons/validator/RetrieveFormTest.java
+++ b/src/test/java/org/apache/commons/validator/RetrieveFormTest.java
@@ -22,6 +22,7 @@ import java.util.Locale;
import junit.framework.TestCase;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -94,6 +95,7 @@ protected void setUp() throws IOException, SAXException {
/**
* Test a form defined only in the "default" formset.
*/
+ @Test
public void testDefaultForm() {
final String formKey = FORM_PREFIX + "default";
@@ -121,6 +123,7 @@ protected void setUp() throws IOException, SAXException {
/**
* Test a form not defined
*/
+ @Test
public void testFormNotFound() {
final String formKey = "INVALID_NAME";
@@ -150,6 +153,7 @@ protected void setUp() throws IOException, SAXException {
* where just the "language" is specified and formset where
* the language and country are specified.
*/
+ @Test
public void testLanguageCountryForm() {
final String formKey = FORM_PREFIX + "language_country";
@@ -177,7 +181,8 @@ protected void setUp() throws IOException, SAXException {
/**
* Test a form defined in all the formsets
*/
- public void testLanguageCountryVariantForm() {
+ @Test
+ public void testLanguageCountryVariantForm() {
final String formKey = FORM_PREFIX + "language_country_variant";
@@ -205,7 +210,8 @@ protected void setUp() throws IOException, SAXException {
* Test a form defined in the "default" formset and formsets
* where just the "language" is specified.
*/
- public void testLanguageForm() {
+ @Test
+ public void testLanguageForm() {
final String formKey = FORM_PREFIX + "language";
diff --git a/src/test/java/org/apache/commons/validator/ShortTest.java b/src/test/java/org/apache/commons/validator/ShortTest.java
index c3013069..c6246da9 100644
--- a/src/test/java/org/apache/commons/validator/ShortTest.java
+++ b/src/test/java/org/apache/commons/validator/ShortTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator;
+import org.junit.Test;
+
/**
* Performs Validation Test for <code>short</code> validations.
*/
@@ -30,7 +32,8 @@ public class ShortTest extends AbstractNumberTest {
/**
* Tests the short validation failure.
*/
- public void testShortBeyondMax() throws ValidatorException {
+ @Test
+ public void testShortBeyondMax() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
info.setValue(Short.MAX_VALUE + "1");
@@ -41,7 +44,8 @@ public class ShortTest extends AbstractNumberTest {
/**
* Tests the short validation failure.
*/
- public void testShortBeyondMin() throws ValidatorException {
+ @Test
+ public void testShortBeyondMin() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
info.setValue(Short.MIN_VALUE + "1");
@@ -52,7 +56,8 @@ public class ShortTest extends AbstractNumberTest {
/**
* Tests the short validation.
*/
- public void testShortMax() throws ValidatorException {
+ @Test
+ public void testShortMax() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
info.setValue(Short.toString(Short.MAX_VALUE));
@@ -63,7 +68,8 @@ public class ShortTest extends AbstractNumberTest {
/**
* Tests the short validation.
*/
- public void testShortMin() throws ValidatorException {
+ @Test
+ public void testShortMin() throws ValidatorException {
// Create bean to run test on.
final ValueBean info = new ValueBean();
info.setValue(Short.toString(Short.MIN_VALUE));
diff --git a/src/test/java/org/apache/commons/validator/UrlTest.java b/src/test/java/org/apache/commons/validator/UrlTest.java
index cd91c387..dd964c8d 100644
--- a/src/test/java/org/apache/commons/validator/UrlTest.java
+++ b/src/test/java/org/apache/commons/validator/UrlTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Performs Validation Test for url validations.
*
@@ -166,7 +168,8 @@ protected void setUp() {
testPartsIndex[index] = 0;
}
}
- public void testIsValid() {
+ @Test
+ public void testIsValid() {
testIsValid(testUrlParts, UrlValidator.ALLOW_ALL_SCHEMES);
setUp();
final int options =
@@ -182,7 +185,8 @@ protected void setUp() {
*
* @param testObjects Used to create a url.
*/
- public void testIsValid(final Object[] testObjects, final int options) {
+ @Test
+ public void testIsValid(final Object[] testObjects, final int options) {
final UrlValidator urlVal = new UrlValidator(null, options);
assertTrue(urlVal.isValid("http://www.google.com"));
assertTrue(urlVal.isValid("http://www.google.com/"));
@@ -223,7 +227,8 @@ protected void setUp() {
}
}
- public void testIsValidScheme() {
+ @Test
+ public void testIsValidScheme() {
if (printStatus) {
System.out.print("\n testIsValidScheme() ");
}
@@ -260,16 +265,19 @@ protected void setUp() {
return carryMsg.toString();
}
- public void testValidateUrl() {
+ @Test
+ public void testValidateUrl() {
assertTrue(true);
}
- public void testValidator202() {
+ @Test
+ public void testValidator202() {
final String[] schemes = {"http","https"};
final UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.NO_FRAGMENTS);
urlValidator.isValid("http://www.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks.comwww.logoworks. [...]
}
- public void testValidator204() {
+ @Test
+ public void testValidator204() {
final String[] schemes = {"http","https"};
final UrlValidator urlValidator = new UrlValidator(schemes);
assertTrue(urlValidator.isValid("http://tech.yahoo.com/rc/desktops/102;_ylt=Ao8yevQHlZ4On0O3ZJGXLEQFLZA5"));
diff --git a/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java b/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java
index e590dad3..8b54fc7a 100644
--- a/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java
+++ b/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java
@@ -20,6 +20,8 @@ import java.io.InputStream;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Test ValidatorResources.
*/
@@ -35,6 +37,7 @@ public class ValidatorResourcesTest extends TestCase {
/**
* Test null Input Stream for Validator Resources.
*/
+ @Test
public void testNullInputStream() throws Exception {
try {
diff --git a/src/test/java/org/apache/commons/validator/ValidatorResultsTest.java b/src/test/java/org/apache/commons/validator/ValidatorResultsTest.java
index 3c6dbc3f..1e1dd531 100644
--- a/src/test/java/org/apache/commons/validator/ValidatorResultsTest.java
+++ b/src/test/java/org/apache/commons/validator/ValidatorResultsTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.validator;
import java.io.IOException;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -96,7 +97,8 @@ protected void tearDown() {
/**
* Test all validations ran and passed.
*/
- public void testAllValid() throws ValidatorException {
+ @Test
+ public void testAllValid() throws ValidatorException {
// Create bean to run test on.
final NameBean bean = createNameBean();
@@ -117,7 +119,8 @@ protected void tearDown() {
/**
* Test some validations failed and some didn't run.
*/
- public void testErrors() throws ValidatorException {
+ @Test
+ public void testErrors() throws ValidatorException {
middleName = "XXX";
lastName = null;
diff --git a/src/test/java/org/apache/commons/validator/ValidatorTest.java b/src/test/java/org/apache/commons/validator/ValidatorTest.java
index 25bde50f..f22f62a0 100644
--- a/src/test/java/org/apache/commons/validator/ValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/ValidatorTest.java
@@ -26,6 +26,7 @@ import java.util.Locale;
import junit.framework.TestCase;
import org.apache.commons.validator.util.ValidatorUtils;
+import org.junit.Test;
/**
* Performs Validation Test.
@@ -126,6 +127,7 @@ public class ValidatorTest extends TestCase {
* Verify that one value generates an error and the other passes. The validation
* method being tested returns a <code>boolean</code> value.
*/
+ @Test
public void testManualBoolean() {
final ValidatorResources resources = new ValidatorResources();
@@ -181,6 +183,7 @@ public class ValidatorTest extends TestCase {
* Verify that one value generates an error and the other passes. The validation
* method being tested returns a <code>boolean</code> value.
*/
+ @Test
public void testManualBooleanDeprecated() {
final ValidatorResources resources = new ValidatorResources();
@@ -236,7 +239,8 @@ public class ValidatorTest extends TestCase {
* Verify that one value generates an error and the other passes. The validation
* method being tested returns an object (<code>null</code> will be considered an error).
*/
- public void testManualObject() {
+ @Test
+ public void testManualObject() {
// property name of the method we are validating
final String property = "date";
// name of ValidatorAction
@@ -285,7 +289,8 @@ public class ValidatorTest extends TestCase {
}
- public void testOnlyReturnErrors() throws ValidatorException {
+ @Test
+ public void testOnlyReturnErrors() throws ValidatorException {
// property name of the method we are validating
final String property = "date";
// name of ValidatorAction
@@ -311,7 +316,8 @@ public class ValidatorTest extends TestCase {
assertFalse(results.getPropertyNames().contains(property));
}
- public void testOnlyValidateField() throws ValidatorException {
+ @Test
+ public void testOnlyValidateField() throws ValidatorException {
// property name of the method we are validating
final String property = "date";
// name of ValidatorAction
diff --git a/src/test/java/org/apache/commons/validator/VarTest.java b/src/test/java/org/apache/commons/validator/VarTest.java
index ea43a3e8..3d2b87b4 100644
--- a/src/test/java/org/apache/commons/validator/VarTest.java
+++ b/src/test/java/org/apache/commons/validator/VarTest.java
@@ -19,6 +19,7 @@ package org.apache.commons.validator;
import java.io.IOException;
import java.util.Locale;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -59,7 +60,8 @@ protected void tearDown() {
/**
* With nothing provided, we should fail both because both are required.
*/
- public void testVars() {
+ @Test
+ public void testVars() {
final Form form = resources.getForm(Locale.getDefault(), FORM_KEY);
diff --git a/src/test/java/org/apache/commons/validator/routines/AbstractCalendarValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/AbstractCalendarValidatorTest.java
index 530f6876..97bfb565 100644
--- a/src/test/java/org/apache/commons/validator/routines/AbstractCalendarValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/AbstractCalendarValidatorTest.java
@@ -27,6 +27,8 @@ import java.util.TimeZone;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Base Calendar Test Case.
*/
@@ -151,6 +153,7 @@ public abstract class AbstractCalendarValidatorTest extends TestCase {
/**
* Test Invalid Dates with "locale" validation
*/
+ @Test
public void testFormat() {
// Create a Date or Calendar
@@ -163,6 +166,7 @@ public abstract class AbstractCalendarValidatorTest extends TestCase {
/**
* Test Invalid Dates with "locale" validation
*/
+ @Test
public void testLocaleInvalid() {
for (int i = 0; i < localeInvalid.length; i++) {
final String text = i + " value=[" +localeInvalid[i]+"] passed ";
@@ -175,6 +179,7 @@ public abstract class AbstractCalendarValidatorTest extends TestCase {
/**
* Test Valid Dates with "locale" validation
*/
+ @Test
public void testLocaleValid() {
for (int i = 0; i < localeValid.length; i++) {
final String text = i + " value=[" +localeValid[i]+"] failed ";
@@ -191,6 +196,7 @@ public abstract class AbstractCalendarValidatorTest extends TestCase {
/**
* Test Invalid Dates with "pattern" validation
*/
+ @Test
public void testPatternInvalid() {
for (int i = 0; i < patternInvalid.length; i++) {
final String text = i + " value=[" +patternInvalid[i]+"] passed ";
@@ -203,6 +209,7 @@ public abstract class AbstractCalendarValidatorTest extends TestCase {
/**
* Test Valid Dates with "pattern" validation
*/
+ @Test
public void testPatternValid() {
for (int i = 0; i < patternValid.length; i++) {
final String text = i + " value=[" +patternValid[i]+"] failed ";
@@ -219,6 +226,7 @@ public abstract class AbstractCalendarValidatorTest extends TestCase {
/**
* Test validator serialization.
*/
+ @Test
public void testSerialization() {
// Serialize the check digit routine
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
diff --git a/src/test/java/org/apache/commons/validator/routines/AbstractNumberValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/AbstractNumberValidatorTest.java
index f1b85c6b..24b60543 100644
--- a/src/test/java/org/apache/commons/validator/routines/AbstractNumberValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/AbstractNumberValidatorTest.java
@@ -25,6 +25,8 @@ import java.text.DecimalFormat;
import java.util.Locale;
import junit.framework.TestCase;
+
+import org.junit.Test;
/**
* Base Number Test Case.
*/
@@ -81,6 +83,7 @@ public abstract class AbstractNumberValidatorTest extends TestCase {
/**
* Test format() methods
*/
+ @Test
public void testFormat() {
final Number number = new BigDecimal("1234.5");
assertEquals("US Locale, US Format", "1,234.5", strictValidator.format(number, Locale.US));
@@ -91,6 +94,7 @@ public abstract class AbstractNumberValidatorTest extends TestCase {
/**
* Test Format Type
*/
+ @Test
public void testFormatType() {
assertEquals("Format Type A", 0, validator.getFormatType());
assertEquals("Format Type B", AbstractNumberValidator.STANDARD_FORMAT, validator.getFormatType());
@@ -99,6 +103,7 @@ public abstract class AbstractNumberValidatorTest extends TestCase {
/**
* Test Invalid, strict=false
*/
+ @Test
public void testInvalidNotStrict() {
for (int i = 0; i < invalid.length; i++) {
final String text = "idx=["+i+"] value=[" + invalid[i] + "]";
@@ -112,6 +117,7 @@ public abstract class AbstractNumberValidatorTest extends TestCase {
/**
* Test Invalid, strict=true
*/
+ @Test
public void testInvalidStrict() {
for (int i = 0; i < invalidStrict.length; i++) {
final String text = "idx=["+i+"] value=[" + invalidStrict[i] + "]";
@@ -125,6 +131,7 @@ public abstract class AbstractNumberValidatorTest extends TestCase {
/**
* Test Range/Min/Max
*/
+ @Test
public void testRangeMinMax() {
final Number number9 = Integer.valueOf(9);
final Number number10 = Integer.valueOf(10);
@@ -154,6 +161,7 @@ public abstract class AbstractNumberValidatorTest extends TestCase {
/**
* Test validator serialization.
*/
+ @Test
public void testSerialization() {
// Serialize the check digit routine
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -183,6 +191,7 @@ public abstract class AbstractNumberValidatorTest extends TestCase {
/**
* Test different Locale
*/
+ @Test
public void testValidateLocale() {
assertEquals("US Locale, US Format", testNumber, strictValidator.parse(testStringUS, null, Locale.US));
@@ -200,6 +209,7 @@ public abstract class AbstractNumberValidatorTest extends TestCase {
/**
* Test Min/Max values allowed
*/
+ @Test
public void testValidateMinMax() {
final DecimalFormat fmt = new DecimalFormat("#");
if (max != null) {
@@ -213,6 +223,7 @@ public abstract class AbstractNumberValidatorTest extends TestCase {
/**
* Test Valid, strict=false
*/
+ @Test
public void testValidNotStrict() {
for (int i = 0; i < valid.length; i++) {
final String text = "idx=["+i+"] value=[" + validCompare[i] + "]";
@@ -226,6 +237,7 @@ public abstract class AbstractNumberValidatorTest extends TestCase {
/**
* Test Valid, strict=true
*/
+ @Test
public void testValidStrict() {
for (int i = 0; i < validStrict.length; i++) {
final String text = "idx=["+i+"] value=[" + validStrictCompare[i] + "]";
diff --git a/src/test/java/org/apache/commons/validator/routines/BigDecimalValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/BigDecimalValidatorTest.java
index 57235d41..554fe7aa 100644
--- a/src/test/java/org/apache/commons/validator/routines/BigDecimalValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/BigDecimalValidatorTest.java
@@ -19,6 +19,8 @@ package org.apache.commons.validator.routines;
import java.math.BigDecimal;
import java.util.Locale;
+import org.junit.Test;
+
/**
* Test Case for BigDecimalValidator.
*/
@@ -77,6 +79,7 @@ public class BigDecimalValidatorTest extends AbstractNumberValidatorTest {
/**
* Test BigDecimal Range/Min/Max
*/
+ @Test
public void testBigDecimalRangeMinMax() {
final BigDecimalValidator validator = new BigDecimalValidator(true, AbstractNumberValidator.STANDARD_FORMAT, true);
final BigDecimal number9 = new BigDecimal("9");
@@ -110,6 +113,7 @@ public class BigDecimalValidatorTest extends AbstractNumberValidatorTest {
/**
* Test BigDecimalValidator validate Methods
*/
+ @Test
public void testBigDecimalValidatorMethods() {
final Locale locale = Locale.GERMAN;
final String pattern = "0,00,00";
diff --git a/src/test/java/org/apache/commons/validator/routines/BigIntegerValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/BigIntegerValidatorTest.java
index bc1b5a19..67b3cbfc 100644
--- a/src/test/java/org/apache/commons/validator/routines/BigIntegerValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/BigIntegerValidatorTest.java
@@ -19,6 +19,8 @@ package org.apache.commons.validator.routines;
import java.math.BigInteger;
import java.util.Locale;
+import org.junit.Test;
+
/**
* Test Case for BigIntegerValidator.
*/
@@ -75,6 +77,7 @@ public class BigIntegerValidatorTest extends AbstractNumberValidatorTest {
/**
* Test BigInteger Range/Min/Max
*/
+ @Test
public void testBigIntegerRangeMinMax() {
final BigIntegerValidator validator = (BigIntegerValidator)strictValidator;
final BigInteger number9 = validator.validate("9", "#");
@@ -105,6 +108,7 @@ public class BigIntegerValidatorTest extends AbstractNumberValidatorTest {
/**
* Test BigIntegerValidator validate Methods
*/
+ @Test
public void testBigIntegerValidatorMethods() {
final Locale locale = Locale.GERMAN;
final String pattern = "0,00,00";
diff --git a/src/test/java/org/apache/commons/validator/routines/ByteValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/ByteValidatorTest.java
index a1283c50..c99569d6 100644
--- a/src/test/java/org/apache/commons/validator/routines/ByteValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/ByteValidatorTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator.routines;
import java.util.Locale;
+import org.junit.Test;
+
/**
* Test Case for ByteValidator.
*/
@@ -82,6 +84,7 @@ public class ByteValidatorTest extends AbstractNumberValidatorTest {
/**
* Test Byte Range/Min/Max
*/
+ @Test
public void testByteRangeMinMax() {
final ByteValidator validator = (ByteValidator)strictValidator;
final Byte number9 = validator.validate("9", "#");
@@ -114,6 +117,7 @@ public class ByteValidatorTest extends AbstractNumberValidatorTest {
/**
* Test ByteValidator validate Methods
*/
+ @Test
public void testByteValidatorMethods() {
final Locale locale = Locale.GERMAN;
final String pattern = "0,00";
diff --git a/src/test/java/org/apache/commons/validator/routines/CalendarValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/CalendarValidatorTest.java
index 9561cd86..e5428c43 100644
--- a/src/test/java/org/apache/commons/validator/routines/CalendarValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/CalendarValidatorTest.java
@@ -23,6 +23,8 @@ import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
+import org.junit.Test;
+
/**
* Test Case for CalendarValidator.
*/
@@ -50,6 +52,7 @@ public class CalendarValidatorTest extends AbstractCalendarValidatorTest {
/**
* Test adjustToTimeZone() method
*/
+ @Test
public void testAdjustToTimeZone() {
final Calendar calEST = createCalendar(EST, DATE_2005_11_23, TIME_12_03_45);
@@ -97,6 +100,7 @@ public class CalendarValidatorTest extends AbstractCalendarValidatorTest {
/**
* Test CalendarValidator validate Methods
*/
+ @Test
public void testCalendarValidatorMethods() {
Locale.setDefault(Locale.US);
final Locale locale = Locale.GERMAN;
@@ -142,6 +146,7 @@ public class CalendarValidatorTest extends AbstractCalendarValidatorTest {
/**
* Test compare date methods
*/
+ @Test
public void testCompare() {
final int sameTime = 124522;
final int testDate = 20050823;
@@ -224,6 +229,7 @@ public class CalendarValidatorTest extends AbstractCalendarValidatorTest {
/**
* Test Date/Time style Validator (there isn't an implementation for this)
*/
+ @Test
public void testDateTimeStyle() {
// Set the default Locale
final Locale origDefault = Locale.getDefault();
@@ -249,6 +255,7 @@ public class CalendarValidatorTest extends AbstractCalendarValidatorTest {
* Test format methods
*/
@Override
+ @Test
public void testFormat() {
// Set the default Locale
final Locale origDefault = Locale.getDefault();
diff --git a/src/test/java/org/apache/commons/validator/routines/CodeValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/CodeValidatorTest.java
index 195ff4be..aa970681 100644
--- a/src/test/java/org/apache/commons/validator/routines/CodeValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/CodeValidatorTest.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import org.apache.commons.validator.routines.checkdigit.CheckDigit;
import org.apache.commons.validator.routines.checkdigit.EAN13CheckDigit;
+import org.junit.Test;
/**
* CodeValidatorTest.java.
@@ -39,6 +40,7 @@ public class CodeValidatorTest extends TestCase {
/**
* Test Check Digit.
*/
+ @Test
public void testCheckDigit() {
CodeValidator validator = new CodeValidator((String)null, -1, -1, (CheckDigit)null);
final String invalidEAN = "9781930110992";
@@ -65,6 +67,7 @@ public class CodeValidatorTest extends TestCase {
/**
* Test Regular Expression.
*/
+ @Test
public void testConstructors() {
CodeValidator validator;
final RegexValidator regex = new RegexValidator("^[0-9]*$");
@@ -115,6 +118,7 @@ public class CodeValidatorTest extends TestCase {
/**
* Test the minimum/maximum length
*/
+ @Test
public void testLength() {
CodeValidator validator = new CodeValidator((String)null, -1, -1, (CheckDigit)null);
final String length_10 = "1234567890";
@@ -175,6 +179,7 @@ public class CodeValidatorTest extends TestCase {
/**
* Test Regular Expression.
*/
+ @Test
public void testNoInput() {
final CodeValidator validator = new CodeValidator((String)null, -1, -1, (CheckDigit)null);
assertEquals("Null", null, validator.validate(null));
@@ -186,6 +191,7 @@ public class CodeValidatorTest extends TestCase {
/**
* Test Regular Expression.
*/
+ @Test
public void testRegex() {
CodeValidator validator = new CodeValidator((String)null, -1, -1, (CheckDigit)null);
@@ -230,6 +236,7 @@ public class CodeValidatorTest extends TestCase {
}
+ @Test
public void testValidator294_1() {
CodeValidator validator = new CodeValidator((String)null, 0, -1, (CheckDigit)null);
assertEquals("Null", null, validator.validate(null));
@@ -237,6 +244,7 @@ public class CodeValidatorTest extends TestCase {
assertEquals("Null", null, validator.validate(null));
}
+ @Test
public void testValidator294_2() {
final CodeValidator validator = new CodeValidator((String)null, -1, 0, (CheckDigit)null);
assertEquals("Null", null, validator.validate(null));
diff --git a/src/test/java/org/apache/commons/validator/routines/CreditCardValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/CreditCardValidatorTest.java
index 1283f34f..3ee0e026 100644
--- a/src/test/java/org/apache/commons/validator/routines/CreditCardValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/CreditCardValidatorTest.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import org.apache.commons.validator.routines.CreditCardValidator.CreditCardRange;
import org.apache.commons.validator.routines.checkdigit.LuhnCheckDigit;
+import org.junit.Test;
/**
* Test the CreditCardValidator class.
@@ -80,6 +81,7 @@ public class CreditCardValidatorTest extends TestCase {
super(name);
}
+ @Test
public void testAddAllowedCardType() {
final CreditCardValidator ccv = new CreditCardValidator(CreditCardValidator.NONE);
// Turned off all cards so even valid numbers should fail
@@ -93,6 +95,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the Amex Card option
*/
+ @Test
public void testAmexOption() {
final CreditCardValidator validator = new CreditCardValidator(CreditCardValidator.AMEX);
assertFalse("Invalid", validator.isValid(ERROR_AMEX));
@@ -110,6 +113,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the Amex Card validator
*/
+ @Test
public void testAmexValidator() {
final CodeValidator validator = CreditCardValidator.AMEX_VALIDATOR;
@@ -155,6 +159,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the CodeValidator array constructor
*/
+ @Test
public void testArrayConstructor() {
final CreditCardValidator ccv = new CreditCardValidator(new CodeValidator[]
{CreditCardValidator.VISA_VALIDATOR, CreditCardValidator.AMEX_VALIDATOR});
@@ -182,6 +187,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the Diners Card option
*/
+ @Test
public void testDinersOption() {
final CreditCardValidator validator = new CreditCardValidator(CreditCardValidator.DINERS);
assertFalse("Invalid", validator.isValid(ERROR_DINERS));
@@ -199,6 +205,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the Diners Card validator
*/
+ @Test
public void testDinersValidator() {
final CodeValidator validator = CreditCardValidator.DINERS_VALIDATOR;
@@ -262,6 +269,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the Discover Card option
*/
+ @Test
public void testDiscoverOption() {
final CreditCardValidator validator = new CreditCardValidator(CreditCardValidator.DISCOVER);
assertFalse("Invalid", validator.isValid(ERROR_DISCOVER));
@@ -282,6 +290,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the Discover Card validator
*/
+ @Test
public void testDiscoverValidator() {
final CodeValidator validator = CreditCardValidator.DISCOVER_VALIDATOR;
@@ -336,6 +345,7 @@ public class CreditCardValidatorTest extends TestCase {
}
+ @Test
public void testDisjointRange() {
CreditCardValidator ccv = new CreditCardValidator(
new CreditCardRange[]{
@@ -359,6 +369,7 @@ public class CreditCardValidatorTest extends TestCase {
assertTrue(ccv.isValid(VALID_DINERS));
}
+ @Test
public void testGeneric() {
final CreditCardValidator ccv = CreditCardValidator.genericCreditCardValidator();
for(final String s : VALID_CARDS) {
@@ -369,6 +380,7 @@ public class CreditCardValidatorTest extends TestCase {
}
}
+ @Test
public void testIsValid() {
CreditCardValidator ccv = new CreditCardValidator();
@@ -402,6 +414,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the Mastercard Card option
*/
+ @Test
public void testMastercardOption() {
final CreditCardValidator validator = new CreditCardValidator(CreditCardValidator.MASTERCARD);
assertFalse("Invalid", validator.isValid(ERROR_MASTERCARD));
@@ -419,6 +432,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test using separators
*/
+ @Test
public void testMastercardUsingSeparators() {
final String MASTERCARD_REGEX_SEP = "^(5[1-5]\\d{2})(?:[- ])?(\\d{4})(?:[- ])?(\\d{4})(?:[- ])?(\\d{4})$";
@@ -449,6 +463,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the Mastercard Card validator
*/
+ @Test
public void testMastercardValidator() {
final CodeValidator validator = CreditCardValidator.MASTERCARD_VALIDATOR;
@@ -503,6 +518,7 @@ public class CreditCardValidatorTest extends TestCase {
assertFalse("272100",rev.isValid("272100"+PAD));
}
+ @Test
public void testRangeGenerator() {
final CreditCardValidator ccv = new CreditCardValidator(
new CodeValidator[] {
@@ -528,6 +544,7 @@ public class CreditCardValidatorTest extends TestCase {
}
}
+ @Test
public void testRangeGeneratorNoLuhn() {
final CodeValidator cv = CreditCardValidator.createRangeValidator(
new CreditCardRange[]{
@@ -549,6 +566,7 @@ public class CreditCardValidatorTest extends TestCase {
assertFalse(cv.isValid("66000000"));
}
+ @Test
public void testValidLength() {
assertTrue(CreditCardValidator.validLength(14, new CreditCardRange("", "", 14, 14)));
assertFalse(CreditCardValidator.validLength(15, new CreditCardRange("", "", 14, 14)));
@@ -570,6 +588,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the Visa Card option
*/
+ @Test
public void testVisaOption() {
final CreditCardValidator validator = new CreditCardValidator(CreditCardValidator.VISA);
assertFalse("Invalid", validator.isValid(ERROR_VISA));
@@ -589,6 +608,7 @@ public class CreditCardValidatorTest extends TestCase {
/**
* Test the Visa Card validator
*/
+ @Test
public void testVisaValidator() {
final CodeValidator validator = CreditCardValidator.VISA_VALIDATOR;
@@ -631,6 +651,7 @@ public class CreditCardValidatorTest extends TestCase {
assertTrue("Valid-E", validator.isValid("4012888888881881"));
}
+ @Test
public void testVPayOption() {
final CreditCardValidator validator = new CreditCardValidator(CreditCardValidator.VPAY);
assertTrue("Valid", validator.isValid(VALID_VPAY));
diff --git a/src/test/java/org/apache/commons/validator/routines/CurrencyValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/CurrencyValidatorTest.java
index 9ffdabd2..36af2032 100644
--- a/src/test/java/org/apache/commons/validator/routines/CurrencyValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/CurrencyValidatorTest.java
@@ -22,6 +22,8 @@ import java.util.Locale;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Test Case for CurrencyValidator.
*/
@@ -49,6 +51,7 @@ public class CurrencyValidatorTest extends TestCase {
/**
* Test Format Type
*/
+ @Test
public void testFormatType() {
assertEquals("Format Type A", 1, CurrencyValidator.getInstance().getFormatType());
assertEquals("Format Type B", AbstractNumberValidator.CURRENCY_FORMAT, CurrencyValidator.getInstance().getFormatType());
@@ -57,6 +60,7 @@ public class CurrencyValidatorTest extends TestCase {
/**
* Test Invalid integer (non decimal) currency values
*/
+ @Test
public void testIntegerInvalid() {
final CurrencyValidator validator = new CurrencyValidator(true, false);
@@ -72,6 +76,7 @@ public class CurrencyValidatorTest extends TestCase {
/**
* Test Valid integer (non-decimal) currency values
*/
+ @Test
public void testIntegerValid() {
// Set the default Locale
final Locale origDefault = Locale.getDefault();
@@ -96,6 +101,7 @@ public class CurrencyValidatorTest extends TestCase {
/**
* Test Invalid currency values
*/
+ @Test
public void testInvalid() {
final BigDecimalValidator validator = CurrencyValidator.getInstance();
@@ -117,6 +123,7 @@ public class CurrencyValidatorTest extends TestCase {
/**
* Test currency values with a pattern
*/
+ @Test
public void testPattern() {
// Set the default Locale
final Locale origDefault = Locale.getDefault();
@@ -151,6 +158,7 @@ public class CurrencyValidatorTest extends TestCase {
/**
* Test Valid currency values
*/
+ @Test
public void testValid() {
// Set the default Locale
final Locale origDefault = Locale.getDefault();
diff --git a/src/test/java/org/apache/commons/validator/routines/DateValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/DateValidatorTest.java
index 4fc7e230..cc8e9186 100644
--- a/src/test/java/org/apache/commons/validator/routines/DateValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/DateValidatorTest.java
@@ -21,6 +21,8 @@ import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
+import org.junit.Test;
+
/**
* Test Case for DateValidator.
*/
@@ -48,6 +50,7 @@ public class DateValidatorTest extends AbstractCalendarValidatorTest {
/**
* Test compare date methods
*/
+ @Test
public void testCompare() {
final int sameTime = 124522;
final int testDate = 20050823;
@@ -120,6 +123,7 @@ public class DateValidatorTest extends AbstractCalendarValidatorTest {
/**
* Test DateValidator validate Methods
*/
+ @Test
public void testDateValidatorMethods() {
Locale.setDefault(Locale.US);
final Locale locale = Locale.GERMAN;
@@ -167,6 +171,7 @@ public class DateValidatorTest extends AbstractCalendarValidatorTest {
* Check that locale providers are set up correctly
* If not, the parse will fail
*/
+ @Test
public void testLocaleProviders() throws Exception {
final String localeProviders = System.getProperty("java.locale.providers");
if (localeProviders != null) { // may be null before Java 9
diff --git a/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
index 276a70a7..776ae26e 100644
--- a/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
@@ -43,6 +43,7 @@ import java.util.regex.Pattern;
import junit.framework.TestCase;
import org.apache.commons.validator.routines.DomainValidator.ArrayType;
+import org.junit.Test;
/**
* Tests for the DomainValidator.
@@ -379,29 +380,34 @@ public class DomainValidatorTest extends TestCase {
}
// Check array is sorted and is lower-case
+ @Test
public void test_COUNTRY_CODE_TLDS_sortedAndLowerCase() throws Exception {
final boolean sorted = isSortedLowerCase("COUNTRY_CODE_TLDS");
assertTrue(sorted);
}
// Check array is sorted and is lower-case
+ @Test
public void test_GENERIC_TLDS_sortedAndLowerCase() throws Exception {
final boolean sorted = isSortedLowerCase("GENERIC_TLDS");
assertTrue(sorted);
}
// Check array is sorted and is lower-case
+ @Test
public void test_INFRASTRUCTURE_TLDS_sortedAndLowerCase() throws Exception {
final boolean sorted = isSortedLowerCase("INFRASTRUCTURE_TLDS");
assertTrue(sorted);
}
// Check array is sorted and is lower-case
+ @Test
public void test_LOCAL_TLDS_sortedAndLowerCase() throws Exception {
final boolean sorted = isSortedLowerCase("LOCAL_TLDS");
assertTrue(sorted);
}
+ @Test
public void testAllowLocal() {
final DomainValidator noLocal = DomainValidator.getInstance(false);
final DomainValidator allowLocal = DomainValidator.getInstance(true);
@@ -424,6 +430,7 @@ public class DomainValidatorTest extends TestCase {
assertFalse("domain name with spaces shouldn't validate", allowLocal.isValid(" apache.org "));
}
+ @Test
public void testDomainNoDots() {// rfc1123
assertTrue("a (alpha) should validate", validator.isValidDomainSyntax("a"));
assertTrue("9 (alphanum) should validate", validator.isValidDomainSyntax("9"));
@@ -434,10 +441,12 @@ public class DomainValidatorTest extends TestCase {
assertFalse("- (-) should fail", validator.isValidDomainSyntax("-"));
}
+ @Test
public void testEnumIsPublic() {
assertTrue(Modifier.isPublic(DomainValidator.ArrayType.class.getModifiers()));
}
+ @Test
public void testGetArray() {
assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_MINUS));
assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_PLUS));
@@ -451,10 +460,12 @@ public class DomainValidatorTest extends TestCase {
assertNotNull(DomainValidator.getTLDEntries(ArrayType.LOCAL_RO));
}
+ @Test
public void testIDN() {
assertTrue("b\u00fccher.ch in IDN should validate", validator.isValid("www.xn--bcher-kva.ch"));
}
+ @Test
public void testIDNJava6OrLater() {
final String version = System.getProperty("java.version");
if (version.compareTo("1.6") < 0) {
@@ -467,6 +478,7 @@ public class DomainValidatorTest extends TestCase {
assertFalse("www.\uFFFD.ch FFFD should fail", validator.isValid("www.\uFFFD.ch"));
}
+ @Test
public void testInvalidDomains() {
assertFalse("bare TLD .org shouldn't validate", validator.isValid(".org"));
assertFalse("domain name with spaces shouldn't validate", validator.isValid(" apache.org "));
@@ -483,6 +495,7 @@ public class DomainValidatorTest extends TestCase {
}
// Check if IDN.toASCII is broken or not
+ @Test
public void testIsIDNtoASCIIBroken() {
System.out.println(">>DomainValidatorTest.testIsIDNtoASCIIBroken()");
final String input = ".";
@@ -510,6 +523,7 @@ public class DomainValidatorTest extends TestCase {
}
// RFC2396: domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
+ @Test
public void testRFC2396domainlabel() { // use fixed valid TLD
assertTrue("a.ch should validate", validator.isValid("a.ch"));
assertTrue("9.ch should validate", validator.isValid("9.ch"));
@@ -521,6 +535,7 @@ public class DomainValidatorTest extends TestCase {
}
// RFC2396 toplabel = alpha | alpha *( alphanum | "-" ) alphanum
+ @Test
public void testRFC2396toplabel() {
// These tests use non-existent TLDs so currently need to use a package protected method
assertTrue("a.c (alpha) should validate", validator.isValidDomainSyntax("a.c"));
@@ -535,6 +550,7 @@ public class DomainValidatorTest extends TestCase {
assertFalse("a.-9 (- alphanum) should fail", validator.isValidDomainSyntax("a.-9"));
}
+ @Test
public void testTopLevelDomains() {
// infrastructure TLDs
assertTrue(".arpa should validate as iTLD", validator.isValidInfrastructureTld(".arpa"));
@@ -560,6 +576,7 @@ public class DomainValidatorTest extends TestCase {
// Check that IDN.toASCII behaves as it should (when wrapped by DomainValidator.unicodeToASCII)
// Tests show that method incorrectly trims a trailing "." character
+ @Test
public void testUnicodeToASCII() {
final String[] asciidots = {
"",
@@ -593,11 +610,13 @@ public class DomainValidatorTest extends TestCase {
}
}
+ @Test
public void testValidator297() {
assertTrue("xn--d1abbgf6aiiy.xn--p1ai should validate", validator.isValid("xn--d1abbgf6aiiy.xn--p1ai")); // This uses a valid TLD
}
// labels are a max of 63 chars and domains 253
+ @Test
public void testValidator306() {
final String longString = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789A";
assertEquals(63, longString.length()); // 26 * 2 + 11
@@ -619,6 +638,7 @@ public class DomainValidatorTest extends TestCase {
assertFalse("254 chars domain should fail", validator.isValidDomainSyntax(longDomain+"x"));
}
+ @Test
public void testValidDomains() {
assertTrue("apache.org should validate", validator.isValid("apache.org"));
assertTrue("www.google.com should validate", validator.isValid("www.google.com"));
diff --git a/src/test/java/org/apache/commons/validator/routines/DoubleValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/DoubleValidatorTest.java
index b6d267aa..c9f43cac 100644
--- a/src/test/java/org/apache/commons/validator/routines/DoubleValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/DoubleValidatorTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator.routines;
import java.util.Locale;
+import org.junit.Test;
+
/**
* Test Case for DoubleValidator.
*/
@@ -74,6 +76,7 @@ public class DoubleValidatorTest extends AbstractNumberValidatorTest {
/**
* Test Double Range/Min/Max
*/
+ @Test
public void testDoubleRangeMinMax() {
final DoubleValidator validator = (DoubleValidator)strictValidator;
final Double number9 = validator.validate("9", "#");
@@ -104,6 +107,7 @@ public class DoubleValidatorTest extends AbstractNumberValidatorTest {
/**
* Test DoubleValidator validate Methods
*/
+ @Test
public void testDoubleValidatorMethods() {
final Locale locale = Locale.GERMAN;
final String pattern = "0,00,00";
diff --git a/src/test/java/org/apache/commons/validator/routines/FloatValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/FloatValidatorTest.java
index 611a7f6c..1389d2e0 100644
--- a/src/test/java/org/apache/commons/validator/routines/FloatValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/FloatValidatorTest.java
@@ -19,6 +19,8 @@ package org.apache.commons.validator.routines;
import java.text.DecimalFormat;
import java.util.Locale;
+import org.junit.Test;
+
/**
* Test Case for FloatValidator.
*/
@@ -75,6 +77,7 @@ public class FloatValidatorTest extends AbstractNumberValidatorTest {
/**
* Test Float Range/Min/Max
*/
+ @Test
public void testFloatRangeMinMax() {
final FloatValidator validator = (FloatValidator)strictValidator;
final Float number9 = validator.validate("9", "#");
@@ -106,6 +109,7 @@ public class FloatValidatorTest extends AbstractNumberValidatorTest {
* Test Float validation for values too small to handle.
* (slightly different from max/min which are the largest +ve/-ve
*/
+ @Test
public void testFloatSmallestValues() {
final String pattern = "#.#################################################################";
final DecimalFormat fmt = new DecimalFormat(pattern);
@@ -134,6 +138,7 @@ public class FloatValidatorTest extends AbstractNumberValidatorTest {
/**
* Test FloatValidator validate Methods
*/
+ @Test
public void testFloatValidatorMethods() {
final Locale locale = Locale.GERMAN;
final String pattern = "0,00,00";
diff --git a/src/test/java/org/apache/commons/validator/routines/ISBNValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/ISBNValidatorTest.java
index b3e2c13a..bb1ccef2 100644
--- a/src/test/java/org/apache/commons/validator/routines/ISBNValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/ISBNValidatorTest.java
@@ -20,6 +20,8 @@ import java.util.regex.Pattern;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* ISBNValidator Test Case.
*/
@@ -105,6 +107,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test method for {@link org.apache.commons.validator.routines.ISBNValidator#convertToISBN13(java.lang.String)}.
*/
+ @Test
public void testConversionErrors() {
final ISBNValidator validator = ISBNValidator.getInstance();
String input = null;
@@ -141,6 +144,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test Invalid ISBN-10 codes
*/
+ @Test
public void testInvalid() {
final ISBNValidator validator = ISBNValidator.getInstance();
String baseCode = "193011099";
@@ -172,6 +176,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test Invalid ISBN-10 formats.
*/
+ @Test
public void testInvalidISBN10Format() {
final ISBNValidator validator = ISBNValidator.getInstance();
final Pattern pattern = Pattern.compile(ISBNValidator.ISBN10_REGEX);
@@ -185,6 +190,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test Invalid ISBN-13 formats.
*/
+ @Test
public void testInvalidISBN13Format() {
final Pattern pattern = Pattern.compile(ISBNValidator.ISBN13_REGEX);
final ISBNValidator validator = ISBNValidator.getInstance();
@@ -198,6 +204,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test isValid() ISBN-10 codes
*/
+ @Test
public void testIsValidISBN10() {
final ISBNValidator validator = ISBNValidator.getInstance();
assertTrue("isValidISBN10-1", validator.isValidISBN10("1930110995"));
@@ -218,6 +225,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test isValid() ISBN-13 codes
*/
+ @Test
public void testIsValidISBN13() {
final ISBNValidator validator = ISBNValidator.getInstance();
assertTrue("isValidISBN13-1", validator.isValidISBN13("9781930110991"));
@@ -238,6 +246,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test null values
*/
+ @Test
public void testNull() {
final ISBNValidator validator = ISBNValidator.getInstance();
assertFalse("isValid", validator.isValid(null));
@@ -252,6 +261,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test validate() ISBN-10 codes (don't convert)
*/
+ @Test
public void testValidateISBN10() {
final ISBNValidator validator = ISBNValidator.getInstance(false);
assertEquals("validateISBN10-1", "1930110995", validator.validateISBN10("1930110995"));
@@ -272,6 +282,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test validate() ISBN-10 codes (convert)
*/
+ @Test
public void testValidateISBN10Convert() {
final ISBNValidator validator = ISBNValidator.getInstance();
assertEquals("validate-1", "9781930110991", validator.validate("1930110995"));
@@ -285,6 +296,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test validate() ISBN-13 codes
*/
+ @Test
public void testValidateISBN13() {
final ISBNValidator validator = ISBNValidator.getInstance();
assertEquals("validateISBN13-1", "9781930110991", validator.validateISBN13("9781930110991"));
@@ -305,6 +317,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test Valid ISBN-10 formats.
*/
+ @Test
public void testValidISBN10Format() {
final Pattern pattern = Pattern.compile(ISBNValidator.ISBN10_REGEX);
for (int i = 0; i < validISBN10Format.length; i++) {
@@ -315,6 +328,7 @@ public class ISBNValidatorTest extends TestCase {
/**
* Test Valid ISBN-13 formats.
*/
+ @Test
public void testValidISBN13Format() {
final Pattern pattern = Pattern.compile(ISBNValidator.ISBN13_REGEX);
for (int i = 0; i < validISBN13Format.length; i++) {
diff --git a/src/test/java/org/apache/commons/validator/routines/ISINValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/ISINValidatorTest.java
index 39d67cd8..b23765a0 100644
--- a/src/test/java/org/apache/commons/validator/routines/ISINValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/ISINValidatorTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator.routines;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* ISINValidator Test Case.
*
@@ -70,12 +72,14 @@ public class ISINValidatorTest extends TestCase {
super(name);
}
+ @Test
public void testInvalidFalse() {
for(final String f : invalidFormat) {
assertFalse(f, VALIDATOR_FALSE.isValid(f));
}
}
+ @Test
public void testInvalidTrue() {
for(final String f : invalidFormat) {
assertFalse(f, VALIDATOR_TRUE.isValid(f));
@@ -85,12 +89,14 @@ public class ISINValidatorTest extends TestCase {
}
}
+ @Test
public void testIsValidFalse() {
for(final String f : validFormat) {
assertTrue(f, VALIDATOR_FALSE.isValid(f));
}
}
+ @Test
public void testIsValidTrue() {
for(final String f : validFormat) {
assertTrue(f, VALIDATOR_TRUE.isValid(f));
diff --git a/src/test/java/org/apache/commons/validator/routines/ISSNValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/ISSNValidatorTest.java
index 44351027..6e690e78 100644
--- a/src/test/java/org/apache/commons/validator/routines/ISSNValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/ISSNValidatorTest.java
@@ -22,6 +22,7 @@ import junit.framework.TestCase;
import org.apache.commons.validator.routines.checkdigit.CheckDigit;
import org.apache.commons.validator.routines.checkdigit.EAN13CheckDigit;
+import org.junit.Test;
/**
* ISSNValidator Test Case.
@@ -75,6 +76,7 @@ public class ISSNValidatorTest extends TestCase {
* Test Invalid EAN-13 ISSN prefix codes
* Test Input length
*/
+ @Test
public void testConversionErrors() {
String input = null;
try {
@@ -103,6 +105,7 @@ public class ISSNValidatorTest extends TestCase {
/**
* Test Invalid ISSN codes
*/
+ @Test
public void testInvalid() {
for(final String f : invalidFormat) {
assertFalse(f, VALIDATOR.isValid(f));
@@ -112,6 +115,7 @@ public class ISSNValidatorTest extends TestCase {
/**
* Test valid EAN-13 ISSN codes and extract the ISSN
*/
+ @Test
public void testIsValidExtract() {
assertEquals("12345679", VALIDATOR.extractFromEAN13("9771234567003"));
assertEquals("00014664", VALIDATOR.extractFromEAN13("9770001466006"));
@@ -122,6 +126,7 @@ public class ISSNValidatorTest extends TestCase {
/**
* Test isValid() ISSN codes
*/
+ @Test
public void testIsValidISSN() {
for(final String f : validFormat) {
assertTrue(f, VALIDATOR.isValid(f));
@@ -131,6 +136,7 @@ public class ISSNValidatorTest extends TestCase {
/**
* Test isValid() ISSN codes and convert them
*/
+ @Test
public void testIsValidISSNConvert() {
final CheckDigit ean13cd = EAN13CheckDigit.EAN13_CHECK_DIGIT;
final Random r = new Random();
@@ -145,10 +151,12 @@ public class ISSNValidatorTest extends TestCase {
assertEquals("9771234567003", VALIDATOR.convertToEAN13("1234-5679", "00"));
}
+ @Test
public void testIsValidISSNConvertNull() {
assertNull(VALIDATOR.convertToEAN13(null, "00"));
}
+ @Test
public void testIsValidISSNConvertSuffix() {
try {
assertNull(VALIDATOR.convertToEAN13(null, null));
@@ -191,12 +199,14 @@ public class ISSNValidatorTest extends TestCase {
/**
* Test null values
*/
+ @Test
public void testNull() {
assertFalse("isValid", VALIDATOR.isValid(null));
}
/**
* Test Invalid EAN-13 ISSN codes
*/
+ @Test
public void testValidCheckDigitEan13() {
assertNull(VALIDATOR.extractFromEAN13("9771234567001"));
assertNull(VALIDATOR.extractFromEAN13("9771234567002"));
diff --git a/src/test/java/org/apache/commons/validator/routines/InetAddressValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/InetAddressValidatorTest.java
index 57f0a7c8..c4b084e6 100644
--- a/src/test/java/org/apache/commons/validator/routines/InetAddressValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/InetAddressValidatorTest.java
@@ -19,6 +19,8 @@ package org.apache.commons.validator.routines;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Test cases for InetAddressValidator.
*/
@@ -42,6 +44,7 @@ public class InetAddressValidatorTest extends TestCase {
/**
* Test obviously broken IPs.
*/
+ @Test
public void testBrokenInetAddresses() {
assertFalse("IP with characters should be invalid", validator.isValid("124.14.32.abc"));
// TODO: there is some debate as to whether leading zeros should be allowed
@@ -55,6 +58,7 @@ public class InetAddressValidatorTest extends TestCase {
/**
* Test valid and invalid IPs from each address class.
*/
+ @Test
public void testInetAddressesByClass() {
assertTrue("class A IP should be valid", validator.isValid("24.25.231.12"));
assertFalse("illegal class A IP should be invalid", validator.isValid("2.41.32.324"));
@@ -75,6 +79,7 @@ public class InetAddressValidatorTest extends TestCase {
/**
* Test IPs that point to real, well-known hosts (without actually looking them up).
*/
+ @Test
public void testInetAddressesFromTheWild() {
assertTrue("www.apache.org IP should be valid", validator.isValid("140.211.11.130"));
assertTrue("www.l.google.com IP should be valid", validator.isValid("72.14.253.103"));
@@ -88,6 +93,7 @@ public class InetAddressValidatorTest extends TestCase {
* <a href="http://download.dartware.com/thirdparty/test-ipv6-regex.pl">Perl script</a>.</p>
*
*/
+ @Test
public void testIPv6() {
// The original Perl script contained a lot of duplicate tests.
// I removed the duplicates I noticed, but there may be more.
@@ -592,15 +598,18 @@ public class InetAddressValidatorTest extends TestCase {
/**
* Test reserved IPs.
*/
+ @Test
public void testReservedInetAddresses() {
assertTrue("localhost IP should be valid", validator.isValid("127.0.0.1"));
assertTrue("broadcast IP should be valid", validator.isValid("255.255.255.255"));
}
+ @Test
public void testVALIDATOR_335() {
assertTrue("2001:0438:FFFE:0000:0000:0000:0000:0A35 should be valid", validator.isValid("2001:0438:FFFE:0000:0000:0000:0000:0A35"));
}
+ @Test
public void testVALIDATOR_419() {
String addr;
addr = "0:0:0:0:0:0:13.1.68.3";
@@ -621,6 +630,7 @@ public class InetAddressValidatorTest extends TestCase {
/**
* Inet6Address may also contain a scope id
*/
+ @Test
public void testVALIDATOR_445() {
final String [] valid = {
"2001:0000:1234:0000:0000:C1C0:ABCD:0876",
diff --git a/src/test/java/org/apache/commons/validator/routines/IntegerValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/IntegerValidatorTest.java
index b48baf47..bd4cf813 100644
--- a/src/test/java/org/apache/commons/validator/routines/IntegerValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/IntegerValidatorTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator.routines;
import java.util.Locale;
+import org.junit.Test;
+
/**
* Test Case for IntegerValidator.
*/
@@ -82,6 +84,7 @@ public class IntegerValidatorTest extends AbstractNumberValidatorTest {
/**
* Test Integer Range/Min/Max
*/
+ @Test
public void testIntegerRangeMinMax() {
final IntegerValidator validator = (IntegerValidator)strictValidator;
final Integer number9 = validator.validate("9", "#");
@@ -112,6 +115,7 @@ public class IntegerValidatorTest extends AbstractNumberValidatorTest {
/**
* Test IntegerValidator validate Methods
*/
+ @Test
public void testIntegerValidatorMethods() {
final Locale locale = Locale.GERMAN;
final String pattern = "0,00,00";
@@ -141,6 +145,7 @@ public class IntegerValidatorTest extends AbstractNumberValidatorTest {
assertFalse("isValid(B) pattern", IntegerValidator.getInstance().isValid(XXXX, pattern));
assertFalse("isValid(B) both", IntegerValidator.getInstance().isValid(patternVal, pattern, Locale.GERMAN));
}
+ @Test
public void testMinMaxValues() {
assertTrue("2147483647 is max integer", validator.isValid("2147483647"));
assertFalse("2147483648 > max integer", validator.isValid("2147483648"));
diff --git a/src/test/java/org/apache/commons/validator/routines/LongValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/LongValidatorTest.java
index 6476c725..611cea7a 100644
--- a/src/test/java/org/apache/commons/validator/routines/LongValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/LongValidatorTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator.routines;
import java.util.Locale;
+import org.junit.Test;
+
/**
* Test Case for LongValidator.
*/
@@ -84,6 +86,7 @@ public class LongValidatorTest extends AbstractNumberValidatorTest {
/**
* Test Long Range/Min/Max
*/
+ @Test
public void testLongRangeMinMax() {
final LongValidator validator = (LongValidator)strictValidator;
final Long number9 = validator.validate("9", "#");
@@ -114,6 +117,7 @@ public class LongValidatorTest extends AbstractNumberValidatorTest {
/**
* Test LongValidator validate Methods
*/
+ @Test
public void testLongValidatorMethods() {
final Locale locale = Locale.GERMAN;
final String pattern = "0,00,00";
diff --git a/src/test/java/org/apache/commons/validator/routines/PercentValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/PercentValidatorTest.java
index 8acf93e5..5f87a616 100644
--- a/src/test/java/org/apache/commons/validator/routines/PercentValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/PercentValidatorTest.java
@@ -20,6 +20,8 @@ import java.math.BigDecimal;
import java.util.Locale;
import junit.framework.TestCase;
+
+import org.junit.Test;
/**
* Test Case for PercentValidator.
*/
@@ -51,6 +53,7 @@ public class PercentValidatorTest extends TestCase {
/**
* Test Format Type
*/
+ @Test
public void testFormatType() {
assertEquals("Format Type A", 2, PercentValidator.getInstance().getFormatType());
assertEquals("Format Type B", AbstractNumberValidator.PERCENT_FORMAT, PercentValidator.getInstance().getFormatType());
@@ -59,6 +62,7 @@ public class PercentValidatorTest extends TestCase {
/**
* Test Invalid percentage values
*/
+ @Test
public void testInvalid() {
final BigDecimalValidator validator = PercentValidator.getInstance();
@@ -80,6 +84,7 @@ public class PercentValidatorTest extends TestCase {
/**
* Test Valid percentage values
*/
+ @Test
public void testValid() {
// Set the default Locale
final Locale origDefault = Locale.getDefault();
diff --git a/src/test/java/org/apache/commons/validator/routines/RegexValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/RegexValidatorTest.java
index a2cf09a1..94a17004 100644
--- a/src/test/java/org/apache/commons/validator/routines/RegexValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/RegexValidatorTest.java
@@ -21,6 +21,8 @@ import java.util.regex.PatternSyntaxException;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Test Case for RegexValidatorTest.
*
@@ -79,6 +81,7 @@ public class RegexValidatorTest extends TestCase {
/**
* Test exceptions
*/
+ @Test
public void testExceptions() {
final String invalidRegex = "^([abCD12]*$";
try {
@@ -88,6 +91,7 @@ public class RegexValidatorTest extends TestCase {
}
}
+ @Test
public void testGetPatterns() {
final RegexValidator regexValidator = new RegexValidator(MULTIPLE_REGEX);
assertNotSame(regexValidator.getPatterns(), regexValidator.getPatterns());
@@ -100,6 +104,7 @@ public class RegexValidatorTest extends TestCase {
/**
* Test exceptions
*/
+ @Test
public void testMissingRegex() {
// Single Regular Expression - null
@@ -156,6 +161,7 @@ public class RegexValidatorTest extends TestCase {
/**
* Test with multiple regular expressions (case in-sensitive).
*/
+ @Test
public void testMultipleInsensitive() {
// ------------ Set up In-sensitive Validators
@@ -197,6 +203,7 @@ public class RegexValidatorTest extends TestCase {
/**
* Test with multiple regular expressions (case sensitive).
*/
+ @Test
public void testMultipleSensitive() {
// ------------ Set up Sensitive Validators
@@ -238,6 +245,7 @@ public class RegexValidatorTest extends TestCase {
/**
* Test Null value
*/
+ @Test
public void testNullValue() {
final RegexValidator validator = new RegexValidator(REGEX);
@@ -249,6 +257,7 @@ public class RegexValidatorTest extends TestCase {
/**
* Test instance methods with single regular expression.
*/
+ @Test
public void testSingle() {
final RegexValidator sensitive = new RegexValidator(REGEX);
final RegexValidator insensitive = new RegexValidator(REGEX, false);
@@ -277,6 +286,7 @@ public class RegexValidatorTest extends TestCase {
/**
* Test toString() method
*/
+ @Test
public void testToString() {
final RegexValidator single = new RegexValidator(REGEX);
assertEquals("Single", "RegexValidator{" + REGEX + "}", single.toString());
diff --git a/src/test/java/org/apache/commons/validator/routines/ShortValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/ShortValidatorTest.java
index 6d699874..52a00c24 100644
--- a/src/test/java/org/apache/commons/validator/routines/ShortValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/ShortValidatorTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator.routines;
import java.util.Locale;
+import org.junit.Test;
+
/**
* Test Case for ShortValidator.
*/
@@ -74,6 +76,7 @@ public class ShortValidatorTest extends AbstractNumberValidatorTest {
/**
* Test Short Range/Min/Max
*/
+ @Test
public void testShortRangeMinMax() {
final ShortValidator validator = (ShortValidator)strictValidator;
final Short number9 = validator.validate("9", "#");
@@ -106,6 +109,7 @@ public class ShortValidatorTest extends AbstractNumberValidatorTest {
/**
* Test ShortValidator validate Methods
*/
+ @Test
public void testShortValidatorMethods() {
final Locale locale = Locale.GERMAN;
final String pattern = "0,00,00";
diff --git a/src/test/java/org/apache/commons/validator/routines/TimeValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/TimeValidatorTest.java
index 7626758b..ef2b48d2 100644
--- a/src/test/java/org/apache/commons/validator/routines/TimeValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/TimeValidatorTest.java
@@ -23,6 +23,8 @@ import java.util.TimeZone;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Test Case for TimeValidator.
*/
@@ -160,6 +162,7 @@ public class TimeValidatorTest extends TestCase {
/**
* Test compare date methods
*/
+ @Test
public void testCompare() {
final int testTime = 154523;
final int min = 100;
@@ -205,6 +208,7 @@ public class TimeValidatorTest extends TestCase {
/**
* Test Invalid Dates with "locale" validation
*/
+ @Test
public void testFormat() {
// Set the default Locale
Locale.setDefault(Locale.UK);
@@ -220,6 +224,7 @@ public class TimeValidatorTest extends TestCase {
/**
* Test Invalid Dates with "locale" validation
*/
+ @Test
public void testLocaleInvalid() {
for (int i = 0; i < localeInvalid.length; i++) {
final String text = i + " value=[" +localeInvalid[i]+"] passed ";
@@ -232,6 +237,7 @@ public class TimeValidatorTest extends TestCase {
/**
* Test Valid Dates with "locale" validation
*/
+ @Test
public void testLocaleValid() {
for (int i = 0; i < localeValid.length; i++) {
final String text = i + " value=[" +localeValid[i]+"] failed ";
@@ -246,6 +252,7 @@ public class TimeValidatorTest extends TestCase {
/**
* Test Invalid Dates with "pattern" validation
*/
+ @Test
public void testPatternInvalid() {
for (int i = 0; i < patternInvalid.length; i++) {
final String text = i + " value=[" +patternInvalid[i]+"] passed ";
@@ -258,6 +265,7 @@ public class TimeValidatorTest extends TestCase {
/**
* Test Valid Dates with "pattern" validation
*/
+ @Test
public void testPatternValid() {
for (int i = 0; i < patternValid.length; i++) {
final String text = i + " value=[" +patternValid[i]+"] failed ";
@@ -272,6 +280,7 @@ public class TimeValidatorTest extends TestCase {
/**
* Test time zone methods.
*/
+ @Test
public void testTimeZone() {
// Set the default Locale & TimeZone
Locale.setDefault(Locale.UK);
diff --git a/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java b/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
index 75713c06..7d872f5c 100644
--- a/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
@@ -27,6 +27,7 @@ import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
/**
* Luhn Check Digit Test.
@@ -156,6 +157,7 @@ public abstract class AbstractCheckDigitTest extends TestCase {
/**
* Test calculate() for invalid values.
*/
+ @Test
public void testCalculateInvalid() {
if (log.isDebugEnabled()) {
@@ -189,6 +191,7 @@ public abstract class AbstractCheckDigitTest extends TestCase {
/**
* Test calculate() for valid values.
*/
+ @Test
public void testCalculateValid() {
if (log.isDebugEnabled()) {
log.debug("testCalculateValid() for " + routine.getClass().getName());
@@ -213,6 +216,7 @@ public abstract class AbstractCheckDigitTest extends TestCase {
/**
* Test isValid() for invalid values.
*/
+ @Test
public void testIsValidFalse() {
if (log.isDebugEnabled()) {
log.debug("testIsValidFalse() for " + routine.getClass().getName());
@@ -239,6 +243,7 @@ public abstract class AbstractCheckDigitTest extends TestCase {
/**
* Test isValid() for valid values.
*/
+ @Test
public void testIsValidTrue() {
if (log.isDebugEnabled()) {
log.debug("testIsValidTrue() for " + routine.getClass().getName());
@@ -255,6 +260,7 @@ public abstract class AbstractCheckDigitTest extends TestCase {
/**
* Test missing code
*/
+ @Test
public void testMissingCode() {
// isValid() null
@@ -287,6 +293,7 @@ public abstract class AbstractCheckDigitTest extends TestCase {
/**
* Test check digit serialization.
*/
+ @Test
public void testSerialization() {
// Serialize the check digit routine
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -316,6 +323,7 @@ public abstract class AbstractCheckDigitTest extends TestCase {
/**
* Test zero sum
*/
+ @Test
public void testZeroSum() {
assertFalse("isValid() Zero Sum", routine.isValid(zeroSum));
diff --git a/src/test/java/org/apache/commons/validator/routines/checkdigit/CUSIPCheckDigitTest.java b/src/test/java/org/apache/commons/validator/routines/checkdigit/CUSIPCheckDigitTest.java
index 2c1b0fba..accad809 100644
--- a/src/test/java/org/apache/commons/validator/routines/checkdigit/CUSIPCheckDigitTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/checkdigit/CUSIPCheckDigitTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator.routines.checkdigit;
+import org.junit.Test;
+
/**
* CUSIP Check Digit Test.
*
@@ -56,12 +58,14 @@ public class CUSIPCheckDigitTest extends AbstractCheckDigitTest {
invalid = new String[] {"0378#3100"};
}
+ @Test
public void testVALIDATOR_336_InvalidCheckDigits() {
for (final String invalidCheckDigit : INVALID_CHECK_DIGITS) {
assertFalse("Should fail: " + invalidCheckDigit, routine.isValid(invalidCheckDigit));
}
}
+ @Test
public void testVALIDATOR_336_ValidCheckDigits() {
for (final String validCheckDigit : VALID_CHECK_DIGITS) {
assertTrue("Should fail: " + validCheckDigit, routine.isValid(validCheckDigit));
diff --git a/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java b/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java
index 685816e9..5d20c42b 100644
--- a/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
+import org.junit.Test;
/**
* IBAN Check Digit Test.
@@ -210,6 +211,7 @@ public class IBANCheckDigitTest extends AbstractCheckDigitTest {
}
+ @Test
public void testOther() throws Exception {
try (BufferedReader rdr = new BufferedReader(
new InputStreamReader(
@@ -232,6 +234,7 @@ public class IBANCheckDigitTest extends AbstractCheckDigitTest {
* Test zero sum
*/
@Override
+ @Test
public void testZeroSum() {
// ignore, don't run this test
diff --git a/src/test/java/org/apache/commons/validator/routines/checkdigit/ISBNCheckDigitTest.java b/src/test/java/org/apache/commons/validator/routines/checkdigit/ISBNCheckDigitTest.java
index dee89088..7dc80780 100644
--- a/src/test/java/org/apache/commons/validator/routines/checkdigit/ISBNCheckDigitTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/checkdigit/ISBNCheckDigitTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator.routines.checkdigit;
+import org.junit.Test;
+
/**
* ISBN-10/ISBN-13 Check Digit Test.
*
@@ -52,6 +54,7 @@ public class ISBNCheckDigitTest extends AbstractCheckDigitTest {
/**
* Sets up routine & valid codes.
*/
+ @Test
public void testInvalidLength() {
assertFalse("isValid() Lth 9 ", routine.isValid("123456789"));
assertFalse("isValid() Lth 11", routine.isValid("12345678901"));
diff --git a/src/test/java/org/apache/commons/validator/routines/checkdigit/ISINCheckDigitTest.java b/src/test/java/org/apache/commons/validator/routines/checkdigit/ISINCheckDigitTest.java
index 89c1b350..0397e128 100644
--- a/src/test/java/org/apache/commons/validator/routines/checkdigit/ISINCheckDigitTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/checkdigit/ISINCheckDigitTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator.routines.checkdigit;
+import org.junit.Test;
+
/**
* ISIN Check Digit Test.
*
@@ -62,6 +64,7 @@ public class ISINCheckDigitTest extends AbstractCheckDigitTest {
invalid = new String[] {"0378#3100"};
}
+ @Test
public void testVALIDATOR_345() {
for (final String invalidCheckDigit : INVALID_CHECK_DIGITS) {
assertFalse("Should fail: " + invalidCheckDigit, routine.isValid(invalidCheckDigit));
diff --git a/src/test/java/org/apache/commons/validator/routines/checkdigit/ModulusTenCUSIPCheckDigitTest.java b/src/test/java/org/apache/commons/validator/routines/checkdigit/ModulusTenCUSIPCheckDigitTest.java
index 72677d15..9ee02ba7 100644
--- a/src/test/java/org/apache/commons/validator/routines/checkdigit/ModulusTenCUSIPCheckDigitTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/checkdigit/ModulusTenCUSIPCheckDigitTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator.routines.checkdigit;
+import org.junit.Test;
+
/**
* ModulusTenCheckDigit CUSIP Test.
*/
@@ -54,12 +56,14 @@ public class ModulusTenCUSIPCheckDigitTest extends AbstractCheckDigitTest {
invalid = new String[] {"0378#3100"};
}
+ @Test
public void testVALIDATOR_336_InvalidCheckDigits() {
for (final String invalidCheckDigit : INVALID_CHECK_DIGITS) {
assertFalse("Should fail: " + invalidCheckDigit, routine.isValid(invalidCheckDigit));
}
}
+ @Test
public void testVALIDATOR_336_ValidCheckDigits() {
for (final String validCheckDigit : VALID_CHECK_DIGITS) {
assertTrue("Should fail: " + validCheckDigit, routine.isValid(validCheckDigit));
diff --git a/src/test/java/org/apache/commons/validator/routines/checkdigit/ModulusTenSedolCheckDigitTest.java b/src/test/java/org/apache/commons/validator/routines/checkdigit/ModulusTenSedolCheckDigitTest.java
index 0cd6897d..93ebbca5 100644
--- a/src/test/java/org/apache/commons/validator/routines/checkdigit/ModulusTenSedolCheckDigitTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/checkdigit/ModulusTenSedolCheckDigitTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator.routines.checkdigit;
+import org.junit.Test;
+
/**
* ModulusTenCheckDigit SEDOL Test.
*/
@@ -54,6 +56,7 @@ public class ModulusTenSedolCheckDigitTest extends AbstractCheckDigitTest {
zeroSum = "0000000";
}
+ @Test
public void testVALIDATOR_346() {
for (final String invalidCheckDigit : INVALID_CHECK_DIGITS) {
assertFalse("Should fail: " + invalidCheckDigit, routine.isValid(invalidCheckDigit));
diff --git a/src/test/java/org/apache/commons/validator/routines/checkdigit/SedolCheckDigitTest.java b/src/test/java/org/apache/commons/validator/routines/checkdigit/SedolCheckDigitTest.java
index 35b833bd..097c14f3 100644
--- a/src/test/java/org/apache/commons/validator/routines/checkdigit/SedolCheckDigitTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/checkdigit/SedolCheckDigitTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator.routines.checkdigit;
+import org.junit.Test;
+
/**
* ISIN Check Digit Test.
*
@@ -56,6 +58,7 @@ public class SedolCheckDigitTest extends AbstractCheckDigitTest {
zeroSum = "0000000";
}
+ @Test
public void testVALIDATOR_346() {
for (final String invalidCheckDigit : INVALID_CHECK_DIGITS) {
assertFalse("Should fail: " + invalidCheckDigit, routine.isValid(invalidCheckDigit));
diff --git a/src/test/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigitTest.java b/src/test/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigitTest.java
index 8a4298ec..e795ff76 100644
--- a/src/test/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigitTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigitTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.validator.routines.checkdigit;
+import org.junit.Test;
+
/**
* Verhoeff Check Digit Test.
*
@@ -48,6 +50,7 @@ public class VerhoeffCheckDigitTest extends AbstractCheckDigitTest {
* Test zero sum
*/
@Override
+ @Test
public void testZeroSum() {
// ignore, don't run this test
}
diff --git a/src/test/java/org/apache/commons/validator/util/FlagsTest.java b/src/test/java/org/apache/commons/validator/util/FlagsTest.java
index ca8855eb..fe34d440 100644
--- a/src/test/java/org/apache/commons/validator/util/FlagsTest.java
+++ b/src/test/java/org/apache/commons/validator/util/FlagsTest.java
@@ -18,6 +18,8 @@ package org.apache.commons.validator.util;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* Test the Flags class.
*/
@@ -37,6 +39,7 @@ public class FlagsTest extends TestCase {
super(name);
}
+ @Test
public void testClear() {
final Flags f = new Flags(98432);
f.clear();
@@ -46,25 +49,30 @@ public class FlagsTest extends TestCase {
/**
* Test for Object clone()
*/
+ @Test
public void testClone() {
}
/**
* Test for boolean equals(Object)
*/
+ @Test
public void testEqualsObject() {
}
+ @Test
public void testGetFlags() {
final Flags f = new Flags(45);
assertEquals(f.getFlags(), 45);
}
+ @Test
public void testHashCode() {
final Flags f = new Flags(45);
assertEquals(f.hashCode(), 45);
}
+ @Test
public void testIsOn_isFalseWhenNotAllFlagsInArgumentAreOn() {
final Flags first = new Flags(1);
final long firstAndSecond = 3;
@@ -72,6 +80,7 @@ public class FlagsTest extends TestCase {
assertFalse(first.isOn(firstAndSecond));
}
+ @Test
public void testIsOn_isTrueWhenHighOrderBitIsSetAndQueried() {
final Flags allOn = new Flags(~0);
final long highOrderBit = 0x8000000000000000L;
@@ -79,6 +88,7 @@ public class FlagsTest extends TestCase {
assertTrue(allOn.isOn(highOrderBit));
}
+ @Test
public void testIsOnOff() {
final Flags f = new Flags();
f.turnOn(LONG_FLAG);
@@ -95,6 +105,7 @@ public class FlagsTest extends TestCase {
/**
* Test for String toString()
*/
+ @Test
public void testToString() {
final Flags f = new Flags();
String s = f.toString();
@@ -109,21 +120,25 @@ public class FlagsTest extends TestCase {
s);
}
+ @Test
public void testTurnOff() {
}
+ @Test
public void testTurnOffAll() {
final Flags f = new Flags(98432);
f.turnOffAll();
assertEquals(0, f.getFlags());
}
+ @Test
public void testTurnOnAll() {
final Flags f = new Flags();
f.turnOnAll();
assertEquals(~0, f.getFlags());
}
+ @Test
public void testTurnOnOff() {
}