bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject [03/51] [abbrv] bval git commit: JUnit 4
Date Fri, 03 Nov 2017 22:27:28 GMT
JUnit 4


Project: http://git-wip-us.apache.org/repos/asf/bval/repo
Commit: http://git-wip-us.apache.org/repos/asf/bval/commit/a3bc513f
Tree: http://git-wip-us.apache.org/repos/asf/bval/tree/a3bc513f
Diff: http://git-wip-us.apache.org/repos/asf/bval/diff/a3bc513f

Branch: refs/heads/master
Commit: a3bc513f90351e744882982df6f8e37da7bdd827
Parents: 6fa1fda
Author: Matt Benson <mbenson@apache.org>
Authored: Wed Oct 19 20:36:26 2016 +0000
Committer: Matt Benson <mbenson@apache.org>
Committed: Wed Oct 19 20:36:26 2016 +0000

----------------------------------------------------------------------
 .../org/apache/bval/ValidationResultsTest.java  |  26 +-
 .../org/apache/bval/model/MetaPropertyTest.java |  17 +-
 .../org/apache/bval/json/JSONGeneratorTest.java |  27 +-
 .../constraints/AssertFalseValidatorTest.java   |  17 +-
 .../constraints/AssertTrueValidatorTest.java    |  17 +-
 .../DecimalMinMaxValidatorsTest.java            |  11 +-
 .../bval/constraints/DigitsValidatorTest.java   |  55 ++-
 .../bval/constraints/EmailValidatorTest.java    |  45 ++-
 .../MinMaxValidatorsForNumberTest.java          |  11 +-
 .../bval/constraints/NotNullValidatorTest.java  |  17 +-
 .../bval/constraints/NullValidatorTest.java     |  17 +-
 .../ZipCodeCityCoherenceValidator.java          |   2 +-
 .../org/apache/bval/jsr/BeanDescriptorTest.java | 103 ++----
 .../java/org/apache/bval/jsr/BootstrapTest.java |  71 ++--
 .../apache/bval/jsr/CircularReferencesTest.java |  51 +--
 .../bval/jsr/ComposedConstraintsTest.java       |  74 ++--
 .../bval/jsr/ConstraintCompositionTest.java     | 127 +++----
 .../bval/jsr/ConstraintDefinitionsTest.java     | 121 ++-----
 .../jsr/ConstraintValidatorContextTest.java     |  46 +--
 .../ContextConstraintValidatorFactoryTest.java  |  61 ++--
 .../CustomConstraintValidatorFactoryTest.java   |  16 +-
 .../bval/jsr/CustomValidatorFactoryTest.java    |  48 +--
 .../jsr/DefaultMessageInterpolatorTest.java     |  48 ++-
 .../apache/bval/jsr/ExceptionsContractTest.java | 219 +++++-------
 .../test/java/org/apache/bval/jsr/FooTest.java  |  24 +-
 .../java/org/apache/bval/jsr/Jsr303Test.java    | 202 ++++-------
 .../java/org/apache/bval/jsr/PayloadTest.java   |  70 ++--
 .../org/apache/bval/jsr/TckReproducerTest.java  |  61 +---
 .../org/apache/bval/jsr/ValidationTest.java     | 354 +++++++++----------
 .../bval/jsr/ValidatorResolutionTest.java       |  60 +---
 .../jsr/example/AccessTestBusinessObject.java   |   1 -
 .../java/org/apache/bval/jsr/example/Book.java  |   1 -
 .../apache/bval/jsr/example/CompanyAddress.java |   1 -
 .../bval/jsr/example/NoValidatorTestEntity.java |   1 -
 .../jsr/groups/GroupSequenceIsolationTest.java  | 137 +++----
 .../bval/jsr/groups/GroupSequenceTest.java      |  91 ++---
 .../bval/jsr/groups/GroupValidationTest.java    |  43 ++-
 .../InvalidRedefinedDefaultGroupAddress.java    |   2 -
 .../redefining/RedefiningDefaultGroupTest.java  |  39 +-
 .../jsr/util/EnumerationConverterTestCase.java  |  23 +-
 .../org/apache/bval/jsr/util/PathImplTest.java  |  56 ++-
 .../org/apache/bval/jsr/util/TestUtils.java     |  24 +-
 .../bval/jsr/xml/ValidationParserTest.java      |  78 ++--
 .../bval/routines/StandardValidationTest.java   |  44 ++-
 .../org/apache/bval/xml/BeanValidatorTest.java  |  35 +-
 .../apache/bval/xml/XMLMetaBeanInfosTest.java   |  38 +-
 .../apache/bval/xml/XMLMetaBeanManagerTest.java |  35 +-
 47 files changed, 1062 insertions(+), 1605 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java
----------------------------------------------------------------------
diff --git a/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java b/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java
index 879c226..785621e 100644
--- a/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java
+++ b/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java
@@ -16,32 +16,25 @@
  */
 package org.apache.bval;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import org.apache.bval.model.MetaProperty;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * ValidationResults Tester.
  */
