You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by mb...@apache.org on 2016/10/19 20:36:27 UTC

svn commit: r1765712 [3/3] - in /bval/trunk: bval-core/src/test/java/org/apache/bval/ bval-core/src/test/java/org/apache/bval/model/ bval-json/src/test/java/org/apache/bval/json/ bval-jsr/src/test/java/org/apache/bval/constraints/ bval-jsr/src/test/jav...

Modified: bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceIsolationTest.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceIsolationTest.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceIsolationTest.java (original)
+++ bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceIsolationTest.java Wed Oct 19 20:36:26 2016
@@ -18,19 +18,21 @@
  */
 package org.apache.bval.jsr.groups;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.bval.jsr.DefaultMessageInterpolator;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
 
 import javax.validation.ConstraintViolation;
 import javax.validation.GroupSequence;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
 import javax.validation.constraints.NotNull;
 import javax.validation.groups.Default;
-import java.util.Locale;
-import java.util.Set;
+
+import org.apache.bval.jsr.ValidationTestBase;
+import org.junit.Test;
 
 /**
  * Additional tests to check the correct processing of {@link GroupSequence}s
@@ -38,19 +40,7 @@ import java.util.Set;
  * 
  * @author Carlos Vara
  */
-public class GroupSequenceIsolationTest extends TestCase {
-    
-    static ValidatorFactory factory;
-
-    static {
-        factory = Validation.buildDefaultValidatorFactory();
-        ((DefaultMessageInterpolator)factory.getMessageInterpolator()).setLocale(Locale.ENGLISH);
-    }
-
-    private Validator getValidator() {
-        return factory.getValidator();
-    }
-
+public class GroupSequenceIsolationTest extends ValidationTestBase {
     
     /**
      * When validating the {@link Default} group in a bean whose class doesn't
@@ -58,83 +48,55 @@ public class GroupSequenceIsolationTest
      * checked for group sequence definitions and they must be evaluated in
      * order for the constraints defined on those classes.
      */
+    @Test
     public void testGroupSequencesInHierarchyClasses() {
-        Validator validator = getValidator();
-        
         HolderWithNoGS h = new HolderWithNoGS();
-        Set<ConstraintViolation<HolderWithNoGS>> violations;
-        
-        violations = validator.validate(h);
-        Assert.assertEquals("Unexpected number of violations", 2, violations.size());
-        for ( ConstraintViolation<HolderWithNoGS> violation : violations ) {
-            boolean good = violation.getPropertyPath().toString().equals("a1");
-            good |= violation.getPropertyPath().toString().equals("b2");
-            Assert.assertTrue("Wrong constraint", good);
-        }
+
+        assertEquals(set("a1", "b2"), violationPaths(validator.validate(h)));
 
         h.a1 = "good";
-        violations = validator.validate(h);
-        Assert.assertEquals("Unexpected number of violations", 2, violations.size());
-        for ( ConstraintViolation<HolderWithNoGS> violation : violations ) {
-            boolean good = violation.getPropertyPath().toString().equals("a2");
-            good |= violation.getPropertyPath().toString().equals("b2");
-            Assert.assertTrue("Wrong constraint", good);
-        }
+        assertEquals(set("a2", "b2"), violationPaths(validator.validate(h)));
         
         h.b2 = "good";
-        violations = validator.validate(h);
-        Assert.assertEquals("Unexpected number of violations", 2, violations.size());
-        for ( ConstraintViolation<HolderWithNoGS> violation : violations ) {
-            boolean good = violation.getPropertyPath().toString().equals("a2");
-            good |= violation.getPropertyPath().toString().equals("b1");
-            Assert.assertTrue("Wrong constraint", good);
-        }
-        
+        assertEquals(set("a2", "b1"), violationPaths(validator.validate(h)));
+
         h.b1 = "good";
-        violations = validator.validate(h);
-        Assert.assertEquals("Unexpected number of violations", 1, violations.size());
-        for ( ConstraintViolation<HolderWithNoGS> violation : violations ) {
-            boolean good = violation.getPropertyPath().toString().equals("a2");
-            Assert.assertTrue("Wrong constraint", good);
-        }
+        assertEquals(set("a2"), violationPaths(validator.validate(h)));
     }
-    
+
     /**
      * When validating the {@link Default} group in a bean whose class defines
      * a group sequence, that group sequence is used for all the constraints.
      */
+    @Test
     public void testGroupSequenceOfBeanClass() {
-        Validator validator = getValidator();
-        
         HolderWithGS h = new HolderWithGS();
-        Set<ConstraintViolation<HolderWithGS>> violations;
-        
-        violations = validator.validate(h);
-        Assert.assertEquals("Unexpected number of violations", 1, violations.size());
-        for ( ConstraintViolation<HolderWithGS> violation : violations ) {
-            boolean good = violation.getPropertyPath().toString().equals("a1");
-            Assert.assertTrue("Wrong constraint", good);
-        }
-        
+
+        assertEquals(Collections.singleton("a1"), violationPaths(validator.validate(h)));
+
         h.a1 = "good";
-        violations = validator.validate(h);
-        Assert.assertEquals("Unexpected number of violations", 2, violations.size());
-        for ( ConstraintViolation<HolderWithGS> violation : violations ) {
-            boolean good = violation.getPropertyPath().toString().equals("a2");
-            good |= violation.getPropertyPath().toString().equals("b2");
-            Assert.assertTrue("Wrong constraint", good);
-        }
-        
+        assertEquals(set("a2", "b2"), violationPaths(validator.validate(h)));
+
         h.a2 = "good";
         h.b2 = "good";
-        violations = validator.validate(h);
-        Assert.assertEquals("Unexpected number of violations", 1, violations.size());
-        for ( ConstraintViolation<HolderWithGS> violation : violations ) {
-            boolean good = violation.getPropertyPath().toString().equals("b1");
-            Assert.assertTrue("Wrong constraint", good);
+        assertEquals(Collections.singleton("b1"), violationPaths(validator.validate(h)));
+    }
+
+    private static <T> Set<T> set(T... elements) {
+        return new HashSet<T>(Arrays.asList(elements));
+    }
+
+    private static Set<String> violationPaths(Set<? extends ConstraintViolation<?>> violations) {
+        if (violations == null || violations.isEmpty()) {
+            return Collections.emptySet();
+        }
+        final Set<String> result = new LinkedHashSet<String>(violations.size());
+        for (ConstraintViolation<?> constraintViolation : violations) {
+            result.add(constraintViolation.getPropertyPath().toString());
         }
+        return result;
     }
-    
+
     @GroupSequence({GroupA1.class, A.class})
     public static class A {
         @NotNull(groups={GroupA1.class})
@@ -142,10 +104,10 @@ public class GroupSequenceIsolationTest
         @NotNull
         public String a2;
     }
-    
-    public static interface GroupA1 {
+
+    public interface GroupA1 {
     }
-    
+
     @GroupSequence({B.class, GroupB1.class})
     public static class B extends A {
         @NotNull(groups={GroupB1.class})
@@ -153,18 +115,15 @@ public class GroupSequenceIsolationTest
         @NotNull
         public String b2;
     }
-    
-    public static interface GroupB1 {
-        
+
+    public interface GroupB1 {
     }
-    
+
     // No group sequence definition
     public static class HolderWithNoGS extends B {
-        
     }
-    
+
     @GroupSequence({GroupA1.class, HolderWithGS.class, GroupB1.class})
     public static class HolderWithGS extends B {
-        
     }
 }

Modified: bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceTest.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceTest.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceTest.java (original)
+++ bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceTest.java Wed Oct 19 20:36:26 2016
@@ -18,11 +18,19 @@
  */
 package org.apache.bval.jsr.groups;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.GroupSequence;
+import javax.validation.constraints.NotNull;
+
 import org.apache.bval.jsr.ApacheValidatorFactory;
-import org.apache.bval.jsr.DefaultMessageInterpolator;
 import org.apache.bval.jsr.JsrFeatures;
+import org.apache.bval.jsr.ValidationTestBase;
 import org.apache.bval.jsr.example.Author;
 import org.apache.bval.jsr.example.Book;
 import org.apache.bval.jsr.example.First;
@@ -30,79 +38,61 @@ import org.apache.bval.jsr.example.Last;
 import org.apache.bval.jsr.example.Second;
 import org.apache.bval.jsr.util.TestUtils;
 import org.apache.bval.model.MetaBean;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.GroupSequence;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-import javax.validation.constraints.NotNull;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
+import org.junit.Test;
 
 /**
  * Description: test of group sequence behavior<br/>
  */
-public class GroupSequenceTest extends TestCase {
-
-    static ValidatorFactory factory;
-
-    static {
-        factory = Validation.buildDefaultValidatorFactory();
-        ((DefaultMessageInterpolator)factory.getMessageInterpolator()).setLocale(Locale.ENGLISH);
-    }
-
-    private Validator getValidator() {
-        return factory.getValidator();
-    }
-
+public class GroupSequenceTest extends ValidationTestBase {
 
+    @Test
     public void testGroupSequence1() {
         MetaBean metaBean =
               ApacheValidatorFactory.getDefault().usingContext().getMetaBeanFinder()
                     .findForClass(GInterface1.class);
         List<Group> gseq = metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE);
-        Assert.assertNotNull(gseq);
-        Assert.assertEquals(1, gseq.size());
-        Assert.assertEquals(Group.DEFAULT, gseq.get(0));
+        assertNotNull(gseq);
+        assertEquals(1, gseq.size());
+        assertEquals(Group.DEFAULT, gseq.get(0));
     }
 
+    @Test
     public void testGroupSequence2() {
         MetaBean metaBean =
               ApacheValidatorFactory.getDefault().usingContext().getMetaBeanFinder()
                     .findForClass(GClass1.class);
         List<Group> gseq = metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE);
-        Assert.assertNotNull(gseq);
-        Assert.assertEquals(1, gseq.size());
-        Assert.assertEquals(Group.DEFAULT, gseq.get(0));
+        assertNotNull(gseq);
+        assertEquals(1, gseq.size());
+        assertEquals(Group.DEFAULT, gseq.get(0));
     }
 
+    @Test
     public void testGroupSequence3() {
         MetaBean metaBean =
               ApacheValidatorFactory.getDefault().usingContext().getMetaBeanFinder()
                     .findForClass(GClass2.class);
         List<Group> gseq = metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE);
-        Assert.assertNotNull(gseq);
-        Assert.assertEquals(2, gseq.size());
-        Assert.assertEquals(new Group(GClass1.class), gseq.get(0));
-        Assert.assertEquals(Group.DEFAULT, gseq.get(1));
+        assertNotNull(gseq);
+        assertEquals(2, gseq.size());
+        assertEquals(new Group(GClass1.class), gseq.get(0));
+        assertEquals(Group.DEFAULT, gseq.get(1));
     }
 
+    @Test
     public void testGroupSequence4() {
         MetaBean metaBean =
               ApacheValidatorFactory.getDefault().usingContext().getMetaBeanFinder()
                     .findForClass(GClass3.class);
         List<Group> gseq = metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE);
-        Assert.assertNotNull(gseq);
-        Assert.assertEquals(2, gseq.size());
-        Assert.assertEquals(Group.DEFAULT, gseq.get(0));
-        Assert.assertEquals(new Group(GClass1.class), gseq.get(1));
+        assertNotNull(gseq);
+        assertEquals(2, gseq.size());
+        assertEquals(Group.DEFAULT, gseq.get(0));
+        assertEquals(new Group(GClass1.class), gseq.get(1));
     }
 
+    @Test
     public void testGroups() {
-        Validator validator = getValidator();
-
         Author author = new Author();
         author.setLastName("");
         author.setFirstName("");
@@ -156,9 +146,8 @@ public class GroupSequenceTest extends T
         assertEquals(0, constraintViolations.size());
     }
 
+    @Test
     public void testGroupSequence() {
-        Validator validator = getValidator();
-
         Author author = new Author();
         author.setLastName("");
         author.setFirstName("");
@@ -187,33 +176,31 @@ public class GroupSequenceTest extends T
         assertEquals(1, constraintViolations.size());
     }
 
-    
     /**
      * Check that when there is one constraint failure in one of the groups in
      * a sequence, validation stops.
      * JSR-303: 3.4.3
      */
+    @Test
     public void testValidationStopsWhenFailuresOnGroup() {
-        Validator validator = getValidator();
-        
         // Validate Dummy with its redefined Default group
         Set<ConstraintViolation<Dummy>> violations = validator.validate(new Dummy());
         assertEquals("Only 1 violation expected", 1, violations.size());
         ConstraintViolation<Dummy> violation = violations.iterator().next();
         assertEquals("Group1 should be evaluated first", "field1", violation.getPropertyPath().toString());
     }
-    
+
     @GroupSequence({Dummy.Group1.class, Dummy.class})
     public static class Dummy {
-        
+
         @NotNull(groups=Group1.class)
         public String field1;
-        
+
         @NotNull
         public String field2;
-        
+
         interface Group1 {
         }
     }
-    
+
 }

Modified: bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupValidationTest.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupValidationTest.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupValidationTest.java (original)
+++ bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupValidationTest.java Wed Oct 19 20:36:26 2016
@@ -18,29 +18,28 @@
  */
 package org.apache.bval.jsr.groups;
 
-import junit.framework.TestCase;
-import org.apache.bval.jsr.ApacheValidatorFactory;
-import org.apache.bval.jsr.util.TestUtils;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
 import java.util.Set;
 
+import javax.validation.ConstraintViolation;
+
+import org.apache.bval.jsr.ValidationTestBase;
+import org.apache.bval.jsr.util.TestUtils;
+import org.junit.Test;
+
 /**
- * Description: test features from spec chapter 3.4 group and group sequence<br/>
+ * Description: test features from spec chapter 3.4 group and group sequence
+ * <br/>
  */
-public class GroupValidationTest extends TestCase {
-    private Validator validator;
-
-    @Override
-    protected void setUp() {
-        validator = ApacheValidatorFactory.getDefault().getValidator();
-    }
+public class GroupValidationTest extends ValidationTestBase {
 
     /**
-     * test spec: @NotNull on firstname and on lastname are validated when
-     * the Default group is validated.
+     * test spec: @NotNull on firstname and on lastname are validated when the
+     * Default group is validated.
      */
+    @Test
     public void testValidateFirstNameLastNameWithDefaultGroup() {
         BillableUser user = new BillableUser();
 
@@ -58,27 +57,27 @@ public class GroupValidationTest extends
      * test spec: @NotNull is checked on defaultCreditCard when either the
      * Billable or BuyInOneClick group is validated.
      */
-  public void testValidateDefaultCreditCardInBillableGroup() {
+    @Test
+    public void testValidateDefaultCreditCardInBillableGroup() {
         BillableUser user = new BillableUser();
 
-        Set<ConstraintViolation<BillableUser>> violations = validator.validate(user,
-              Billable.class);
+        Set<ConstraintViolation<BillableUser>> violations = validator.validate(user, Billable.class);
         assertEquals(1, violations.size());
         ConstraintViolation<?> violation = TestUtils.getViolation(violations, "defaultCreditCard");
         assertNotNull(violation);
         assertEquals(user, violation.getRootBean());
     }
 
-  public void testValidateDefaultCreditCardInBillableAndByInOneClickGroup() {
+    @Test
+    public void testValidateDefaultCreditCardInBillableAndByInOneClickGroup() {
         BillableUser user = new BillableUser();
 
-        Set<ConstraintViolation<BillableUser>> violations = validator.validate(user,
-              BuyInOneClick.class, Billable.class);
+        Set<ConstraintViolation<BillableUser>> violations =
+            validator.validate(user, BuyInOneClick.class, Billable.class);
         assertEquals(1, violations.size());
         ConstraintViolation<?> violation = TestUtils.getViolation(violations, "defaultCreditCard");
         assertNotNull(violation);
         assertEquals(user, violation.getRootBean());
     }
 
-
 }

Modified: bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/InvalidRedefinedDefaultGroupAddress.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/InvalidRedefinedDefaultGroupAddress.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/InvalidRedefinedDefaultGroupAddress.java (original)
+++ bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/InvalidRedefinedDefaultGroupAddress.java Wed Oct 19 20:36:26 2016
@@ -29,11 +29,9 @@ import javax.validation.constraints.NotN
  */
 @GroupSequence({Address.class, Address.HighLevelCoherence.class})
 public class InvalidRedefinedDefaultGroupAddress {
-    @SuppressWarnings("unused")
     @NotNull(groups = Address.HighLevelCoherence.class)
     private String street;
 
-    @SuppressWarnings("unused")
     @NotNull
     private String city;
 

Modified: bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/RedefiningDefaultGroupTest.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/RedefiningDefaultGroupTest.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/RedefiningDefaultGroupTest.java (original)
+++ bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/groups/redefining/RedefiningDefaultGroupTest.java Wed Oct 19 20:36:26 2016
@@ -18,30 +18,29 @@
  */
 package org.apache.bval.jsr.groups.redefining;
 
-import junit.framework.TestCase;
-import org.apache.bval.jsr.ApacheValidatorFactory;
-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.GroupDefinitionException;
-import javax.validation.Validator;
-import java.util.Set;
+
+import org.apache.bval.jsr.ValidationTestBase;
+import org.apache.bval.jsr.util.TestUtils;
+import org.junit.Test;
 
 /**
  * Description: test Redefining the Default group for a class (spec. chapter 3.4.3)<br/>
  */
-public class RedefiningDefaultGroupTest extends TestCase {
-    private Validator validator;
-
-    @Override
-    protected void setUp() {
-        validator = ApacheValidatorFactory.getDefault().getValidator();
-    }
+public class RedefiningDefaultGroupTest extends ValidationTestBase {
 
     /**
      * when an address object is validated for the group Default,
      * all constraints belonging to the group Default and hosted on Address are evaluated
      */
+    @Test
     public void testValidateDefaultGroup() {
         Address address = new Address();
         Set<ConstraintViolation<Address>> violations = validator.validate(address);
@@ -57,7 +56,7 @@ public class RedefiningDefaultGroupTest
         assertTrue(violations.isEmpty());
 
         violations = validator.validate(address, Address.HighLevelCoherence.class);
-        assertEquals(0, violations.size());
+        assertTrue(violations.isEmpty());
 
         address.setCity("error");
         violations = validator.validate(address, Address.HighLevelCoherence.class);
@@ -75,6 +74,7 @@ public class RedefiningDefaultGroupTest
               1, violations.size());
     }
 
+    @Test
     public void testValidateProperty() {
         Address address = new Address();
         address.setStreet1("");
@@ -84,21 +84,16 @@ public class RedefiningDefaultGroupTest
         assertNotNull(TestUtils.getViolation(violations, "street1"));
     }
 
+    @Test
     public void testValidateValue() {
         Set<ConstraintViolation<Address>> violations = validator.validateValue(Address.class, "street1", "");
         //prove that ExtraCareful group was validated:
         assertEquals(1, violations.size());
         assertNotNull(TestUtils.getViolation(violations, "street1"));
     }
-    
-    public void testRaiseGroupDefinitionException() {
-        InvalidRedefinedDefaultGroupAddress address =
-              new InvalidRedefinedDefaultGroupAddress();
-        try {
-            validator.validate(address);
-            fail();
-        } catch (GroupDefinitionException ex) {
 
-        }
+    @Test(expected = GroupDefinitionException.class)
+    public void testRaiseGroupDefinitionException() {
+        validator.validate(new InvalidRedefinedDefaultGroupAddress());
     }
 }

Modified: bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/EnumerationConverterTestCase.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/EnumerationConverterTestCase.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/EnumerationConverterTestCase.java (original)
+++ bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/EnumerationConverterTestCase.java Wed Oct 19 20:36:26 2016
@@ -18,33 +18,26 @@
  */
 package org.apache.bval.jsr.util;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertEquals;
+
 import org.apache.commons.beanutils.Converter;
+import org.junit.Test;
 
 /**
  * EnumerationConverter tester.
  *
- * $Id: EnumerationConverterTestCase.java 1161648 2011-08-25 17:14:15Z romanstumm $
+ * $Id: EnumerationConverterTestCase.java 1161648 2011-08-25 17:14:15Z
+ * romanstumm $
  */
-public final class EnumerationConverterTestCase extends TestCase {
-
-    public EnumerationConverterTestCase(String name) {
-        super(name);
-    }
+public final class EnumerationConverterTestCase {
 
+    @Test
     public void testEnum() {
         Converter converter = EnumerationConverter.getInstance();
 
         Thread.State expected = Thread.State.TERMINATED;
-        Thread.State actual = (Thread.State) converter.convert(Thread.State.class,
-                Thread.State.TERMINATED.name());
+        Thread.State actual = (Thread.State) converter.convert(Thread.State.class, Thread.State.TERMINATED.name());
         assertEquals(expected, actual);
     }
 
-    public static Test suite() {
-        return new TestSuite(EnumerationConverterTestCase.class);
-    }
-
 }

Modified: bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/PathImplTest.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/PathImplTest.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/PathImplTest.java (original)
+++ bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/PathImplTest.java Wed Oct 19 20:36:26 2016
@@ -18,13 +18,17 @@
  */
 package org.apache.bval.jsr.util;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Iterator;
 
 import javax.validation.Path;
 import javax.validation.ValidationException;
-import java.util.Iterator;
+
+import org.junit.Test;
 
 /**
  * PathImpl Tester.
@@ -32,11 +36,8 @@ import java.util.Iterator;
  * @version 1.0
  * @since <pre>10/01/2009</pre>
  */
-public class PathImplTest extends TestCase {
-    public PathImplTest(String name) {
-        super(name);
-    }
-
+public class PathImplTest {
+    @Test
     public void testParsing() {
         String property = "order[3].deliveryAddress.addressline[1]";
         Path path = PathImpl.createPathFromString(property);
@@ -70,6 +71,7 @@ public class PathImplTest extends TestCa
         assertFalse(propIter.hasNext());
     }
 
+    @Test
     public void testParseMapBasedProperty() {
         String property = "order[foo].deliveryAddress";
         Path path = PathImpl.createPathFromString(property);
@@ -90,6 +92,7 @@ public class PathImplTest extends TestCa
     }
 
     //some of the examples from the 1.0 bean validation spec, section 4.2
+    @Test
     public void testSpecExamples() {
         String fourthAuthor = "authors[3]";
         Path path = PathImpl.createPathFromString(fourthAuthor);
@@ -124,6 +127,7 @@ public class PathImplTest extends TestCa
         assertFalse(propIter.hasNext());
     }
 
+    @Test
     public void testNull() {
         assertEquals(PathImpl.createPathFromString(null), PathImpl.create());
 
@@ -133,43 +137,33 @@ public class PathImplTest extends TestCa
         assertEquals(null, node.getName());
     }
 
+    @Test(expected = ValidationException.class)
     public void testUnbalancedBraces() {
-        try {
-            PathImpl.createPathFromString("foo[.bar");
-            fail();
-        } catch (ValidationException ex) {
-        }
+        PathImpl.createPathFromString("foo[.bar");
     }
 
+    @Test(expected = ValidationException.class)
     public void testIndexInMiddleOfProperty() {
-        try {
-            PathImpl.createPathFromString("f[1]oo.bar");
-            fail();
-        } catch (ValidationException ex) {
-        }
+        PathImpl.createPathFromString("f[1]oo.bar");
     }
 
+    @Test(expected = ValidationException.class)
     public void testTrailingPathSeparator() {
-        try {
-            PathImpl.createPathFromString("foo.bar.");
-            fail();
-        } catch (ValidationException ex) {
-        }
+        PathImpl.createPathFromString("foo.bar.");
     }
 
+    @Test(expected = ValidationException.class)
     public void testLeadingPathSeparator() {
-        try {
-            PathImpl.createPathFromString(".foo.bar");
-            fail();
-        } catch (ValidationException ex) {
-        }
+        PathImpl.createPathFromString(".foo.bar");
     }
 
+    @Test
     public void testEmptyString() {
         Path path = PathImpl.createPathFromString("");
         assertEquals(null, path.iterator().next().getName());
     }
 
+    @Test
     public void testToString() {
         PathImpl path = PathImpl.create();
         path.addNode(new NodeImpl("firstName"));
@@ -182,6 +176,7 @@ public class PathImplTest extends TestCa
         assertEquals("[2].firstName", path.toString());
     }
 
+    @Test
     public void testAddRemoveNodes() {
         PathImpl path = PathImpl.createPathFromString("");
         assertTrue(path.isRootPath());
@@ -203,7 +198,4 @@ public class PathImplTest extends TestCa
         return result;
     }
 
-    public static Test suite() {
-        return new TestSuite(PathImplTest.class);
-    }
 }

Modified: bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/TestUtils.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/TestUtils.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/TestUtils.java (original)
+++ bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/util/TestUtils.java Wed Oct 19 20:36:26 2016
@@ -18,15 +18,18 @@
  */
 package org.apache.bval.jsr.util;
 
-import junit.framework.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
 
-import javax.validation.ConstraintViolation;
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.metadata.ElementDescriptor.ConstraintFinder;
 import java.lang.annotation.Annotation;
 import java.util.Collection;
 import java.util.Set;
 
+import javax.validation.ConstraintViolation;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.metadata.ElementDescriptor.ConstraintFinder;
+
 /**
  * Description: <br/>
  */
@@ -40,8 +43,9 @@ public class TestUtils {
      */
     public static <T> ConstraintViolation<T> getViolation(Set<ConstraintViolation<T>> violations, String propertyPath) {
         for (ConstraintViolation<T> each : violations) {
-            if (each.getPropertyPath().toString().equals(propertyPath))
+            if (each.getPropertyPath().toString().equals(propertyPath)) {
                 return each;
+            }
         }
         return null;
     }
@@ -70,8 +74,9 @@ public class TestUtils {
     public static <T> ConstraintViolation<T> getViolationWithMessage(Set<ConstraintViolation<T>> violations,
         String message) {
         for (ConstraintViolation<T> each : violations) {
-            if (each.getMessage().equals(message))
+            if (each.getMessage().equals(message)) {
                 return each;
+            }
         }
         return null;
     }
@@ -86,12 +91,11 @@ public class TestUtils {
     public static void failOnModifiable(Collection<?> collection, String description) {
         int size = collection.size();
         try {
-            Assert
-                .assertFalse(String.format("should not permit modification to %s", description), collection.add(null));
+            assertFalse(String.format("should not permit modification to %s", description), collection.add(null));
         } catch (Exception e) {
             // okay
         }
-        Assert.assertEquals("constraint descriptor set size changed", size, collection.size());
+        assertEquals("constraint descriptor set size changed", size, collection.size());
     }
 
     /**
@@ -106,7 +110,7 @@ public class TestUtils {
                     continue outer;
                 }
             }
-            Assert.fail(String.format("Missing expected constraint descriptor of type %s", type));
+            fail(String.format("Missing expected constraint descriptor of type %s", type));
         }
     }
 }

Modified: bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/xml/ValidationParserTest.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/xml/ValidationParserTest.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/xml/ValidationParserTest.java (original)
+++ bval/trunk/bval-jsr/src/test/java/org/apache/bval/jsr/xml/ValidationParserTest.java Wed Oct 19 20:36:26 2016
@@ -18,17 +18,16 @@
  */
 package org.apache.bval.jsr.xml;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
 
-import org.apache.bval.jsr.ApacheValidationProvider;
-import org.apache.bval.jsr.ApacheValidatorConfiguration;
-import org.apache.bval.jsr.ConfigurationImpl;
-import org.apache.bval.jsr.example.XmlEntitySampleBean;
-import org.apache.bval.jsr.resolver.SimpleTraversableResolver;
-import org.apache.bval.util.reflection.Reflection;
-import org.junit.Assume;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
 
 import javax.validation.ConstraintViolation;
 import javax.validation.Validation;
@@ -36,10 +35,15 @@ import javax.validation.ValidationExcept
 import javax.validation.Validator;
 import javax.validation.ValidatorFactory;
 
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Set;
+import org.apache.bval.jsr.ApacheValidationProvider;
+import org.apache.bval.jsr.ApacheValidatorConfiguration;
+import org.apache.bval.jsr.ConfigurationImpl;
+import org.apache.bval.jsr.example.XmlEntitySampleBean;
+import org.apache.bval.jsr.resolver.SimpleTraversableResolver;
+import org.apache.bval.util.reflection.Reflection;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
 /**
  * ValidationParser Tester.
@@ -48,43 +52,43 @@ import java.util.Set;
  * @version 1.0
  * @since <pre>11/25/2009</pre>
  */
-public class ValidationParserTest extends TestCase
-      implements ApacheValidatorConfiguration.Properties {
-    public ValidationParserTest(String name) {
-        super(name);
-    }
+public class ValidationParserTest implements ApacheValidatorConfiguration.Properties {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
 
+    @Test
     public void testGetInputStream() throws IOException {
         assertNotNull(ValidationParser.getInputStream("sample-validation.xml"));
 
         // make sure there are duplicate resources on the classpath before the next checks:
         final Enumeration<URL> resources = Reflection.getClassLoader(ValidationParser.class).getResources("META-INF/MANIFEST.MF");
-        
-        Assume.assumeTrue(resources.hasMoreElements());
+
+        assumeTrue(resources.hasMoreElements());
         resources.nextElement();
-        Assume.assumeTrue(resources.hasMoreElements());
+        assumeTrue(resources.hasMoreElements());
+    }
 
-        try {
-            ValidationParser.getInputStream("META-INF/MANIFEST.MF"); // this is available in multiple jars hopefully
-            fail("exception not thrown");
-        } catch(ValidationException vex) {
-            assertTrue(vex.getMessage().startsWith("More than "));
-        }
+    @Test
+    public void testGetNonUniqueInputStream() throws IOException {
+        thrown.expect(ValidationException.class);
+        thrown.expectMessage("More than ");
+        ValidationParser.getInputStream("META-INF/MANIFEST.MF"); // this is available in multiple jars hopefully
     }
 
+    @Test
     public void testParse() {
         ConfigurationImpl config = new ConfigurationImpl(null, new ApacheValidationProvider());
         ValidationParser.processValidationConfig("sample-validation.xml", config, false);
     }
 
+    @Test
     public void testConfigureFromXml() {
         ValidatorFactory factory = getFactory();
-        assertTrue(factory.getMessageInterpolator() instanceof TestMessageInterpolator);
-        assertTrue(factory
-              .getConstraintValidatorFactory() instanceof TestConstraintValidatorFactory);
-        assertTrue(factory.getTraversableResolver() instanceof SimpleTraversableResolver);
-        Validator validator = factory.getValidator();
-        assertNotNull(validator);
+        assertThat(factory.getMessageInterpolator(), instanceOf(TestMessageInterpolator.class));
+        assertThat(factory.getConstraintValidatorFactory(), instanceOf(TestConstraintValidatorFactory.class));
+        assertThat(factory.getTraversableResolver(), instanceOf(SimpleTraversableResolver.class));
+        assertNotNull(factory.getValidator());
     }
 
     private ValidatorFactory getFactory() {
@@ -94,6 +98,7 @@ public class ValidationParserTest extend
         return config.buildValidatorFactory();
     }
 
+    @Test
     public void testXmlEntitySample() {
         XmlEntitySampleBean bean = new XmlEntitySampleBean();
         bean.setFirstName("tooooooooooooooooooooooooooo long");
@@ -110,7 +115,4 @@ public class ValidationParserTest extend
         assertTrue(results.isEmpty());
     }
 
-    public static Test suite() {
-        return new TestSuite(ValidationParserTest.class);
-    }
 }

Modified: bval/trunk/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java (original)
+++ bval/trunk/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java Wed Oct 19 20:36:26 2016
@@ -16,9 +16,13 @@
  */
 package org.apache.bval.routines;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 import org.apache.bval.BeanValidationContext;
 import org.apache.bval.model.Features;
 import org.apache.bval.model.Features.Property;
@@ -26,16 +30,13 @@ import org.apache.bval.model.MetaPropert
 import org.apache.bval.model.ValidationContext;
 import org.apache.bval.model.ValidationListener;
 import org.apache.bval.xml.XMLMetaValue;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * StandardValidation Tester.
  */
-public class StandardValidationTest extends TestCase implements ValidationListener {
+public class StandardValidationTest implements ValidationListener {
     private StandardValidation validation;
     private BeanValidationContext<StandardValidationTest> context;
     private List<String> reasons = new ArrayList<String>();
@@ -44,13 +45,8 @@ public class StandardValidationTest exte
     private Date dateValue;
     private int intValue;
 
-    public StandardValidationTest(String name) {
-        super(name);
-    }
-
-    @Override
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
         validation = new StandardValidation();
         context = new BeanValidationContext<StandardValidationTest>(this);
         metaProperty = new MetaProperty();
@@ -58,15 +54,11 @@ public class StandardValidationTest exte
         context.setMetaProperty(metaProperty);
     }
 
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     public String getStringValue() {
         return stringValue;
     }
 
+    @Test
     public void testValidateMandatory() {
         metaProperty.setName("stringValue");
 
@@ -102,6 +94,7 @@ public class StandardValidationTest exte
         assertTrue(reasons.contains(Property.MAX_LENGTH));
     }
 
+    @Test
     public void testValidateMinLength() {
         metaProperty.setName("stringValue");
         metaProperty.putFeature(Features.Property.MIN_LENGTH, 5);
@@ -114,6 +107,7 @@ public class StandardValidationTest exte
         assertTrue(reasons.contains(Property.MIN_LENGTH));
     }
 
+    @Test
     public void testValidateMaxValue() {
         metaProperty.setName("stringValue");
         metaProperty.putFeature(Features.Property.MAX_VALUE, "9999");
@@ -126,6 +120,7 @@ public class StandardValidationTest exte
         assertTrue(reasons.contains(Property.MAX_VALUE));
     }
 
+    @Test
     public void testValidateMinValue() {
         metaProperty.setName("stringValue");
         metaProperty.putFeature(Features.Property.MIN_VALUE, "5555");
@@ -142,6 +137,7 @@ public class StandardValidationTest exte
         return intValue;
     }
 
+    @Test
     public void testValidateMinValue_MixedNumber() {
         metaProperty.setName("intValue");
         metaProperty.putFeature(Features.Property.MIN_VALUE, new Long(0));
@@ -154,6 +150,7 @@ public class StandardValidationTest exte
         assertTrue(reasons.contains(Property.MIN_VALUE));
     }
 
+    @Test
     public void testValidateMinValue_Date_Timestamp() {
         metaProperty.setName("dateValue");
         Date dt = new Date();
@@ -167,6 +164,7 @@ public class StandardValidationTest exte
         assertTrue(reasons.contains(Property.MIN_VALUE));
     }
 
+    @Test
     public void testValidateMaxValue_AlphabeticString() {
         metaProperty.setName("stringValue");
         metaProperty.putFeature(Features.Property.MAX_VALUE, "BBBB");
@@ -179,6 +177,7 @@ public class StandardValidationTest exte
         assertTrue(reasons.contains(Property.MAX_VALUE));
     }
 
+    @Test
     public void testValidateRegExp() {
         // regexp for Zip
         String regexp = "[a-zA-Z\\- \\d]*";
@@ -197,6 +196,7 @@ public class StandardValidationTest exte
         return dateValue;
     }
 
+    @Test
     public void testValidateTimeLag() {
         metaProperty.setName("dateValue");
         metaProperty.putFeature(Features.Property.TIME_LAG, XMLMetaValue.TIMELAG_Past);
@@ -211,10 +211,6 @@ public class StandardValidationTest exte
 
     }
 
-    public static Test suite() {
-        return new TestSuite(StandardValidationTest.class);
-    }
-
     @Override
     public <T extends ValidationListener> void addError(String reason, ValidationContext<T> context) {
         reasons.add(reason);

Modified: bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java (original)
+++ bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java Wed Oct 19 20:36:26 2016
@@ -16,9 +16,13 @@
  */
 package org.apache.bval.xml;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
 import org.apache.bval.BeanValidator;
 import org.apache.bval.MetaBeanFinder;
 import org.apache.bval.ValidationResults;
@@ -27,29 +31,14 @@ import org.apache.bval.example.BusinessO
 import org.apache.bval.model.Features;
 import org.apache.bval.model.Features.Property;
 import org.apache.bval.model.MetaBean;
-import org.apache.bval.routines.Reasons;
-
-import java.util.ArrayList;
-import java.util.HashMap;
+import org.junit.Test;
 
 /**
  * BeanValidator Tester.
  */
-public class BeanValidatorTest extends TestCase {
-    public BeanValidatorTest(String name) {
-        super(name);
-    }
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
+public class BeanValidatorTest {
 
+    @Test
     public void testValidateMapAsBean() {
         XMLMetaBeanManagerFactory.getRegistry().addLoader(new XMLMetaBeanURLLoader(
               BusinessObject.class.getResource("test-beanInfos.xml")));
@@ -77,6 +66,7 @@ public class BeanValidatorTest extends T
         assertTrue(results.isEmpty());
     }
 
+    @Test
     public void testValidate() {
         MetaBeanFinder finder = XMLMetaBeanManagerFactory.getFinder();
         XMLMetaBeanManagerFactory.getRegistry().addLoader(new XMLMetaBeanURLLoader(
@@ -118,7 +108,4 @@ public class BeanValidatorTest extends T
               validator.validate(object, info).isEmpty()); // cardinality error found
     }
 
-    public static Test suite() {
-        return new TestSuite(BeanValidatorTest.class);
-    }
 }

Modified: bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java (original)
+++ bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java Wed Oct 19 20:36:26 2016
@@ -16,36 +16,23 @@
  */
 package org.apache.bval.xml;
 
-import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.bval.example.BusinessObject;
-import org.apache.bval.example.BusinessObjectAddress;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.bval.example.BusinessObject;
+import org.apache.bval.example.BusinessObjectAddress;
+import org.junit.Test;
+
 /**
  * XMLMetaBean Tester.
  */
-public class XMLMetaBeanInfosTest extends TestCase {
-
-    public XMLMetaBeanInfosTest(String name) {
-        super(name);
-    }
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
+public class XMLMetaBeanInfosTest {
 
+    @Test
     public void testBeanInfosToXML() {
         XMLMetaBeanInfos infos = new XMLMetaBeanInfos();
         infos.setBeans(new ArrayList<XMLMetaBean>());
@@ -133,19 +120,17 @@ public class XMLMetaBeanInfosTest extend
         relation.setName("address");
         relation.setBeanId("Address");
         relation.setMandatory(XMLMetaValue.OPTIONAL);
-//        relation.setDisplayName("UserAddress");
         bean.putBeanRef(relation);
 
         infos.getBeans().add(bean2);
 
         String xml = XMLMapper.getInstance().getXStream().toXML(infos);
-//        System.out.println(xml);
         XMLMetaBeanInfos infos2 =
               (XMLMetaBeanInfos) XMLMapper.getInstance().getXStream().fromXML(xml);
         assertEquals(2, infos2.getBeans().size());
     }
 
-
+    @Test
     public void testMaxValueParsing() {
         String xml = "\n" +
               "<beanInfos>  <bean id=\"org.apache.bval.test.model.Profile\">\n" +
@@ -154,14 +139,11 @@ public class XMLMetaBeanInfosTest extend
               "  </bean></beanInfos>";
         XMLMetaBeanInfos beanInfos = (XMLMetaBeanInfos) XMLMapper.getInstance()
               .getXStream().fromXML(xml);
-        Assert.assertNotNull(beanInfos);
+        assertNotNull(beanInfos);
         assertEquals(Integer.valueOf(31),
               beanInfos.getBeans().get(0).getProperty("activationDay").getMaxValue());
         assertEquals(Integer.valueOf(1),
               beanInfos.getBeans().get(0).getProperty("activationDay").getMinValue());
     }
 
-    public static Test suite() {
-        return new TestSuite(XMLMetaBeanInfosTest.class);
-    }
 }

Modified: bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java?rev=1765712&r1=1765711&r2=1765712&view=diff
==============================================================================
--- bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java (original)
+++ bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java Wed Oct 19 20:36:26 2016
@@ -16,14 +16,18 @@
  */
 package org.apache.bval.xml;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Map;
+
 import org.apache.bval.MetaBeanFinder;
 import org.apache.bval.example.BusinessObject;
 import org.apache.bval.model.MetaBean;
-
-import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Description: <br>
@@ -31,24 +35,15 @@ import java.util.Map;
  * Date: 17.06.2010<br>
  * Time: 10:28:48<br>
  */
-public class XMLMetaBeanManagerTest extends TestCase {
+public class XMLMetaBeanManagerTest {
     XMLMetaBeanManager mbm = new XMLMetaBeanManager();
 
-    public XMLMetaBeanManagerTest(String name) {
-        super(name);
-    }
-
-    @Override
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
         mbm.addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos.xml")));
     }
 
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
+    @Test
     public void testEnrichCopies() throws Exception {
         Map<String, MetaBean> copies =
             mbm.enrichCopies(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos-custom.xml"))
@@ -60,6 +55,7 @@ public class XMLMetaBeanManagerTest exte
         assertTrue(mb2.getProperty("lastName").isMandatory());
     }
 
+    @Test
     public void testCopy() {
         MetaBean mb = mbm.findForClass(BusinessObject.class);
         MetaBean mb2 = mb.copy();
@@ -68,6 +64,7 @@ public class XMLMetaBeanManagerTest exte
     }
 
     @SuppressWarnings("deprecation")
+    @Test
     public void testFindForClass() throws Exception {
         MetaBeanFinder finder = mbm;
         MetaBean info = finder.findForClass(BusinessObject.class);
@@ -77,6 +74,7 @@ public class XMLMetaBeanManagerTest exte
         assertTrue(info.getProperty("email").getJavaScriptValidations().length > 0);
     }
 
+    @Test
     public void testFindAll() {
         Map<String, MetaBean> all = mbm.findAll();
         assertNotNull(all);
@@ -89,7 +87,4 @@ public class XMLMetaBeanManagerTest exte
         assertTrue(bean == bean.getProperty("addresses").getMetaBean().getProperty("owner").getMetaBean());
     }
 
-    public static Test suite() {
-        return new TestSuite(XMLMetaBeanManagerTest.class);
-    }
 }