-public class ValidationResultsTest extends TestCase {
+public class ValidationResultsTest {
     private ValidationResults results;
 
-    public ValidationResultsTest(String name) {
-        super(name);
-    }
-
-    @Override
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
         results = new ValidationResults();
     }
 
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
+    @Test
     public void testValidationResults() throws Exception {
         assertTrue(results.isEmpty());
         BeanValidationContext<ValidationResults> ctx = new BeanValidationContext<ValidationResults>(results);
@@ -56,7 +49,4 @@ public class ValidationResultsTest extends TestCase {
         assertFalse(results.hasError(this, "prop2"));
     }
 
-    public static Test suite() {
-        return new TestSuite(ValidationResultsTest.class);
-    }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-core/src/test/java/org/apache/bval/model/MetaPropertyTest.java
----------------------------------------------------------------------
diff --git a/bval-core/src/test/java/org/apache/bval/model/MetaPropertyTest.java b/bval-core/src/test/java/org/apache/bval/model/MetaPropertyTest.java
index 35b626a..e883e7c 100644
--- a/bval-core/src/test/java/org/apache/bval/model/MetaPropertyTest.java
+++ b/bval-core/src/test/java/org/apache/bval/model/MetaPropertyTest.java
@@ -16,9 +16,9 @@
  */
 package org.apache.bval.model;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
 
 /**
  * MetaProperty Tester.
@@ -27,12 +27,9 @@ import junit.framework.TestSuite;
  * @since <pre>02/12/2009</pre>
  * @version 1.0
  */
-public class MetaPropertyTest extends TestCase {
-    public MetaPropertyTest(String name) {
-        super(name);
-    }
-
+public class MetaPropertyTest {
 
+    @Test
     public void testGetTypeClass() throws Exception {
         MetaProperty prop = new MetaProperty();
         prop.setType(String.class);
@@ -44,8 +41,4 @@ public class MetaPropertyTest extends TestCase {
         assertEquals(2, ((DynaTypeEnum)prop.getType()).getEnumConstants().length);
     }
 
-
-    public static Test suite() {
-        return new TestSuite(MetaPropertyTest.class);
-    }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java
----------------------------------------------------------------------
diff --git a/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java b/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java
index 4854d32..ab24d93 100644
--- a/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java
+++ b/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java
@@ -16,7 +16,12 @@
  */
 package org.apache.bval.json;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.bval.example.BusinessEnum;
 import org.apache.bval.example.BusinessObject;
 import org.apache.bval.example.BusinessObjectAddress;
@@ -25,28 +30,23 @@ import org.apache.bval.model.MetaBean;
 import org.apache.bval.model.MetaProperty;
 import org.apache.bval.xml.XMLMetaBeanManager;
 import org.apache.bval.xml.XMLMetaBeanURLLoader;
-
-import java.util.ArrayList;
-import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Description: <br>
  * Author: roman.stumm<br>
  */
-public class JSONGeneratorTest extends TestCase {
+public class JSONGeneratorTest {
     private XMLMetaBeanManager mbm;
 
-    public JSONGeneratorTest(String name) {
-        super(name);
-    }
-
-    @Override
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
         mbm = new XMLMetaBeanManager();
         mbm.addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos.xml")));
     }
 
+    @Test
     public void testBeanInfosCustomPatchGenerated() throws Exception {
         MetaBean mbean = mbm.findForClass(BusinessObject.class);
         MetaProperty mprop = mbean.getProperty("lastName");
@@ -66,9 +66,9 @@ public class JSONGeneratorTest extends TestCase {
         metaBeans.add(mbean2);
         String json = converter.toJSON(metaBeans);
         assertNotNull(json);
-        // System.out.println(json);
     }
 
+    @Test
     public void testJSON() throws Exception {
         MetaBean info = mbm.findForClass(BusinessObject.class);
         MetaBean info2 = info.getProperty("address").getMetaBean();
@@ -83,9 +83,9 @@ public class JSONGeneratorTest extends TestCase {
         metaBeans.add(info3);
         String json = converter.toJSON(metaBeans);
         assertNotNull(json);
-        // System.out.println(json);
     }
 
+    @Test
     public void testJSON_dynaTypeEnum() throws Exception {
         MetaBean info = mbm.findForClass(BusinessObject.class);
         MetaProperty choice = info.getProperty("choice");
@@ -97,7 +97,6 @@ public class JSONGeneratorTest extends TestCase {
         metaBeans.add(info);
         String json = converter.toJSON(metaBeans);
         assertNotNull(json);
-        // System.out.println(json);
         assertTrue(json.indexOf("CUSTOM_1") > 0);
         assertTrue(json.indexOf("CUSTOM_2") > 0);
         assertTrue(json.indexOf("VALUE1") < 0);

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/constraints/AssertFalseValidatorTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/constraints/AssertFalseValidatorTest.java b/bval-jsr/src/test/java/org/apache/bval/constraints/AssertFalseValidatorTest.java
index 4677d34..85a7dd8 100644
--- a/bval-jsr/src/test/java/org/apache/bval/constraints/AssertFalseValidatorTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/constraints/AssertFalseValidatorTest.java
@@ -18,10 +18,10 @@
  */
 package org.apache.bval.constraints;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
+import org.junit.Test;
 
 /**
  * Checks correct behaviour of {@link AssertFalseValidator}.
@@ -38,19 +38,12 @@ import junit.framework.TestSuite;
  * 
  * @author Carlos Vara
  */
-public class AssertFalseValidatorTest extends TestCase {
+public class AssertFalseValidatorTest {
 	
-    public static Test suite() {
-        return new TestSuite(AssertFalseValidatorTest.class);
-    }
-    
-    public AssertFalseValidatorTest(String name) {
-    	super(name);
-    }
-    
     /**
      * Test {@link AssertFalseValidator} with <code>null</code> context.
      */
+    @Test
     public void testAssertFalseValidator() {
     	AssertFalseValidator afv = new AssertFalseValidator();
     	assertFalse("True value validation must fail", afv.isValid(true, null));

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/constraints/AssertTrueValidatorTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/constraints/AssertTrueValidatorTest.java b/bval-jsr/src/test/java/org/apache/bval/constraints/AssertTrueValidatorTest.java
index 016fe02..74be874 100644
--- a/bval-jsr/src/test/java/org/apache/bval/constraints/AssertTrueValidatorTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/constraints/AssertTrueValidatorTest.java
@@ -18,10 +18,10 @@
  */
 package org.apache.bval.constraints;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
+import org.junit.Test;
 
 /**
  * Checks correct behaviour of {@link AssertTrueValidator}.
@@ -38,19 +38,12 @@ import junit.framework.TestSuite;
  * 
  * @author Carlos Vara
  */
-public class AssertTrueValidatorTest extends TestCase {
+public class AssertTrueValidatorTest {
 	
-    public static Test suite() {
-        return new TestSuite(AssertTrueValidatorTest.class);
-    }
-    
-    public AssertTrueValidatorTest(String name) {
-    	super(name);
-    }
-    
     /**
      * Test {@link AssertTrueValidator} with null context.
      */
+    @Test
     public void testAssertTrueValidator() {
     	AssertTrueValidator atv = new AssertTrueValidator();
     	assertTrue("True value validation must succeed", atv.isValid(true, null));

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java b/bval-jsr/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java
index d0e0bb8..518c7a1 100644
--- a/bval-jsr/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java
@@ -18,14 +18,17 @@
  */
 package org.apache.bval.constraints;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+
+import java.util.Set;
 
 import javax.validation.ConstraintViolation;
 import javax.validation.Validation;
 import javax.validation.Validator;
 import javax.validation.constraints.DecimalMax;
 import javax.validation.constraints.DecimalMin;
-import java.util.Set;
+
+import org.junit.Test;
 
 /**
  * Description: <br>
@@ -33,13 +36,14 @@ import java.util.Set;
  * Date: 06.04.2010<br>
  * Time: 13:45:09<br>
  */
-public class DecimalMinMaxValidatorsTest extends TestCase {
+public class DecimalMinMaxValidatorsTest {
 
     @DecimalMin("922392239223.06")
     public double dmin;
     @DecimalMax("922392239223.09")
     public double dmax;
 
+    @Test
     public void testDecimalMinValue() {
         Validator v = Validation.buildDefaultValidatorFactory().getValidator();
 
@@ -50,6 +54,7 @@ public class DecimalMinMaxValidatorsTest extends TestCase {
         assertFalse("Min validation failed", res.isEmpty());
     }
 
+    @Test
     public void testDecimalMaxValue() {
         Validator v = Validation.buildDefaultValidatorFactory().getValidator();
 

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/constraints/DigitsValidatorTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/constraints/DigitsValidatorTest.java b/bval-jsr/src/test/java/org/apache/bval/constraints/DigitsValidatorTest.java
index 745ed2b..39d3a7a 100644
--- a/bval-jsr/src/test/java/org/apache/bval/constraints/DigitsValidatorTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/constraints/DigitsValidatorTest.java
@@ -18,13 +18,13 @@
  */
 package org.apache.bval.constraints;
 
-import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.math.BigDecimal;
 
+import org.junit.Test;
+
 /**
  * DigitsConstraintValidator Tester.
  *
@@ -32,56 +32,47 @@ import java.math.BigDecimal;
  * @since <pre>02/03/2009</pre>
  * @version 1.0
  */
-public class DigitsValidatorTest extends TestCase {
-    public DigitsValidatorTest(String name) {
-        super(name);
-    }
-
+public class DigitsValidatorTest  {
+    @Test
     public void testValidateNumber() {
         DigitsValidatorForNumber validator = new DigitsValidatorForNumber();
         validator.setFractional(4);
         validator.setIntegral(2);
-        Assert.assertFalse(validator.isValid(new BigDecimal("100.1234"), null));
-        Assert.assertFalse(validator.isValid(new BigDecimal("99.12345"), null));
-        Assert.assertTrue(validator.isValid(new BigDecimal("99.1234"), null));
-        Assert.assertFalse(validator.isValid(Double.valueOf(100.1234), null));
-        Assert.assertFalse(validator.isValid(Double.valueOf(99.12345), null));
-        Assert.assertTrue(validator.isValid(Double.valueOf(99.1234), null));
-        Assert.assertTrue(validator.isValid(Double.valueOf(99.123400), null));
-        Assert.assertTrue(validator.isValid(new BigDecimal("99.123400"), null));
+        assertFalse(validator.isValid(new BigDecimal("100.1234"), null));
+        assertFalse(validator.isValid(new BigDecimal("99.12345"), null));
+        assertTrue(validator.isValid(new BigDecimal("99.1234"), null));
+        assertFalse(validator.isValid(Double.valueOf(100.1234), null));
+        assertFalse(validator.isValid(Double.valueOf(99.12345), null));
+        assertTrue(validator.isValid(Double.valueOf(99.1234), null));
+        assertTrue(validator.isValid(Double.valueOf(99.123400), null));
+        assertTrue(validator.isValid(new BigDecimal("99.123400"), null));
     }
 
+    @Test
     public void testValidateString() {
         DigitsValidatorForString validator = new DigitsValidatorForString();
         validator.setFractional(4);
         validator.setIntegral(2);
-        String val = "100.12345";
-        Assert.assertFalse(validator.isValid(val, null));
-        val = "99.1234";
-        Assert.assertTrue(validator.isValid(val, null));
+        assertFalse(validator.isValid("100.12345", null));
+        assertTrue(validator.isValid("99.1234", null));
     }
 
+    @Test
     public void testValidateNumber2() {
         DigitsValidatorForNumber validator = new DigitsValidatorForNumber();
         validator.setFractional(4);
         validator.setIntegral(2);
-        Long val = new Long("100");
-        Assert.assertFalse(validator.isValid(val, null));
-        val = new Long("99");
-        Assert.assertTrue(validator.isValid(val, null));
+        assertFalse(validator.isValid(Long.valueOf("100"), null));
+        assertTrue(validator.isValid(Long.valueOf("99"), null));
     }
 
+    @Test
     public void testValidateString2() {
         DigitsValidatorForString validator = new DigitsValidatorForString();
         validator.setFractional(0);
         validator.setIntegral(2);
-        String val = "99.5";
-        Assert.assertFalse(validator.isValid(val, null));
-        val = "99";
-        Assert.assertTrue(validator.isValid(val, null));
+        assertFalse(validator.isValid("99.5", null));
+        assertTrue(validator.isValid("99", null));
     }
 
-    public static Test suite() {
-        return new TestSuite(DigitsValidatorTest.class);
-    }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/constraints/EmailValidatorTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/constraints/EmailValidatorTest.java b/bval-jsr/src/test/java/org/apache/bval/constraints/EmailValidatorTest.java
index d448852..52e994e 100644
--- a/bval-jsr/src/test/java/org/apache/bval/constraints/EmailValidatorTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/constraints/EmailValidatorTest.java
@@ -18,15 +18,16 @@
  */
 package org.apache.bval.constraints;
 
-import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.bval.jsr.ApacheValidatorFactory;
-import org.apache.bval.jsr.example.Customer;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import javax.validation.Validator;
 
+import org.apache.bval.jsr.ApacheValidatorFactory;
+import org.apache.bval.jsr.example.Customer;
+import org.junit.Before;
+import org.junit.Test;
+
 /**
  * EmailValidator Tester.
  *
@@ -34,7 +35,7 @@ import javax.validation.Validator;
  * @version 1.0
  * @since <pre>10/14/2008</pre>
  */
-public class EmailValidatorTest extends TestCase {
+public class EmailValidatorTest {
     public static class EmailAddressBuilder {
         @Email
         private StringBuilder buffer = new StringBuilder();
@@ -51,16 +52,12 @@ public class EmailValidatorTest extends TestCase {
 
     private Validator validator;
 
-    public EmailValidatorTest(String name) {
-        super(name);
-    }
-
-    @Override
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
         validator = ApacheValidatorFactory.getDefault().getValidator();
     }
 
+    @Test
     public void testEmail() {
         Customer customer = new Customer();
         customer.setCustomerId("id-1");
@@ -68,31 +65,29 @@ public class EmailValidatorTest extends TestCase {
         customer.setLastName("Do");
         customer.setPassword("12345");
 
-        Assert.assertEquals(0, validator.validate(customer).size());
+        assertTrue(validator.validate(customer).isEmpty());
 
         customer.setEmailAddress("some@invalid@address");
-        Assert.assertEquals(1, validator.validate(customer).size());
+        assertEquals(1, validator.validate(customer).size());
 
         customer.setEmailAddress("some.valid-012345@address_at-test.org");
-        Assert.assertEquals(0, validator.validate(customer).size());
+        assertTrue(validator.validate(customer).isEmpty());
     }
 
+    @Test
     public void testEmailCharSequence() {
         EmailAddressBuilder emailAddressBuilder = new EmailAddressBuilder();
-        Assert.assertEquals(0, validator.validate(emailAddressBuilder).size());
+        assertTrue(validator.validate(emailAddressBuilder).isEmpty());
         emailAddressBuilder.getBuffer().append("foo");
-        Assert.assertEquals(1, validator.validate(emailAddressBuilder).size());
+        assertEquals(1, validator.validate(emailAddressBuilder).size());
         emailAddressBuilder.getBuffer().append('@');
-        Assert.assertEquals(1, validator.validate(emailAddressBuilder).size());
+        assertEquals(1, validator.validate(emailAddressBuilder).size());
         emailAddressBuilder.getBuffer().append("bar");
-        Assert.assertEquals(0, validator.validate(emailAddressBuilder).size());
+        assertTrue(validator.validate(emailAddressBuilder).isEmpty());
         emailAddressBuilder.getBuffer().append('.');
-        Assert.assertEquals(1, validator.validate(emailAddressBuilder).size());
+        assertEquals(1, validator.validate(emailAddressBuilder).size());
         emailAddressBuilder.getBuffer().append("baz");
-        Assert.assertEquals(0, validator.validate(emailAddressBuilder).size());
+        assertTrue(validator.validate(emailAddressBuilder).isEmpty());
     }
 
-    public static Test suite() {
-        return new TestSuite(EmailValidatorTest.class);
-    }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java b/bval-jsr/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java
index e4f68dc..94da107 100644
--- a/bval-jsr/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java
@@ -18,14 +18,17 @@
  */
 package org.apache.bval.constraints;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+
+import java.util.Set;
 
 import javax.validation.ConstraintViolation;
 import javax.validation.Validation;
 import javax.validation.Validator;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
-import java.util.Set;
+
+import org.junit.Test;
 
 /**
  * Check correct behaviour of {@link MinValidatorForNumber} and
@@ -36,7 +39,7 @@ import java.util.Set;
  * 
  * @author Carlos Vara
  */
-public class MinMaxValidatorsForNumberTest extends TestCase {
+public class MinMaxValidatorsForNumberTest {
 
     @Min(value = 9223372036854775807l)
     public long min;
@@ -44,6 +47,7 @@ public class MinMaxValidatorsForNumberTest extends TestCase {
     @Max(value = 9223372036854775806l)
     public long max;
 
+    @Test
     public void testMinBoundaryValue() {
         Validator v = Validation.buildDefaultValidatorFactory().getValidator();
 
@@ -55,6 +59,7 @@ public class MinMaxValidatorsForNumberTest extends TestCase {
         assertFalse("Min validation failed", res.isEmpty());
     }
 
+    @Test
     public void testMaxBoundaryValue() {
         Validator v = Validation.buildDefaultValidatorFactory().getValidator();
 

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/constraints/NotNullValidatorTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/constraints/NotNullValidatorTest.java b/bval-jsr/src/test/java/org/apache/bval/constraints/NotNullValidatorTest.java
index a48150d..4f45f80 100644
--- a/bval-jsr/src/test/java/org/apache/bval/constraints/NotNullValidatorTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/constraints/NotNullValidatorTest.java
@@ -18,10 +18,10 @@
  */
 package org.apache.bval.constraints;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
+import org.junit.Test;
 
 /**
  * Checks correct behaviour of {@link NotNullValidator}.
@@ -37,19 +37,12 @@ import junit.framework.TestSuite;
  * 
  * @author Carlos Vara
  */
-public class NotNullValidatorTest extends TestCase {
+public class NotNullValidatorTest {
 
-    public static Test suite() {
-        return new TestSuite(NotNullValidatorTest.class);
-    }
-    
-    public NotNullValidatorTest(String name) {
-    	super(name);
-    }
-    
     /**
      * Test {@link NotNullValidator} with null context.
      */
+    @Test
     public void testNotNullValidator() {
     	NotNullValidator nnv = new NotNullValidator();
     	assertTrue("Non null value validation must succeed", nnv.isValid("hello", null));

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/constraints/NullValidatorTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/constraints/NullValidatorTest.java b/bval-jsr/src/test/java/org/apache/bval/constraints/NullValidatorTest.java
index 7cfe281..fe39b2e 100644
--- a/bval-jsr/src/test/java/org/apache/bval/constraints/NullValidatorTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/constraints/NullValidatorTest.java
@@ -18,10 +18,10 @@
  */
 package org.apache.bval.constraints;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
+import org.junit.Test;
 
 /**
  * Checks correct behaviour of {@link NullValidator}.
@@ -37,19 +37,12 @@ import junit.framework.TestSuite;
  * 
  * @author Carlos Vara
  */
-public class NullValidatorTest extends TestCase {
+public class NullValidatorTest {
 
-    public static Test suite() {
-        return new TestSuite(NullValidatorTest.class);
-    }
-    
-    public NullValidatorTest(String name) {
-    	super(name);
-    }
-	
     /**
      * Test {@link AssertFalseValidator} with null context.
      */
+    @Test
     public void testNullValidator() {
     	NullValidator nv = new NullValidator();
     	assertTrue("Null value validation must succeed", nv.isValid(null, null));

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/constraints/ZipCodeCityCoherenceValidator.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/constraints/ZipCodeCityCoherenceValidator.java b/bval-jsr/src/test/java/org/apache/bval/constraints/ZipCodeCityCoherenceValidator.java
index 5d9f262..ab53656 100644
--- a/bval-jsr/src/test/java/org/apache/bval/constraints/ZipCodeCityCoherenceValidator.java
+++ b/bval-jsr/src/test/java/org/apache/bval/constraints/ZipCodeCityCoherenceValidator.java
@@ -46,7 +46,7 @@ public class ZipCodeCityCoherenceValidator
         }
         if ("error".equals(adr.getCity())) {
             context.disableDefaultConstraintViolation();
-            context.buildConstraintViolationWithTemplate("city not OK").addNode("city").addConstraintViolation();
+            context.buildConstraintViolationWithTemplate("city not OK").addPropertyNode("city").addConstraintViolation();
             r = false;
         }
         return r;

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/jsr/BeanDescriptorTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/BeanDescriptorTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/BeanDescriptorTest.java
index a3e8014..0db4e5c 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/BeanDescriptorTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/BeanDescriptorTest.java
@@ -18,15 +18,20 @@
  */
 package org.apache.bval.jsr;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.bval.jsr.util.TestUtils;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.util.Set;
 
 import javax.validation.Constraint;
 import javax.validation.Payload;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
 import javax.validation.constraints.NotNull;
 import javax.validation.groups.Default;
 import javax.validation.metadata.BeanDescriptor;
@@ -35,16 +40,9 @@ import javax.validation.metadata.ElementDescriptor;
 import javax.validation.metadata.ElementDescriptor.ConstraintFinder;
 import javax.validation.metadata.PropertyDescriptor;
 import javax.validation.metadata.Scope;
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import java.util.Locale;
-import java.util.Set;
 
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import org.apache.bval.jsr.util.TestUtils;
+import org.junit.Test;
 
 /**
  * Tests the implementation of {@link BeanDescriptor} and its dependent
@@ -52,62 +50,35 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  * 
  * @author Carlos Vara
  */
-public class BeanDescriptorTest extends TestCase {
-    static ValidatorFactory factory;
-
-    static {
-        factory = Validation.buildDefaultValidatorFactory();
-        ((DefaultMessageInterpolator) factory.getMessageInterpolator()).setLocale(Locale.ENGLISH);
-    }
-
-    /**
-     * Validator instance to test
-     */
-    protected Validator validator;
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        validator = createValidator();
-    }
-
-    /**
-     * Create the validator instance.
-     * 
-     * @return Validator
-     */
-    protected Validator createValidator() {
-        return factory.getValidator();
-    }
+public class BeanDescriptorTest extends ValidationTestBase {
 
     /**
      * Check that groups(), message() and payload() are always in the
      * attributes.
      */
+    @Test
     public void testMandatoryAttributesPresentInConstraintDescriptor() {
         Set<ConstraintDescriptor<?>> nameDescriptors =
             validator.getConstraintsForClass(Form.class).getConstraintsForProperty("name").getConstraintDescriptors();
-        Assert.assertEquals("Incorrect number of descriptors", 1, nameDescriptors.size());
+        assertEquals("Incorrect number of descriptors", 1, nameDescriptors.size());
         ConstraintDescriptor<?> nameDescriptor = nameDescriptors.iterator().next();
-        Assert.assertTrue("groups attribute not present", nameDescriptor.getAttributes().containsKey("groups"));
-        Assert.assertTrue("payload attribute not present", nameDescriptor.getAttributes().containsKey("payload"));
-        Assert.assertTrue("message attribute not present", nameDescriptor.getAttributes().containsKey("message"));
+        assertTrue("groups attribute not present", nameDescriptor.getAttributes().containsKey("groups"));
+        assertTrue("payload attribute not present", nameDescriptor.getAttributes().containsKey("payload"));
+        assertTrue("message attribute not present", nameDescriptor.getAttributes().containsKey("message"));
     }
 
     /**
      * Check that the groups() attribute value has the correct value when
      * inheriting groups.
      */
+    @Test
     public void testCorrectValueForInheritedGroupsAttribute() {
         Set<ConstraintDescriptor<?>> passwordDescriptors =
             validator.getConstraintsForClass(Account.class).getConstraintsForProperty("password")
                 .getConstraintDescriptors();
-        Assert.assertEquals("Incorrect number of descriptors", 1, passwordDescriptors.size());
+        assertEquals("Incorrect number of descriptors", 1, passwordDescriptors.size());
         ConstraintDescriptor<?> passwordDescriptor = passwordDescriptors.iterator().next();
-        Assert.assertEquals("Incorrect number of composing constraints", 1, passwordDescriptor
+        assertEquals("Incorrect number of composing constraints", 1, passwordDescriptor
             .getComposingConstraints().size());
         ConstraintDescriptor<?> notNullDescriptor = passwordDescriptor.getComposingConstraints().iterator().next();
 
@@ -120,7 +91,7 @@ public class BeanDescriptorTest extends TestCase {
                 break;
             }
         }
-        Assert.assertTrue("Group1 not present in groups attribute", found);
+        assertTrue("Group1 not present in groups attribute", found);
     }
 
     /**
@@ -128,19 +99,20 @@ public class BeanDescriptorTest extends TestCase {
      * implicit group when the constraint is defined in that interface instead
      * of the queried class.
      */
+    @Test
     public void testImplicitGroupIsPresent() {
         Set<ConstraintDescriptor<?>> nameDescriptors =
             validator.getConstraintsForClass(Woman.class).getConstraintsForProperty("name").getConstraintDescriptors();
-        Assert.assertEquals("Incorrect number of descriptors", 1, nameDescriptors.size());
+        assertEquals("Incorrect number of descriptors", 1, nameDescriptors.size());
         ConstraintDescriptor<?> notNullDescriptor = nameDescriptors.iterator().next();
 
         // Check that the groups attribute value contains the implicit group
         // Person and the Default group
         Class<?>[] notNullGroups = (Class<?>[]) notNullDescriptor.getAttributes().get("groups");
-        Assert.assertEquals("Incorrect number of groups", 2, notNullGroups.length);
-        Assert.assertTrue("Default group not present", notNullGroups[0].equals(Default.class)
+        assertEquals("Incorrect number of groups", 2, notNullGroups.length);
+        assertTrue("Default group not present", notNullGroups[0].equals(Default.class)
             || notNullGroups[1].equals(Default.class));
-        Assert.assertTrue("Implicit group not present", notNullGroups[0].equals(Person.class)
+        assertTrue("Implicit group not present", notNullGroups[0].equals(Person.class)
             || notNullGroups[1].equals(Person.class));
     }
 
@@ -148,47 +120,50 @@ public class BeanDescriptorTest extends TestCase {
      * Check that the groups() attribute value does not contain the implicit
      * interface group when querying the interface directly.
      */
+    @Test
     public void testNoImplicitGroupWhenQueryingInterfaceDirectly() {
         Set<ConstraintDescriptor<?>> nameDescriptors =
             validator.getConstraintsForClass(Person.class).getConstraintsForProperty("name").getConstraintDescriptors();
-        Assert.assertEquals("Incorrect number of descriptors", 1, nameDescriptors.size());
+        assertEquals("Incorrect number of descriptors", 1, nameDescriptors.size());
         ConstraintDescriptor<?> notNullDescriptor = nameDescriptors.iterator().next();
 
         // Check that only the default group is present
         Class<?>[] notNullGroups = (Class<?>[]) notNullDescriptor.getAttributes().get("groups");
-        Assert.assertEquals("Incorrect number of groups", 1, notNullGroups.length);
-        Assert.assertTrue("Default group not present", notNullGroups[0].equals(Default.class));
+        assertEquals("Incorrect number of groups", 1, notNullGroups.length);
+        assertTrue("Default group not present", notNullGroups[0].equals(Default.class));
     }
 
     /**
      * Check that the implementations of
      * {@link ElementDescriptor#getElementClass()} work as defined in the spec.
      */
+    @Test
     public void testElementDescriptorGetElementClass() {
         BeanDescriptor beanDescriptor = validator.getConstraintsForClass(Person.class);
-        Assert.assertEquals("Incorrect class returned", Person.class, beanDescriptor.getElementClass());
+        assertEquals("Incorrect class returned", Person.class, beanDescriptor.getElementClass());
 
         PropertyDescriptor nameDescriptor = beanDescriptor.getConstraintsForProperty("name");
-        Assert.assertEquals("Incorrect class returned", String.class, nameDescriptor.getElementClass());
+        assertEquals("Incorrect class returned", String.class, nameDescriptor.getElementClass());
     }
 
     /**
      * Check the correct behavior of
      * {@link ConstraintFinder#lookingAt(javax.validation.metadata.Scope)}.
      */
+    @Test
     public void testConstraintFinderLookingAt() {
         PropertyDescriptor nameDescriptor =
             validator.getConstraintsForClass(Woman.class).getConstraintsForProperty("name");
         Set<ConstraintDescriptor<?>> constraints =
             nameDescriptor.findConstraints().lookingAt(Scope.HIERARCHY).getConstraintDescriptors();
-        Assert.assertEquals("Incorrect number of descriptors", 1, constraints.size());
+        assertEquals("Incorrect number of descriptors", 1, constraints.size());
 
         constraints = nameDescriptor.findConstraints().lookingAt(Scope.LOCAL_ELEMENT).getConstraintDescriptors();
-        Assert.assertEquals("Incorrect number of descriptors", 0, constraints.size());
+        assertEquals("Incorrect number of descriptors", 0, constraints.size());
         TestUtils.failOnModifiable(constraints, "constraintFinder constraintDescriptors");
         //verify that changes to one ConstraintFinder don't affect the base:
         constraints = nameDescriptor.getConstraintDescriptors();
-        Assert.assertEquals("Incorrect number of descriptors", 1, constraints.size());
+        assertEquals("Incorrect number of descriptors", 1, constraints.size());
     }
 
     public static class Form {

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/jsr/BootstrapTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/BootstrapTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/BootstrapTest.java
index 693ebc9..2483236 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/BootstrapTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/BootstrapTest.java
@@ -18,10 +18,15 @@
  */
 package org.apache.bval.jsr;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.bval.constraints.NotNullValidator;
-import org.apache.bval.jsr.example.Customer;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
 
 import javax.validation.Configuration;
 import javax.validation.ConstraintValidator;
@@ -35,35 +40,42 @@ import javax.validation.Validator;
 import javax.validation.ValidatorFactory;
 import javax.validation.bootstrap.ProviderSpecificBootstrap;
 import javax.validation.spi.ValidationProvider;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
+
+import org.apache.bval.constraints.NotNullValidator;
+import org.apache.bval.jsr.example.Customer;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
 /**
  * Description: <br/>
  */
-public class BootstrapTest extends TestCase {
+public class BootstrapTest {
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    @Test
     public void testDirectBootstrap() {
         Validator validator = ApacheValidatorFactory.getDefault().getValidator();
-        Assert.assertNotNull(validator);
-        Assert.assertTrue(ApacheValidatorFactory.getDefault() == ApacheValidatorFactory.getDefault());
+        assertNotNull(validator);
+        assertTrue(ApacheValidatorFactory.getDefault() == ApacheValidatorFactory.getDefault());
     }
 
+    @Test
     public void testEverydayBootstrap() {
         ApacheValidatorFactory factory = (ApacheValidatorFactory) Validation.buildDefaultValidatorFactory();
         Validator validator = factory.getValidator();
-        Assert.assertNotNull(validator);
+        assertNotNull(validator);
 
         // each call to Validation.getValidationBuilder() returns a new builder
         // with new state
         ApacheValidatorFactory factory2 = (ApacheValidatorFactory) Validation.buildDefaultValidatorFactory();
-        Assert.assertTrue(factory2 != factory);
-        Assert.assertTrue(factory2.getMessageInterpolator() != factory.getMessageInterpolator());
+        assertTrue(factory2 != factory);
+        assertTrue(factory2.getMessageInterpolator() != factory.getMessageInterpolator());
 
     }
 
+    @Test
     public void testLocalizedMessageInterpolatorFactory() {
         Configuration<?> builder = Validation.byDefaultProvider().configure();
         // changing the builder allows to create different factories
@@ -82,7 +94,7 @@ public class BootstrapTest extends TestCase {
      * some tests based on RI tested behaviors to ensure our implementation
      * works as the reference implementation
      */
-
+    @Test
     public void testCustomConstraintFactory() {
 
         Configuration<?> builder = Validation.byDefaultProvider().configure();
@@ -95,7 +107,7 @@ public class BootstrapTest extends TestCase {
         customer.setFirstName("John");
 
         Set<ConstraintViolation<Customer>> ConstraintViolations = validator.validate(customer);
-        Assert.assertFalse(ConstraintViolations.isEmpty());
+        assertFalse(ConstraintViolations.isEmpty());
 
         builder = Validation.byDefaultProvider().configure();
         builder.constraintValidatorFactory(new ConstraintValidatorFactory() {
@@ -117,9 +129,10 @@ public class BootstrapTest extends TestCase {
         factory = builder.buildValidatorFactory();
         validator = factory.getValidator();
         Set<ConstraintViolation<Customer>> ConstraintViolations2 = validator.validate(customer);
-        Assert.assertTrue("Wrong number of constraints", ConstraintViolations.size() > ConstraintViolations2.size());
+        assertTrue("Wrong number of constraints", ConstraintViolations.size() > ConstraintViolations2.size());
     }
 
+    @Test
     public void testCustomResolverAndType() {
         ValidationProviderResolver resolver = new ValidationProviderResolver() {
 
@@ -136,6 +149,7 @@ public class BootstrapTest extends TestCase {
         assertDefaultBuilderAndFactory(builder);
     }
 
+    @Test
     public void testCustomResolver() {
         ValidationProviderResolver resolver = new ValidationProviderResolver() {
 
@@ -150,14 +164,15 @@ public class BootstrapTest extends TestCase {
     }
 
     private void assertDefaultBuilderAndFactory(Configuration<?> builder) {
-        Assert.assertNotNull(builder);
-        Assert.assertTrue(builder instanceof ConfigurationImpl);
+        assertNotNull(builder);
+        assertTrue(builder instanceof ConfigurationImpl);
 
         ValidatorFactory factory = builder.buildValidatorFactory();
-        Assert.assertNotNull(factory);
-        Assert.assertTrue(factory instanceof ApacheValidatorFactory);
+        assertNotNull(factory);
+        assertTrue(factory instanceof ApacheValidatorFactory);
     }
 
+    @Test
     public void testFailingCustomResolver() {
         ValidationProviderResolver resolver = new ValidationProviderResolver() {
 
@@ -172,14 +187,12 @@ public class BootstrapTest extends TestCase {
 
         final ProviderSpecificBootstrap<ApacheValidatorConfiguration> specializedBuilderFactory =
             type.providerResolver(resolver);
+        
+        thrown.expect(ValidationException.class);
+        thrown.expectMessage("provider");
+        thrown.expectMessage(ApacheValidationProvider.class.getName());
 
-        try {
-            specializedBuilderFactory.configure();
-            Assert.fail();
-        } catch (ValidationException e) {
-            Assert.assertTrue("Wrong error message", e.getMessage().contains("provider")
-                && e.getMessage().contains("org.apache.bval.jsr.ApacheValidationProvider"));
-        }
+        specializedBuilderFactory.configure();
     }
 
     class BadlyBehavedNotNullValidator extends NotNullValidator {

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/jsr/CircularReferencesTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/CircularReferencesTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/CircularReferencesTest.java
index 348e850..ef70f77 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/CircularReferencesTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/CircularReferencesTest.java
@@ -19,17 +19,15 @@
 
 package org.apache.bval.jsr;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Set;
 
 import javax.validation.ConstraintViolation;
 import javax.validation.Valid;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
 import javax.validation.constraints.Size;
-import java.util.Locale;
-import java.util.Set;
+
+import org.junit.Test;
 
 /**
  * Checks that circular references in the bean graph are correctly detected when
@@ -37,41 +35,13 @@ import java.util.Set;
  * 
  * @author Carlos Vara
  */
-public class CircularReferencesTest extends TestCase {
-    static ValidatorFactory factory;
-
-    static {
-        factory = Validation.buildDefaultValidatorFactory();
-        ((DefaultMessageInterpolator) factory.getMessageInterpolator()).setLocale(Locale.ENGLISH);
-    }
-
-    /**
-     * Validator instance to test
-     */
-    protected Validator validator;
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        validator = createValidator();
-    }
-
-    /**
-     * Create the validator instance.
-     * 
-     * @return Validator
-     */
-    protected Validator createValidator() {
-        return factory.getValidator();
-    }
+public class CircularReferencesTest extends ValidationTestBase {
 
     /**
      * Checks that validation correctly stops when finding a circular
      * dependency.
      */
+    @Test
     public void testAutoreferringBean() {
         Person p1 = new Person();
         p1.name = "too-long-name";
@@ -79,15 +49,16 @@ public class CircularReferencesTest extends TestCase {
 
         Set<ConstraintViolation<Person>> violations = validator.validate(p1);
 
-        Assert.assertEquals("Only 1 violation should be reported", 1, violations.size());
+        assertEquals("Only 1 violation should be reported", 1, violations.size());
         ConstraintViolation<Person> violation = violations.iterator().next();
-        Assert.assertEquals("Incorrect violation path", "name", violation.getPropertyPath().toString());
+        assertEquals("Incorrect violation path", "name", violation.getPropertyPath().toString());
     }
 
     /**
      * Checks that a bean is always validated when appearing in non-circular
      * paths inside the bean graph.
      */
+    @Test
     public void testNonCircularArrayOfSameBean() {
         Boss boss = new Boss();
         Person p1 = new Person();
@@ -97,7 +68,7 @@ public class CircularReferencesTest extends TestCase {
 
         Set<ConstraintViolation<Boss>> violations = validator.validate(boss);
 
-        Assert.assertEquals("A total of 4 violations should be reported", 4, violations.size());
+        assertEquals("A total of 4 violations should be reported", 4, violations.size());
     }
 
     public static class Person {

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/jsr/ComposedConstraintsTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/ComposedConstraintsTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/ComposedConstraintsTest.java
index deabe48..49b2465 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/ComposedConstraintsTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/ComposedConstraintsTest.java
@@ -18,71 +18,43 @@
  */
 package org.apache.bval.jsr;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.bval.jsr.example.CompanyAddress;
-import org.apache.bval.jsr.example.FrenchAddress;
-import org.apache.bval.jsr.util.TestUtils;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Set;
 
 import javax.validation.ConstraintViolation;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
 import javax.validation.constraints.Size;
 import javax.validation.metadata.ConstraintDescriptor;
 import javax.validation.metadata.ElementDescriptor;
-import java.util.Locale;
-import java.util.Set;
+
+import org.apache.bval.jsr.example.CompanyAddress;
+import org.apache.bval.jsr.example.FrenchAddress;
+import org.apache.bval.jsr.util.TestUtils;
+import org.junit.Test;
 
 /**
  * Description: <br/>
  */
-public class ComposedConstraintsTest extends TestCase {
-    static ValidatorFactory factory;
-
-    static {
-        factory = Validation.buildDefaultValidatorFactory();
-        ((DefaultMessageInterpolator) factory.getMessageInterpolator()).setLocale(Locale.ENGLISH);
-    }
-
-    /**
-     * Validator instance to test
-     */
-    protected Validator validator;
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        validator = createValidator();
-    }
-
-    /**
-     * Create the validator instance.
-     * 
-     * @return Validator
-     */
-    protected Validator createValidator() {
-        return factory.getValidator();
-    }
+public class ComposedConstraintsTest extends ValidationTestBase {
 
+    @Test
     public void testMetaDataAPI_ComposedConstraints() {
         ElementDescriptor ed =
               validator.getConstraintsForClass(FrenchAddress.class)
                     .getConstraintsForProperty("zipCode");
-        Assert.assertEquals(1, ed.getConstraintDescriptors().size());
+        assertEquals(1, ed.getConstraintDescriptors().size());
         for (ConstraintDescriptor<?> cd : ed.getConstraintDescriptors()) {
-            Assert.assertTrue(cd.isReportAsSingleViolation());
-            Assert.assertEquals(3, cd.getComposingConstraints().size());
-            Assert.assertTrue("no composing constraints found!!",
+            assertTrue(cd.isReportAsSingleViolation());
+            assertEquals(3, cd.getComposingConstraints().size());
+            assertTrue("no composing constraints found!!",
                   !cd.getComposingConstraints().isEmpty());
             processConstraintDescriptor(cd); //check all constraints on zip code
         }
     }
 
-    public void processConstraintDescriptor(ConstraintDescriptor<?> cd) {
+    private void processConstraintDescriptor(ConstraintDescriptor<?> cd) {
         //Size.class is understood by the tool
         if (cd.getAnnotation().annotationType().equals(Size.class)) {
             @SuppressWarnings("unused")
@@ -94,23 +66,25 @@ public class ComposedConstraintsTest extends TestCase {
         }
     }
 
+    @Test
     public void testValidateComposed() {
         FrenchAddress adr = new FrenchAddress();
         Set<ConstraintViolation<FrenchAddress>> findings = validator.validate(adr);
-        Assert.assertEquals(1, findings.size()); // with @ReportAsSingleConstraintViolation
+        assertEquals(1, findings.size()); // with @ReportAsSingleConstraintViolation
 
         ConstraintViolation<FrenchAddress> finding = findings.iterator().next();
-        Assert.assertEquals("Wrong zipcode", finding.getMessage());
+        assertEquals("Wrong zipcode", finding.getMessage());
 
         adr.setZipCode("1234567");
         findings = validator.validate(adr);
-        Assert.assertEquals(0, findings.size());
+        assertEquals(0, findings.size());
 
         adr.setZipCode("1234567234567");
         findings = validator.validate(adr);
-        Assert.assertTrue(findings.size() > 0); // too long
+        assertTrue(findings.size() > 0); // too long
     }
 
+    @Test
     public void testOverridesAttributeConstraintIndex() {
         CompanyAddress adr = new CompanyAddress("invalid-string");
         Set<ConstraintViolation<CompanyAddress>> findings = validator.validate(adr);
@@ -125,7 +99,7 @@ public class ComposedConstraintsTest extends TestCase {
 
         adr =  new CompanyAddress("JOHN_DO@COMPANY.DE");
         findings = validator.validate(adr);
-        Assert.assertTrue(findings.isEmpty());
+        assertTrue(findings.isEmpty());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintCompositionTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintCompositionTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintCompositionTest.java
index 12e188b..309f06e 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintCompositionTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintCompositionTest.java
@@ -19,32 +19,30 @@
 
 package org.apache.bval.jsr;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.util.Set;
 
 import javax.validation.Constraint;
 import javax.validation.ConstraintViolation;
 import javax.validation.OverridesAttribute;
 import javax.validation.Payload;
 import javax.validation.ReportAsSingleViolation;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import javax.validation.metadata.ConstraintDescriptor;
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import java.util.Locale;
-import java.util.Set;
 
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import org.junit.Test;
 
 /**
  * Checks that groups are correctly inherited from the root constraint to its
@@ -52,71 +50,45 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  * 
  * @author Carlos Vara
  */
-public class ConstraintCompositionTest extends TestCase {
-    static ValidatorFactory factory;
-
-    static {
-        factory = Validation.buildDefaultValidatorFactory();
-        ((DefaultMessageInterpolator) factory.getMessageInterpolator()).setLocale(Locale.ENGLISH);
-    }
-
-    /**
-     * Validator instance to test
-     */
-    protected Validator validator;
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        validator = createValidator();
-    }
-
-    /**
-     * Create the validator instance.
-     * 
-     * @return Validator
-     */
-    protected Validator createValidator() {
-        return factory.getValidator();
-    }
+public class ConstraintCompositionTest extends ValidationTestBase {
 
     /**
      * Check correct group inheritance on constraint composition on a 1 level
      * hierarchy.
      */
+    @Test
     public void test1LevelInheritance() {
         Set<ConstraintViolation<Person>> violations = validator.validate(new Person());
 
-        Assert.assertEquals("Wrong number of violations detected", 1, violations.size());
+        assertEquals("Wrong number of violations detected", 1, violations.size());
         String msg = violations.iterator().next().getMessage();
-        Assert.assertEquals("Incorrect violation message", "A person needs a non null name", msg);
+        assertEquals("Incorrect violation message", "A person needs a non null name", msg);
 
         violations = validator.validate(new Person(), Group1.class);
-        Assert.assertEquals("Wrong number of violations detected", 0, violations.size());
+        assertEquals("Wrong number of violations detected", 0, violations.size());
     }
 
     /**
      * Check correct group inheritance on constraint composition on a 2 level
      * hierarchy.
      */
+    @Test
     public void test2LevelInheritance() {
         Set<ConstraintViolation<Man>> violations = validator.validate(new Man());
 
-        Assert.assertEquals("Wrong number of violations detected", 0, violations.size());
+        assertEquals("Wrong number of violations detected", 0, violations.size());
 
         violations = validator.validate(new Man(), Group1.class);
-        Assert.assertEquals("Wrong number of violations detected", 1, violations.size());
+        assertEquals("Wrong number of violations detected", 1, violations.size());
         String msg = violations.iterator().next().getMessage();
-        Assert.assertEquals("Incorrect violation message", "A person needs a non null name", msg);
+        assertEquals("Incorrect violation message", "A person needs a non null name", msg);
     }
 
     /**
      * Checks that the groups() value of the constraint annotations are
      * correctly set to the inherited ones.
      */
+    @Test
     public void testAnnotationGroupsAreInherited() {
         // Check that the groups() value is right when querying the metadata
         ConstraintDescriptor<?> manNameDesc =
@@ -124,25 +96,26 @@ public class ConstraintCompositionTest extends TestCase {
                 .iterator().next();
         ConstraintDescriptor<?> personNameDesc = manNameDesc.getComposingConstraints().iterator().next();
         ConstraintDescriptor<?> notNullDesc = personNameDesc.getComposingConstraints().iterator().next();
-        Assert.assertEquals("There should only be 1 group", 1, manNameDesc.getGroups().size());
-        Assert.assertTrue("Group1 should be present", manNameDesc.getGroups().contains(Group1.class));
-        Assert.assertEquals("There should only be 1 group", 1, personNameDesc.getGroups().size());
-        Assert.assertTrue("Group1 should be present", personNameDesc.getGroups().contains(Group1.class));
-        Assert.assertEquals("There should only be 1 group", 1, personNameDesc.getGroups().size());
-        Assert.assertTrue("Group1 should be present", notNullDesc.getGroups().contains(Group1.class));
+        assertEquals("There should only be 1 group", 1, manNameDesc.getGroups().size());
+        assertTrue("Group1 should be present", manNameDesc.getGroups().contains(Group1.class));
+        assertEquals("There should only be 1 group", 1, personNameDesc.getGroups().size());
+        assertTrue("Group1 should be present", personNameDesc.getGroups().contains(Group1.class));
+        assertEquals("There should only be 1 group", 1, personNameDesc.getGroups().size());
+        assertTrue("Group1 should be present", notNullDesc.getGroups().contains(Group1.class));
 
         // Check that the groups() value is right when accessing it from an
         // error
         Set<ConstraintViolation<Man>> violations = validator.validate(new Man(), Group1.class);
         Set<Class<?>> notNullGroups = violations.iterator().next().getConstraintDescriptor().getGroups();
-        Assert.assertEquals("There should only be 1 group", 1, notNullGroups.size());
-        Assert.assertTrue("Group1 should be the only group", notNullGroups.contains(Group1.class));
+        assertEquals("There should only be 1 group", 1, notNullGroups.size());
+        assertTrue("Group1 should be the only group", notNullGroups.contains(Group1.class));
     }
 
     /**
      * Checks that the payload() value of the constraint annotations are
      * correctly set to the inherited ones.
      */
+    @Test
     public void testAnnotationPayloadsAreInherited() {
         // Check that the payload() value is right when querying the metadata
         ConstraintDescriptor<?> manNameDesc =
@@ -150,26 +123,27 @@ public class ConstraintCompositionTest extends TestCase {
                 .iterator().next();
         ConstraintDescriptor<?> personNameDesc = manNameDesc.getComposingConstraints().iterator().next();
         ConstraintDescriptor<?> notNullDesc = personNameDesc.getComposingConstraints().iterator().next();
-        Assert.assertEquals("There should only be 1 payload class", 1, manNameDesc.getPayload().size());
-        Assert.assertTrue("Payload1 should be present", manNameDesc.getPayload().contains(Payload1.class));
-        Assert.assertEquals("There should only be 1 payload class", 1, personNameDesc.getPayload().size());
-        Assert.assertTrue("Payload1 should be present", personNameDesc.getPayload().contains(Payload1.class));
-        Assert.assertEquals("There should only be 1 payload class", 1, personNameDesc.getPayload().size());
-        Assert.assertTrue("Payload1 should be present", notNullDesc.getPayload().contains(Payload1.class));
+        assertEquals("There should only be 1 payload class", 1, manNameDesc.getPayload().size());
+        assertTrue("Payload1 should be present", manNameDesc.getPayload().contains(Payload1.class));
+        assertEquals("There should only be 1 payload class", 1, personNameDesc.getPayload().size());
+        assertTrue("Payload1 should be present", personNameDesc.getPayload().contains(Payload1.class));
+        assertEquals("There should only be 1 payload class", 1, personNameDesc.getPayload().size());
+        assertTrue("Payload1 should be present", notNullDesc.getPayload().contains(Payload1.class));
 
         // Check that the payload() value is right when accessing it from an
         // error
         Set<ConstraintViolation<Man>> violations = validator.validate(new Man(), Group1.class);
         Set<Class<? extends Payload>> notNullPayload =
             violations.iterator().next().getConstraintDescriptor().getPayload();
-        Assert.assertEquals("There should only be 1 payload class", 1, notNullPayload.size());
-        Assert.assertTrue("Payload1 should be the only payload", notNullPayload.contains(Payload1.class));
+        assertEquals("There should only be 1 payload class", 1, notNullPayload.size());
+        assertTrue("Payload1 should be the only payload", notNullPayload.contains(Payload1.class));
     }
 
     /**
      * Checks that {@link OverridesAttribute#constraintIndex()} parsing and
      * applying works.
      */
+    @Test
     public void testIndexedOverridesAttributes() {
         Person p = new Person();
         p.name = "valid";
@@ -177,38 +151,39 @@ public class ConstraintCompositionTest extends TestCase {
         // With a valid id, no errors expected
         p.id = "1234";
         Set<ConstraintViolation<Person>> constraintViolations = validator.validate(p);
-        Assert.assertTrue("No violations should be reported on valid id", constraintViolations.isEmpty());
+        assertTrue("No violations should be reported on valid id", constraintViolations.isEmpty());
 
         // With a short id, only 1 error expected
         p.id = "1";
         constraintViolations = validator.validate(p);
-        Assert.assertEquals("Only 1 violation expected", 1, constraintViolations.size());
+        assertEquals("Only 1 violation expected", 1, constraintViolations.size());
         ConstraintViolation<Person> violation = constraintViolations.iterator().next();
-        Assert.assertEquals("Wrong violation", "Id is too short", violation.getMessage());
+        assertEquals("Wrong violation", "Id is too short", violation.getMessage());
 
         // With a long id, only 1 error expected
         p.id = "loooooong id";
         constraintViolations = validator.validate(p);
-        Assert.assertEquals("Only 1 violation expected", 1, constraintViolations.size());
+        assertEquals("Only 1 violation expected", 1, constraintViolations.size());
         violation = constraintViolations.iterator().next();
-        Assert.assertEquals("Wrong violation", "Id is too long", violation.getMessage());
+        assertEquals("Wrong violation", "Id is too long", violation.getMessage());
     }
 
     /**
      * Checks that errors are reported correctly when using
      * {@link ReportAsSingleViolation}.
      */
+    @Test
     public void testReportAsAsingleViolation() {
         Code c = new Code();
         c.code = "very invalid code";
         Set<ConstraintViolation<Code>> constraintViolations = validator.validate(c);
 
         // Only 1 error expected
-        Assert.assertEquals("Only 1 violation expected", 1, constraintViolations.size());
+        assertEquals("Only 1 violation expected", 1, constraintViolations.size());
         ConstraintViolation<Code> violation = constraintViolations.iterator().next();
-        Assert.assertEquals("Wrong violation message", "Invalid code", violation.getMessage());
-        Assert.assertEquals("Wrong violation type", ElevenDigitsCode.class, ((Annotation) violation
-            .getConstraintDescriptor().getAnnotation()).annotationType());
+        assertEquals("Wrong violation message", "Invalid code", violation.getMessage());
+        assertEquals("Wrong violation type", ElevenDigitsCode.class,
+            ((Annotation) violation.getConstraintDescriptor().getAnnotation()).annotationType());
     }
 
     public static class Person {

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintDefinitionsTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintDefinitionsTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintDefinitionsTest.java
index cae69c7..4060808 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintDefinitionsTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintDefinitionsTest.java
@@ -18,79 +18,48 @@
  */
 package org.apache.bval.jsr;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.bval.constraints.NotNullValidator;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.junit.Assert.assertEquals;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.util.Set;
 
 import javax.validation.Constraint;
 import javax.validation.ConstraintDefinitionException;
 import javax.validation.Payload;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
 import javax.validation.constraints.Min;
 import javax.validation.metadata.BeanDescriptor;
 import javax.validation.metadata.ConstraintDescriptor;
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import java.util.Locale;
-import java.util.Set;
 
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import org.apache.bval.constraints.NotNullValidator;
+import org.junit.Test;
 
 /**
  * Checks the correct parsing of constraint definitions.
  * 
  * @author Carlos Vara
  */
-public class ConstraintDefinitionsTest extends TestCase {
-    static ValidatorFactory factory;
-
-    static {
-        factory = Validation.buildDefaultValidatorFactory();
-        ((DefaultMessageInterpolator) factory.getMessageInterpolator()).setLocale(Locale.ENGLISH);
-    }
-
-    /**
-     * Validator instance to test
-     */
-    protected Validator validator;
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        validator = createValidator();
-    }
-
-    /**
-     * Create the validator instance.
-     * 
-     * @return Validator
-     */
-    protected Validator createValidator() {
-        return factory.getValidator();
-    }
+public class ConstraintDefinitionsTest extends ValidationTestBase {
 
     /**
      * Checks the correct parsing of a constraint with an array of constraints
      * as attributes.
      */
+    @Test
     public void testCustomAttributes() {
         BeanDescriptor constraints = validator.getConstraintsForClass(Person.class);
         Set<ConstraintDescriptor<?>> ageConstraints =
             constraints.getConstraintsForProperty("age").getConstraintDescriptors();
 
-        Assert.assertEquals("There should be 2 constraints in 'age'", ageConstraints.size(), 2);
+        assertEquals("There should be 2 constraints in 'age'", ageConstraints.size(), 2);
         for (ConstraintDescriptor<?> cd : ageConstraints) {
-            Assert.assertEquals("Annotation should be @Min", cd.getAnnotation().annotationType().getName(), Min.class
-                .getName());
+            assertEquals("Annotation should be @Min", cd.getAnnotation().annotationType().getName(),
+                Min.class.getName());
         }
     }
 
@@ -98,13 +67,9 @@ public class ConstraintDefinitionsTest extends TestCase {
      * Checks that a {@link ConstraintDefinitionException} is thrown when
      * parsing a constraint definition with no <code>groups()</code> method.
      */
+    @Test(expected = ConstraintDefinitionException.class)
     public void testNoGroupsConstraint() {
-        try {
-            validator.validate(new NoGroups());
-            fail("No exception thrown when parsing a constraint definition with no groups() method");
-        } catch (ConstraintDefinitionException e) {
-            // correct
-        }
+        validator.validate(new NoGroups());
     }
 
     /**
@@ -112,26 +77,18 @@ public class ConstraintDefinitionsTest extends TestCase {
      * parsing a constraint definition with an invalid <code>groups()</code>
      * method.
      */
+    @Test(expected = ConstraintDefinitionException.class)
     public void testInvalidDefaultGroupsConstraint() {
-        try {
-            validator.validate(new InvalidGroups());
-            fail("No exception thrown when parsing a constraint definition with a groups() method does not return Class[]");
-        } catch (ConstraintDefinitionException e) {
-            // correct
-        }
+        validator.validate(new InvalidGroups());
     }
 
     /**
      * Checks that a {@link ConstraintDefinitionException} is thrown when
      * parsing a constraint definition with no <code>payload()</code> method.
      */
+    @Test(expected = ConstraintDefinitionException.class)
     public void testNoPayloadConstraint() {
-        try {
-            validator.validate(new NoPayload());
-            fail("No exception thrown when parsing a constraint definition with no payload() method");
-        } catch (ConstraintDefinitionException e) {
-            // correct
-        }
+        validator.validate(new NoPayload());
     }
 
     /**
@@ -139,26 +96,18 @@ public class ConstraintDefinitionsTest extends TestCase {
      * parsing a constraint definition with an invalid <code>payload()</code>
      * method.
      */
+    @Test(expected = ConstraintDefinitionException.class)
     public void testInvalidDefaultPayloadConstraint() {
-        try {
-            validator.validate(new InvalidPayload());
-            fail("No exception thrown when parsing a constraint definition with a payload() method does not return an empty array");
-        } catch (ConstraintDefinitionException e) {
-            // correct
-        }
+        validator.validate(new InvalidPayload());
     }
 
     /**
      * Checks that a {@link ConstraintDefinitionException} is thrown when
      * parsing a constraint definition with no <code>message()</code> method.
      */
+    @Test(expected = ConstraintDefinitionException.class)
     public void testNoMessageConstraint() {
-        try {
-            validator.validate(new NoMessage());
-            fail("No exception thrown when parsing a constraint definition with no payload() method");
-        } catch (ConstraintDefinitionException e) {
-            // correct
-        }
+        validator.validate(new NoMessage());
     }
 
     /**
@@ -166,26 +115,18 @@ public class ConstraintDefinitionsTest extends TestCase {
      * parsing a constraint definition with an invalid <code>message()</code>
      * method.
      */
+    @Test(expected = ConstraintDefinitionException.class)
     public void testInvalidDefaultMessageConstraint() {
-        try {
-            validator.validate(new InvalidMessage());
-            fail("No exception thrown when parsing a constraint definition with a message() method does not return a String");
-        } catch (ConstraintDefinitionException e) {
-            // correct
-        }
+        validator.validate(new InvalidMessage());
     }
 
     /**
      * Checks that a {@link ConstraintDefinitionException} is thrown when
      * parsing a constraint definition with a method starting with 'valid'.
      */
+    @Test(expected = ConstraintDefinitionException.class)
     public void testInvalidAttributeConstraint() {
-        try {
-            validator.validate(new InvalidAttribute());
-            fail("No exception thrown when parsing a constraint definition with a method starting with 'valid'");
-        } catch (ConstraintDefinitionException e) {
-            // correct
-        }
+        validator.validate(new InvalidAttribute());
     }
 
     public static class Person {

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintValidatorContextTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintValidatorContextTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintValidatorContextTest.java
index 6aec46e..72f1aca 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintValidatorContextTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintValidatorContextTest.java
@@ -18,27 +18,32 @@
  */
 package org.apache.bval.jsr;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintValidatorContext.ConstraintViolationBuilder;
+
 import org.apache.bval.jsr.util.PathImpl;
 import org.apache.bval.model.ValidationListener;
 import org.apache.bval.model.ValidationListener.Error;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
 import org.mockito.invocation.InvocationOnMock;
+import org.mockito.runners.MockitoJUnitRunner;
 import org.mockito.stubbing.Answer;
 
-import javax.validation.ConstraintValidatorContext;
-import javax.validation.ConstraintValidatorContext.ConstraintViolationBuilder;
-
 /**
  * Checks to validate the correct implementation of
  * {@link ConstraintValidatorContext} and its sub-interfaces.
  * 
  * @author Carlos Vara
  */
-public class ConstraintValidatorContextTest extends TestCase {
+@RunWith(MockitoJUnitRunner.class)
+public class ConstraintValidatorContextTest {
 
     private ConstraintValidatorContextImpl cvc;
     private ConstraintViolationBuilder cvb;
@@ -49,10 +54,8 @@ public class ConstraintValidatorContextTest extends TestCase {
     /**
      * {@inheritDoc}
      */
-    @Override
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
-        MockitoAnnotations.initMocks(this);
         Mockito.when(groupValidationContext.getPropertyPath()).thenAnswer(new Answer<PathImpl>() {
 
             @Override
@@ -60,54 +63,53 @@ public class ConstraintValidatorContextTest extends TestCase {
                 return PathImpl.createPathFromString("");
             }
         });
-        this.cvc = new ConstraintValidatorContextImpl(groupValidationContext,
-                null);
+        this.cvc = new ConstraintValidatorContextImpl(groupValidationContext, null);
         this.cvc.disableDefaultConstraintViolation();
         this.cvb = cvc.buildConstraintViolationWithTemplate("dummy.msg.tpl");
     }
 
+    @Test
     public void testPerson1() {
         cvb.addNode("person").addNode(null).inIterable().atIndex(1).addConstraintViolation();
         final Error error = cvc.getErrorMessages().iterator().next();
         final PathImpl errorPath = (PathImpl) error.getOwner();
-        Assert.assertEquals("Incorrect path created", "person[1]", errorPath.toString());
+        assertEquals("Incorrect path created", "person[1]", errorPath.toString());
     }
 
+    @Test
     public void testPersonLawyerName() {
         cvb.addNode("person").addNode("name").inIterable().atKey("john")
                 .addConstraintViolation();
         Error error = cvc.getErrorMessages().iterator().next();
         PathImpl errorPath = (PathImpl) error.getOwner();
-        Assert.assertEquals("Incorrect path created", "person[john].name",
-                errorPath.toString());
+        assertEquals("Incorrect path created", "person[john].name", errorPath.toString());
     }
 
+    @Test
     public void test0Name() {
         cvb.addNode(null).addNode("name").inIterable().atIndex(0).addNode(null)
                 .inIterable().addConstraintViolation();
         Error error = cvc.getErrorMessages().iterator().next();
         PathImpl errorPath = (PathImpl) error.getOwner();
-        Assert.assertEquals("Incorrect path created", "[0].name[]", errorPath
-                .toString());
+        assertEquals("Incorrect path created", "[0].name[]", errorPath.toString());
     }
 
+    @Test
     public void testEmptyIndex() {
         cvb.addNode(null).addNode(null).inIterable().addConstraintViolation();
         Error error = cvc.getErrorMessages().iterator().next();
         PathImpl errorPath = (PathImpl) error.getOwner();
-        Assert.assertEquals("Incorrect path created", "[]", errorPath
-                .toString());
+        assertEquals("Incorrect path created", "[]", errorPath.toString());
     }
 
+    @Test
     public void testRootPath() {
         // Adding only nulls should still give a root path
         cvb.addNode(null).addNode(null).addNode(null).addNode(null)
                 .addConstraintViolation();
         Error error = cvc.getErrorMessages().iterator().next();
         PathImpl errorPath = (PathImpl) error.getOwner();
-        Assert.assertTrue("Created path must be a root path", errorPath
-                .isRootPath());
-
+        assertTrue("Created path must be a root path", errorPath.isRootPath());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/jsr/ContextConstraintValidatorFactoryTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/ContextConstraintValidatorFactoryTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/ContextConstraintValidatorFactoryTest.java
index ada7831..676eaed 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/ContextConstraintValidatorFactoryTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/ContextConstraintValidatorFactoryTest.java
@@ -18,7 +18,14 @@
  */
 package org.apache.bval.jsr;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.Set;
 
 import javax.validation.Constraint;
 import javax.validation.ConstraintValidator;
@@ -26,15 +33,10 @@ import javax.validation.ConstraintValidatorContext;
 import javax.validation.ConstraintValidatorFactory;
 import javax.validation.ConstraintViolation;
 import javax.validation.Payload;
-import javax.validation.Validation;
+import javax.validation.Validator;
 import javax.validation.ValidatorFactory;
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.util.Locale;
-import java.util.Set;
+
+import org.junit.Test;
 
 /**
  * <a href="https://issues.apache.org/jira/browse/BVAL-111">https://issues.apache.org/jira/browse/BVAL-111</a>
@@ -42,13 +44,7 @@ import java.util.Set;
  * rather using the instance available from the {@link ValidatorFactory}.  Thus any solutions to e.g. inject
  * collaborators into {@link ConstraintValidator} implementations would fail. 
  */
-public class ContextConstraintValidatorFactoryTest extends TestCase {
-	static ValidatorFactory factory;
-
-	static {
-		factory = Validation.buildDefaultValidatorFactory();
-		((DefaultMessageInterpolator) factory.getMessageInterpolator()).setLocale(Locale.ENGLISH);
-	}
+public class ContextConstraintValidatorFactoryTest extends ValidationTestBase {
 
 	@Documented
 	@Retention(RetentionPolicy.RUNTIME)
@@ -90,28 +86,33 @@ public class ContextConstraintValidatorFactoryTest extends TestCase {
 	public static class Example {
 	}
 
-	public void testContextBoundConstraintValidatorFactory() {
-		final ConstraintValidatorFactory constraintValidatorFactory = new ConstraintValidatorFactory() {
+    @Override
+    protected Validator createValidator() {
+        final ConstraintValidatorFactory constraintValidatorFactory = new ConstraintValidatorFactory() {
 
-			@Override
+            @Override
             public <T extends ConstraintValidator<?, ?>> T getInstance(Class<T> key) {
-				if (key.equals(Contrived.Validator.class)) {
-					final Contrived.Validator result = new Contrived.Validator();
-					result.setRequiredCollaborator(new Object());
-					@SuppressWarnings("unchecked")
-					final T t = (T) result;
-					return t;
-				}
-				return null;
-			}
+                if (key.equals(Contrived.Validator.class)) {
+                    final Contrived.Validator result = new Contrived.Validator();
+                    result.setRequiredCollaborator(new Object());
+                    @SuppressWarnings("unchecked")
+                    final T t = (T) result;
+                    return t;
+                }
+                return null;
+            }
 
             @Override
             public void releaseInstance(ConstraintValidator<?, ?> instance) {
                 // no-op
             }
         };
-		final Set<ConstraintViolation<Example>> violations = factory.usingContext().constraintValidatorFactory(constraintValidatorFactory)
-				.getValidator().validate(new Example());
+        return factory.usingContext().constraintValidatorFactory(constraintValidatorFactory).getValidator();
+    }
+
+	@Test
+	public void testContextBoundConstraintValidatorFactory() {
+		final Set<ConstraintViolation<Example>> violations = validator.validate(new Example());
 		assertTrue(violations.isEmpty());
 	}
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/a3bc513f/bval-jsr/src/test/java/org/apache/bval/jsr/CustomConstraintValidatorFactoryTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/CustomConstraintValidatorFactoryTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/CustomConstraintValidatorFactoryTest.java
index ffd9232..20ead2a 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/CustomConstraintValidatorFactoryTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/CustomConstraintValidatorFactoryTest.java
@@ -38,8 +38,7 @@ import javax.validation.ValidationException;
 import javax.validation.Validator;
 
 import org.apache.bval.jsr.CustomConstraintValidatorFactoryTest.GoodPerson.GoodPersonValidator;
-
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * Checks that overriding the default {@link ConstraintValidatorFactory} works
@@ -47,13 +46,14 @@ import junit.framework.TestCase;
  *
  * @author Carlos Vara
  */
-public class CustomConstraintValidatorFactoryTest extends TestCase {
+public class CustomConstraintValidatorFactoryTest {
 
     /**
      * If the custom ConstraintValidatorFactory returns <code>null</code> for a
      * valid {@link ConstraintValidatorFactory#getInstance(Class)} call, a
      * validation exception should be thrown.
      */
+    @Test(expected = ValidationException.class)
     public void testValidationExceptionWhenFactoryReturnsNullValidator() {
 
         ConstraintValidatorFactory customFactory = new ConstraintValidatorFactory() {
@@ -69,15 +69,11 @@ public class CustomConstraintValidatorFactoryTest extends TestCase {
         };
 
         // Create a validator with this factory
-        ApacheValidatorConfiguration customConfig = Validation.byProvider(ApacheValidationProvider.class).configure().constraintValidatorFactory(customFactory);
+        ApacheValidatorConfiguration customConfig =
+            Validation.byProvider(ApacheValidationProvider.class).configure().constraintValidatorFactory(customFactory);
         Validator validator = customConfig.buildValidatorFactory().getValidator();
 
-        try {
-            validator.validate(new Person());
-            fail("ValidationException must be thrown when factory returns a null constraint validator.");
-        } catch (ValidationException e) {
-            // correct
-        }
+        validator.validate(new Person());
     }
 
     @GoodPerson


Mime
View raw message