This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git


The following commit(s) were added to refs/heads/master by this push:
     new b8b149c5 Don't hide stack traces from JUnit!
b8b149c5 is described below

commit b8b149c5e555870dcae6cc3a807827b9fb92606b
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Sep 2 10:57:40 2024 -0400

    Don't hide stack traces from JUnit!
    
    - Use assertThrows()
    - Use more precise exceptions than Exception
    - Add missing @Test
    - Reduce whitespace
    - Remove Java 1.4 test code
---
 .../commons/beanutils2/BeanComparatorTestCase.java |  21 +--
 .../BeanPropertyValueChangeConsumerTestCase.java   |  64 +------
 .../commons/beanutils2/BeanUtilsBean2TestCase.java |  79 +++------
 .../commons/beanutils2/BeanUtilsBeanTestCase.java  |  18 +-
 .../commons/beanutils2/BeanificationTestCase.java  |  24 +--
 .../commons/beanutils2/LazyDynaListTestCase.java   |  13 +-
 .../commons/beanutils2/PropertyUtilsTestCase.java  |   8 +-
 .../commons/beanutils2/bugs/Jira349TestCase.java   |  14 +-
 .../commons/beanutils2/bugs/Jira357TestCase.java   |  11 +-
 .../commons/beanutils2/bugs/Jira358TestCase.java   |  16 +-
 .../commons/beanutils2/bugs/Jira369TestCase.java   |  24 +--
 .../commons/beanutils2/bugs/Jira463TestCase.java   |   9 +-
 .../commons/beanutils2/bugs/Jira465TestCase.java   |  20 +--
 .../commons/beanutils2/bugs/Jira520TestCase.java   |  12 +-
 .../commons/beanutils2/bugs/Jira87TestCase.java    |  12 +-
 .../converters/ArrayConverterTestCase.java         | 183 ++++++---------------
 .../converters/BooleanConverterTestCase.java       |  30 +---
 .../converters/CharacterConverterTestCase.java     |  22 +--
 .../converters/ClassConverterTestCase.java         |  47 +-----
 .../converters/DurationConverterTestCase.java      |   9 +-
 .../converters/EnumConverterTestCase.java          |   9 +-
 .../converters/FileConverterTestCase.java          |   9 +-
 .../converters/LocalTimeConverterTestCase.java     |   9 +-
 .../converters/MonthDayConverterTestCase.java      |   9 +-
 .../converters/OffsetTimeConverterTestCase.java    |   9 +-
 .../converters/PathConverterTestCase.java          |   9 +-
 .../converters/PeriodConverterTestCase.java        |   9 +-
 .../converters/URIConverterTestCase.java           |   9 +-
 .../converters/UUIDConverterTestCase.java          |   9 +-
 .../converters/YearConverterTestCase.java          |   9 +-
 .../converters/YearMonthConverterTestCase.java     |   9 +-
 .../converters/ZoneIdConverterTestCase.java        |   9 +-
 .../converters/ZoneOffsetConverterTestCase.java    |   9 +-
 .../expression/DefaultResolverTestCase.java        | 178 +++++---------------
 .../beanutils2/locale/LocaleBeanUtilsTestCase.java |  19 +--
 .../locale/LocaleBeanificationTestCase.java        |  61 +++----
 .../locale/LocaleConvertUtilsTestCase.java         | 177 ++++++--------------
 .../beanutils2/sql/DynaResultSetTestCase.java      |  53 ++----
 .../commons/beanutils2/sql/DynaRowSetTestCase.java |  50 ++----
 39 files changed, 320 insertions(+), 971 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/beanutils2/BeanComparatorTestCase.java 
b/src/test/java/org/apache/commons/beanutils2/BeanComparatorTestCase.java
index 99ca159c..0d334b3b 100644
--- a/src/test/java/org/apache/commons/beanutils2/BeanComparatorTestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/BeanComparatorTestCase.java
@@ -18,8 +18,8 @@
 package org.apache.commons.beanutils2;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
@@ -109,13 +109,9 @@ public class BeanComparatorTestCase {
      */
     @Test
     public void testCompareOnMissingProperty() {
-        try {
-            final BeanComparator<AlphaBean, String> beanComparator = new 
BeanComparator<>("bogusName");
-            beanComparator.compare(alphaBean2, alphaBean1);
-            fail("should not be able to compare");
-        } catch (final Exception e) {
-            assertTrue(e.toString().contains("Unknown property"), () -> "Wrong 
exception was thrown: " + e);
-        }
+        final BeanComparator<AlphaBean, String> beanComparator = new 
BeanComparator<>("bogusName");
+        Exception e = assertThrows(RuntimeException.class, () -> 
beanComparator.compare(alphaBean2, alphaBean1));
+        assertTrue(e.toString().contains("Unknown property"), () -> "Wrong 
exception was thrown: " + e);
     }
 
     /**
@@ -123,13 +119,8 @@ public class BeanComparatorTestCase {
      */
     @Test
     public void testCompareWithNulls() {
-        try {
-            final BeanComparator<AlphaBean, String> beanComparator = new 
BeanComparator<>("name");
-            beanComparator.compare(alphaBean2, null);
-            fail("Should not be able to compare a null value.");
-        } catch (final Exception e) {
-            // expected result
-        }
+        final BeanComparator<AlphaBean, String> beanComparator = new 
BeanComparator<>("name");
+        assertThrows(NullPointerException.class, () -> 
beanComparator.compare(alphaBean2, null));
     }
 
     /**
diff --git 
a/src/test/java/org/apache/commons/beanutils2/BeanPropertyValueChangeConsumerTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/BeanPropertyValueChangeConsumerTestCase.java
index c932a6d1..20a8cc70 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/BeanPropertyValueChangeConsumerTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/BeanPropertyValueChangeConsumerTestCase.java
@@ -20,7 +20,6 @@ package org.apache.commons.beanutils2;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertSame;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import org.junit.jupiter.api.Test;
 
@@ -78,12 +77,7 @@ public class BeanPropertyValueChangeConsumerTestCase {
      */
     @Test
     public void testExecuteWithNullInPropertyPath() {
-        try {
-            new 
BeanPropertyValueChangeConsumer<>("anotherNested.stringProperty", 
"foo").accept(new TestBean());
-            fail("Should have thrown an IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            /* this is what we expect */
-        }
+        assertThrows(IllegalArgumentException.class, () -> new 
BeanPropertyValueChangeConsumer<>("anotherNested.stringProperty", 
"foo").accept(new TestBean()));
     }
 
     /**
@@ -96,12 +90,7 @@ public class BeanPropertyValueChangeConsumerTestCase {
         // create a consumer that will attempt to set a property on the null 
bean in the path
         final BeanPropertyValueChangeConsumer<TestBean, Object> consumer = new 
BeanPropertyValueChangeConsumer<>("anotherNested.stringProperty",
                 "Should ignore exception", true);
-
-        try {
-            consumer.accept(testBean);
-        } catch (final IllegalArgumentException e) {
-            fail("Should have ignored the exception.");
-        }
+        consumer.accept(testBean);
     }
 
     /**
@@ -109,12 +98,7 @@ public class BeanPropertyValueChangeConsumerTestCase {
      */
     @Test
     public void testExecuteWithReadOnlyProperty() {
-        try {
-            new BeanPropertyValueChangeConsumer<>("readOnlyProperty", 
"foo").accept(new TestBean());
-            fail("Should have thrown an IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            /* this is what we expect */
-        }
+        assertThrows(IllegalArgumentException.class, () -> new 
BeanPropertyValueChangeConsumer<>("readOnlyProperty", "foo").accept(new 
TestBean()));
     }
 
     /**
@@ -132,12 +116,7 @@ public class BeanPropertyValueChangeConsumerTestCase {
      */
     @Test
     public void testExecuteWithSimpleBooleanPropertyAndStringValue() {
-        try {
-            new BeanPropertyValueChangeConsumer<>("booleanProperty", 
"true").accept(new TestBean());
-            fail("Should have thrown an IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            /* this is what we expect */
-        }
+        assertThrows(IllegalArgumentException.class, () -> new 
BeanPropertyValueChangeConsumer<>("booleanProperty", "true").accept(new 
TestBean()));
     }
 
     /**
@@ -193,12 +172,7 @@ public class BeanPropertyValueChangeConsumerTestCase {
      */
     @Test
     public void testExecuteWithSimpleDoublePropertyAndStringValue() {
-        try {
-            new BeanPropertyValueChangeConsumer<>("doubleProperty", 
"123").accept(new TestBean());
-            fail("Should have thrown an IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            /* this is what we expect */
-        }
+        assertThrows(IllegalArgumentException.class, () -> new 
BeanPropertyValueChangeConsumer<>("doubleProperty", "123").accept(new 
TestBean()));
     }
 
     /**
@@ -206,12 +180,7 @@ public class BeanPropertyValueChangeConsumerTestCase {
      */
     @Test
     public void testExecuteWithSimpleFloatPropertyAndDoubleValue() {
-        try {
-            new BeanPropertyValueChangeConsumer<>("floatProperty", 
expectedDoubleValue).accept(new TestBean());
-            fail("Should have thrown an IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            /* this is what we expect */
-        }
+        assertThrows(IllegalArgumentException.class, () -> new 
BeanPropertyValueChangeConsumer<>("floatProperty", 
expectedDoubleValue).accept(new TestBean()));
     }
 
     /**
@@ -239,12 +208,7 @@ public class BeanPropertyValueChangeConsumerTestCase {
      */
     @Test
     public void testExecuteWithSimpleFloatPropertyAndStringValue() {
-        try {
-            new BeanPropertyValueChangeConsumer<>("floatProperty", 
"123").accept(new TestBean());
-            fail("Should have thrown an IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            /* this is what we expect */
-        }
+        assertThrows(IllegalArgumentException.class, () -> new 
BeanPropertyValueChangeConsumer<>("floatProperty", "123").accept(new 
TestBean()));
     }
 
     /**
@@ -252,12 +216,7 @@ public class BeanPropertyValueChangeConsumerTestCase {
      */
     @Test
     public void testExecuteWithSimpleIntPropertyAndDoubleValue() {
-        try {
-            new BeanPropertyValueChangeConsumer<>("intProperty", 
expectedDoubleValue).accept(new TestBean());
-            fail("Should have thrown an IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            /* this is what we expect */
-        }
+        assertThrows(IllegalArgumentException.class, () -> new 
BeanPropertyValueChangeConsumer<>("intProperty", 
expectedDoubleValue).accept(new TestBean()));
     }
 
     /**
@@ -265,12 +224,7 @@ public class BeanPropertyValueChangeConsumerTestCase {
      */
     @Test
     public void testExecuteWithSimpleIntPropertyAndFloatValue() {
-        try {
-            new BeanPropertyValueChangeConsumer<>("intProperty", 
expectedFloatValue).accept(new TestBean());
-            fail("Should have thrown an IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            /* this is what we expect */
-        }
+        assertThrows(IllegalArgumentException.class, () -> new 
BeanPropertyValueChangeConsumer<>("intProperty", expectedFloatValue).accept(new 
TestBean()));
     }
 
     /**
diff --git 
a/src/test/java/org/apache/commons/beanutils2/BeanUtilsBean2TestCase.java 
b/src/test/java/org/apache/commons/beanutils2/BeanUtilsBean2TestCase.java
index dff26b7c..7c559b20 100644
--- a/src/test/java/org/apache/commons/beanutils2/BeanUtilsBean2TestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/BeanUtilsBean2TestCase.java
@@ -17,7 +17,6 @@
 package org.apache.commons.beanutils2;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
@@ -63,13 +62,9 @@ public class BeanUtilsBean2TestCase extends 
BeanUtilsBeanTestCase {
      */
     @Override
     @Test
-    public void testCopyPropertyConvertToStringArray() {
-        try {
-            bean.setStringArray(null);
-            BeanUtils.copyProperty(bean, "stringArray", new java.util.Date[] { 
testUtilDate });
-        } catch (final Throwable t) {
-            fail("Threw " + t);
-        }
+    public void testCopyPropertyConvertToStringArray() throws Exception {
+        bean.setStringArray(null);
+        BeanUtils.copyProperty(bean, "stringArray", new java.util.Date[] { 
testUtilDate });
         assertEquals(1, bean.getStringArray().length, "java.util.Date[] --> 
String[] length");
         assertEquals(testStringDate, bean.getStringArray()[0], 
"java.util.Date[] --> String[] value ");
     }
@@ -79,13 +74,9 @@ public class BeanUtilsBean2TestCase extends 
BeanUtilsBeanTestCase {
      */
     @Override
     @Test
-    public void testCopyPropertyConvertToStringIndexed() {
-        try {
-            bean.setStringArray(new String[1]);
-            BeanUtils.copyProperty(bean, "stringArray[0]", testUtilDate);
-        } catch (final Throwable t) {
-            fail("Threw " + t);
-        }
+    public void testCopyPropertyConvertToStringIndexed() throws Exception {
+        bean.setStringArray(new String[1]);
+        BeanUtils.copyProperty(bean, "stringArray[0]", testUtilDate);
         assertEquals(1, bean.getStringArray().length, "java.util.Date[] --> 
String[] length");
         assertEquals(testStringDate, bean.getStringArray()[0], 
"java.util.Date[] --> String[] value ");
     }
@@ -95,14 +86,10 @@ public class BeanUtilsBean2TestCase extends 
BeanUtilsBeanTestCase {
      */
     @Override
     @Test
-    public void testGetArrayPropertyDate() {
+    public void testGetArrayPropertyDate() throws Exception {
         String[] value = null;
-        try {
-            bean.setDateArrayProperty(new java.util.Date[] { testUtilDate });
-            value = BeanUtils.getArrayProperty(bean, "dateArrayProperty");
-        } catch (final Throwable t) {
-            fail("Threw " + t);
-        }
+        bean.setDateArrayProperty(new java.util.Date[] { testUtilDate });
+        value = BeanUtils.getArrayProperty(bean, "dateArrayProperty");
         assertEquals(1, value.length, "java.util.Date[] --> String[] length");
         assertEquals(testStringDate, value[0], "java.util.Date[] --> String[] 
value ");
     }
@@ -112,14 +99,10 @@ public class BeanUtilsBean2TestCase extends 
BeanUtilsBeanTestCase {
      */
     @Override
     @Test
-    public void testGetIndexedPropertyDate() {
+    public void testGetIndexedPropertyDate() throws Exception {
         String value = null;
-        try {
-            bean.setDateArrayProperty(new java.util.Date[] { testUtilDate });
-            value = BeanUtils.getIndexedProperty(bean, "dateArrayProperty[0]");
-        } catch (final Throwable t) {
-            fail("Threw " + t);
-        }
+        bean.setDateArrayProperty(new java.util.Date[] { testUtilDate });
+        value = BeanUtils.getIndexedProperty(bean, "dateArrayProperty[0]");
         assertEquals(testStringDate, value, "java.util.Date[0] --> String");
     }
 
@@ -128,14 +111,10 @@ public class BeanUtilsBean2TestCase extends 
BeanUtilsBeanTestCase {
      */
     @Override
     @Test
-    public void testGetSimplePropertyDate() {
+    public void testGetSimplePropertyDate() throws Exception {
         String value = null;
-        try {
-            bean.setDateProperty(testUtilDate);
-            value = BeanUtils.getSimpleProperty(bean, "dateProperty");
-        } catch (final Throwable t) {
-            fail("Threw " + t);
-        }
+        bean.setDateProperty(testUtilDate);
+        value = BeanUtils.getSimpleProperty(bean, "dateProperty");
         assertEquals(testStringDate, value, "java.util.Date --> String");
     }
 
@@ -144,12 +123,8 @@ public class BeanUtilsBean2TestCase extends 
BeanUtilsBeanTestCase {
      */
     @Override
     @Test
-    public void testSetPropertyConvertToString() {
-        try {
-            BeanUtils.setProperty(bean, "stringProperty", testUtilDate);
-        } catch (final Throwable t) {
-            fail("Threw " + t);
-        }
+    public void testSetPropertyConvertToString() throws Exception {
+        BeanUtils.setProperty(bean, "stringProperty", testUtilDate);
         assertEquals(testStringDate, bean.getStringProperty(), "java.util.Date 
--> String");
     }
 
@@ -158,13 +133,9 @@ public class BeanUtilsBean2TestCase extends 
BeanUtilsBeanTestCase {
      */
     @Override
     @Test
-    public void testSetPropertyConvertToStringArray() {
-        try {
-            bean.setStringArray(null);
-            BeanUtils.setProperty(bean, "stringArray", new java.util.Date[] { 
testUtilDate });
-        } catch (final Throwable t) {
-            fail("Threw " + t);
-        }
+    public void testSetPropertyConvertToStringArray() throws Exception {
+        bean.setStringArray(null);
+        BeanUtils.setProperty(bean, "stringArray", new java.util.Date[] { 
testUtilDate });
         assertEquals(1, bean.getStringArray().length, "java.util.Date[] --> 
String[] length");
         assertEquals(testStringDate, bean.getStringArray()[0], 
"java.util.Date[] --> String[] value ");
     }
@@ -174,13 +145,9 @@ public class BeanUtilsBean2TestCase extends 
BeanUtilsBeanTestCase {
      */
     @Override
     @Test
-    public void testSetPropertyConvertToStringIndexed() {
-        try {
-            bean.setStringArray(new String[1]);
-            BeanUtils.setProperty(bean, "stringArray[0]", testUtilDate);
-        } catch (final Throwable t) {
-            fail("Threw " + t);
-        }
+    public void testSetPropertyConvertToStringIndexed() throws Exception {
+        bean.setStringArray(new String[1]);
+        BeanUtils.setProperty(bean, "stringArray[0]", testUtilDate);
         assertEquals(testStringDate, bean.getStringArray()[0], "java.util.Date 
--> String[]");
     }
 
diff --git 
a/src/test/java/org/apache/commons/beanutils2/BeanUtilsBeanTestCase.java 
b/src/test/java/org/apache/commons/beanutils2/BeanUtilsBeanTestCase.java
index 24222a1c..97a314d4 100644
--- a/src/test/java/org/apache/commons/beanutils2/BeanUtilsBeanTestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/BeanUtilsBeanTestCase.java
@@ -23,7 +23,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import java.util.Calendar;
 import java.util.HashMap;
@@ -60,13 +59,6 @@ import org.junit.jupiter.api.Test;
  */
 public class BeanUtilsBeanTestCase {
 
-    /**
-     * Test for JDK 1.4
-     */
-    public static boolean isPre14JVM() {
-        return false;
-    }
-
     /**
      * The test bean for each test.
      */
@@ -967,14 +959,8 @@ public class BeanUtilsBeanTestCase {
         // now change the registered conversion
 
         utilsOne.getConvertUtils().register(new ThrowExceptionConverter(), 
Boolean.TYPE);
-        try {
-
-            bean.setBooleanProperty(false);
-            utilsOne.setProperty(bean, "booleanProperty", "true");
-            fail("Registered conversion not used.");
-
-        } catch (final PassTestException e) {
-            /* Do nothing */ }
+        bean.setBooleanProperty(false);
+        assertThrows(PassTestException.class, () ->        
utilsOne.setProperty(bean, "booleanProperty", "true"));
 
         // make sure that this conversion has no been registered in the other 
instance
         bean.setBooleanProperty(false);
diff --git 
a/src/test/java/org/apache/commons/beanutils2/BeanificationTestCase.java 
b/src/test/java/org/apache/commons/beanutils2/BeanificationTestCase.java
index 201ced59..562107a0 100644
--- a/src/test/java/org/apache/commons/beanutils2/BeanificationTestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/BeanificationTestCase.java
@@ -18,10 +18,10 @@
 package org.apache.commons.beanutils2;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
@@ -321,12 +321,9 @@ public class BeanificationTestCase {
         thread.join();
 
         assertEquals(2, signal.getSignal(), "Signal not set by test thread");
-        assertNotEquals(BeanUtilsBean.getInstance(), signal.getBean(),
-                                   "Different BeanUtilsBean instances per 
context classloader");
-        assertNotEquals(ConvertUtilsBean.getInstance(), 
signal.getConvertUtils(),
-                                   "Different ConvertUtilsBean instances per 
context classloader");
-        assertNotEquals(PropertyUtilsBean.getInstance(), 
signal.getPropertyUtils(),
-                                   "Different PropertyUtilsBean instances per 
context classloader");
+        assertNotEquals(BeanUtilsBean.getInstance(), signal.getBean(), 
"Different BeanUtilsBean instances per context classloader");
+        assertNotEquals(ConvertUtilsBean.getInstance(), 
signal.getConvertUtils(), "Different ConvertUtilsBean instances per context 
classloader");
+        assertNotEquals(PropertyUtilsBean.getInstance(), 
signal.getPropertyUtils(), "Different PropertyUtilsBean instances per context 
classloader");
     }
 
     /** Tests whether class loaders and beans are released from memory */
@@ -388,9 +385,7 @@ public class BeanificationTestCase {
         while (true) {
             BeanUtilsBean.getInstance();
             System.gc();
-            if (iterations++ > MAX_GC_ITERATIONS) {
-                fail("Max iterations reached before resource released.");
-            }
+            assertFalse(iterations++ > MAX_GC_ITERATIONS, "Max iterations 
reached before resource released.");
 
             if (loaderReference.get() == null && beanUtilsReference.get() == 
null && propertyUtilsReference.get() == null
                     && convertUtilsReference.get() == null) {
@@ -430,9 +425,8 @@ public class BeanificationTestCase {
         int bytz = 2;
         while (true) {
             System.gc();
-            if (iterations++ > MAX_GC_ITERATIONS) {
-                fail("Max iterations reached before resource released.");
-            }
+            assertFalse(iterations++ > MAX_GC_ITERATIONS, "Max iterations 
reached before resource released.");
+
             map.isEmpty();
 
             if (loaderReference.get() == null && testReference.get() == null) {
@@ -467,9 +461,7 @@ public class BeanificationTestCase {
         int bytz = 2;
         while (true) {
             System.gc();
-            if (iterations++ > MAX_GC_ITERATIONS) {
-                fail("Max iterations reached before resource released.");
-            }
+            assertFalse(iterations++ > MAX_GC_ITERATIONS, "Max iterations 
reached before resource released.");
             if (reference.get() == null) {
                 break;
 
diff --git 
a/src/test/java/org/apache/commons/beanutils2/LazyDynaListTestCase.java 
b/src/test/java/org/apache/commons/beanutils2/LazyDynaListTestCase.java
index af498385..44d22408 100644
--- a/src/test/java/org/apache/commons/beanutils2/LazyDynaListTestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/LazyDynaListTestCase.java
@@ -21,7 +21,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertSame;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -237,7 +236,7 @@ public class LazyDynaListTestCase {
     /**
      * Do serialization and deserialization.
      */
-    private Object serializeDeserialize(final Object target, final String 
text) throws IOException {
+    private Object serializeDeserialize(final Object target, final String 
text) throws IOException, ClassNotFoundException {
         // Serialize the test object
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
@@ -249,8 +248,6 @@ public class LazyDynaListTestCase {
         try (ByteArrayInputStream bais = new 
ByteArrayInputStream(baos.toByteArray());
                 ObjectInputStream ois = new ObjectInputStream(bais)) {
             result = ois.readObject();
-        } catch (final Exception e) {
-            fail(text + ": Exception during deserialization: " + e);
         }
         return result;
     }
@@ -410,7 +407,7 @@ public class LazyDynaListTestCase {
      * Test DynaBean serialization.
      */
     @Test
-    public void testSerializationDynaBean() throws IOException {
+    public void testSerializationDynaBean() throws Exception {
 
         // Create LazyArrayList for DynaBeans
         LazyDynaList target = new LazyDynaList(basicDynaClass);
@@ -436,7 +433,7 @@ public class LazyDynaListTestCase {
      * Test DynaBean serialization.
      */
     @Test
-    public void testSerializationLazyDynaBean() throws IOException {
+    public void testSerializationLazyDynaBean() throws Exception {
 
         // Create LazyArrayList for DynaBeans
         LazyDynaList target = new LazyDynaList();
@@ -462,7 +459,7 @@ public class LazyDynaListTestCase {
      * Test Map serialization.
      */
     @Test
-    public void testSerializationMap() throws IOException {
+    public void testSerializationMap() throws Exception {
 
         // Create LazyArrayList for DynaBeans
         LazyDynaList target = new LazyDynaList(treeMapDynaClass);
@@ -488,7 +485,7 @@ public class LazyDynaListTestCase {
      * Test POJO (WrapDynaBean) serialization.
      */
     @Test
-    public void testSerializationPojo() throws IOException {
+    public void testSerializationPojo() throws Exception {
 
         // Create LazyArrayList for DynaBeans
         LazyDynaList target = new LazyDynaList(pojoDynaClass);
diff --git 
a/src/test/java/org/apache/commons/beanutils2/PropertyUtilsTestCase.java 
b/src/test/java/org/apache/commons/beanutils2/PropertyUtilsTestCase.java
index db4fc995..7aad797a 100644
--- a/src/test/java/org/apache/commons/beanutils2/PropertyUtilsTestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/PropertyUtilsTestCase.java
@@ -24,7 +24,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import java.beans.IntrospectionException;
 import java.beans.PropertyDescriptor;
@@ -498,11 +497,8 @@ public class PropertyUtilsTestCase {
             }
         }
         for (int j = 0; j < properties.length; j++) {
-            if (count[j] < 0) {
-                fail("Missing property " + properties[j]);
-            } else if (count[j] > 1) {
-                fail("Duplicate property " + properties[j]);
-            }
+            assertFalse(count[j] < 0, "Missing property " + properties[j]);
+            assertFalse(count[j] > 1, "Missing property " + properties[j]);
         }
 
     }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/bugs/Jira349TestCase.java 
b/src/test/java/org/apache/commons/beanutils2/bugs/Jira349TestCase.java
index 18a8bbbb..baf0224e 100644
--- a/src/test/java/org/apache/commons/beanutils2/bugs/Jira349TestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/bugs/Jira349TestCase.java
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.beanutils2.bugs;
 
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import org.apache.commons.beanutils2.PropertyUtils;
 import org.apache.commons.logging.Log;
@@ -87,16 +87,6 @@ public class Jira349TestCase {
     public void testIssue_BEANUTILS_349_PropertyUtils_copyProperties() {
         final PrimitiveBean dest = new PrimitiveBean();
         final ObjectBean origin = new ObjectBean();
-        try {
-            PropertyUtils.copyProperties(dest, origin);
-        } catch (final NullPointerException e) {
-            LOG.error("Failed", e);
-            fail("Threw NullPointerException");
-        } catch (final IllegalArgumentException e) {
-            LOG.warn("Expected Result", e);
-        } catch (final Throwable t) {
-            LOG.error("Failed", t);
-            fail("Threw exception: " + t);
-        }
+        assertThrows(IllegalArgumentException.class, () -> 
PropertyUtils.copyProperties(dest, origin));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/bugs/Jira357TestCase.java 
b/src/test/java/org/apache/commons/beanutils2/bugs/Jira357TestCase.java
index 00320870..b7d83616 100644
--- a/src/test/java/org/apache/commons/beanutils2/bugs/Jira357TestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/bugs/Jira357TestCase.java
@@ -18,7 +18,6 @@ package org.apache.commons.beanutils2.bugs;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import java.beans.PropertyDescriptor;
 
@@ -106,18 +105,12 @@ public class Jira357TestCase {
     private void checkReadMethod(final String propertyName, final Class<?> 
expectedDeclaringClass) throws Exception {
 
         PropertyDescriptor[] descriptors = null;
-        try {
-            descriptors = 
PropertyUtils.getPropertyDescriptors(ConcreteTestBean.class);
-        } catch (final Exception e) {
-            e.printStackTrace();
-            fail("Threw: " + e);
-        }
+        descriptors = 
PropertyUtils.getPropertyDescriptors(ConcreteTestBean.class);
 
         // Test InnerClassProperty
         final PropertyDescriptor descriptor = findDescriptor(propertyName, 
descriptors);
         assertNotNull(descriptor, propertyName + "descriptor");
-        assertEquals(expectedDeclaringClass, 
descriptor.getReadMethod().getDeclaringClass(),
-                                propertyName + " read method declaring class");
+        assertEquals(expectedDeclaringClass, 
descriptor.getReadMethod().getDeclaringClass(), propertyName + " read method 
declaring class");
     }
 
     /**
diff --git 
a/src/test/java/org/apache/commons/beanutils2/bugs/Jira358TestCase.java 
b/src/test/java/org/apache/commons/beanutils2/bugs/Jira358TestCase.java
index d1baf0c8..9182105c 100644
--- a/src/test/java/org/apache/commons/beanutils2/bugs/Jira358TestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/bugs/Jira358TestCase.java
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.beanutils2.bugs;
 
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import org.apache.commons.beanutils2.PropertyUtils;
 import org.apache.commons.beanutils2.TestBean;
@@ -54,12 +54,7 @@ public class Jira358TestCase {
     public void testPropertyUtils_getIndexedProperty_Array() throws Exception {
 
         final TestBean bean = new TestBean();
-        try {
-            PropertyUtils.getIndexedProperty(bean, "intArray", 
bean.getIntArray().length);
-            fail("Expected ArrayIndexOutOfBoundsException");
-        } catch (final ArrayIndexOutOfBoundsException e) {
-            // expected result
-        }
+        assertThrows(ArrayIndexOutOfBoundsException.class, () -> 
PropertyUtils.getIndexedProperty(bean, "intArray", bean.getIntArray().length));
     }
 
     /**
@@ -69,11 +64,6 @@ public class Jira358TestCase {
     public void testPropertyUtils_getIndexedProperty_List() throws Exception {
 
         final TestBean bean = new TestBean();
-        try {
-            PropertyUtils.getIndexedProperty(bean, "listIndexed", 
bean.getListIndexed().size());
-            fail("Expected IndexOutOfBoundsException");
-        } catch (final IndexOutOfBoundsException e) {
-            // expected result
-        }
+        assertThrows(IndexOutOfBoundsException.class, () -> 
PropertyUtils.getIndexedProperty(bean, "listIndexed", 
bean.getListIndexed().size()));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/bugs/Jira369TestCase.java 
b/src/test/java/org/apache/commons/beanutils2/bugs/Jira369TestCase.java
index ad5d26b3..770af73c 100644
--- a/src/test/java/org/apache/commons/beanutils2/bugs/Jira369TestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/bugs/Jira369TestCase.java
@@ -17,7 +17,7 @@
 package org.apache.commons.beanutils2.bugs;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import org.apache.commons.beanutils2.BeanUtils;
 import org.junit.jupiter.api.AfterEach;
@@ -78,15 +78,7 @@ public class Jira369TestCase {
     public void testBeanUtilsGetProperty_aRatedCd() throws Exception {
         final TestBean bean = new TestBean();
         bean.setARatedCd("foo");
-
-        try {
-            assertEquals("foo", BeanUtils.getProperty(bean, "aRatedCd"));
-            fail("Expected NoSuchMethodException");
-        } catch (final NoSuchMethodException e) {
-            // expected result
-        } catch (final Exception e) {
-            fail("Threw " + e);
-        }
+        assertThrows(NoSuchMethodException.class, () -> assertEquals("foo", 
BeanUtils.getProperty(bean, "aRatedCd")));
     }
 
     /**
@@ -96,11 +88,7 @@ public class Jira369TestCase {
     public void testBeanUtilsGetProperty_ARatedCd() throws Exception {
         final TestBean bean = new TestBean();
         bean.setARatedCd("foo");
-        try {
-            assertEquals("foo", BeanUtils.getProperty(bean, "ARatedCd"));
-        } catch (final Exception e) {
-            fail("Threw " + e);
-        }
+        assertEquals("foo", BeanUtils.getProperty(bean, "ARatedCd"));
     }
 
     /**
@@ -110,10 +98,6 @@ public class Jira369TestCase {
     public void testBeanUtilsGetProperty_bRatedCd() throws Exception {
         final TestBean bean = new TestBean();
         bean.setbRatedCd("foo");
-        try {
-            assertEquals("foo", BeanUtils.getProperty(bean, "bRatedCd"));
-        } catch (final Exception e) {
-            fail("Threw " + e);
-        }
+        assertEquals("foo", BeanUtils.getProperty(bean, "bRatedCd"));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/bugs/Jira463TestCase.java 
b/src/test/java/org/apache/commons/beanutils2/bugs/Jira463TestCase.java
index 706d12be..b47a5591 100644
--- a/src/test/java/org/apache/commons/beanutils2/bugs/Jira463TestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/bugs/Jira463TestCase.java
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.beanutils2.bugs;
 
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import org.apache.commons.beanutils2.AlphaBean;
 import org.apache.commons.beanutils2.BeanUtilsBean;
@@ -37,11 +37,6 @@ public class Jira463TestCase {
         final BeanUtilsBean bub = new BeanUtilsBean();
         
bub.getPropertyUtils().addBeanIntrospector(SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS);
         final AlphaBean bean = new AlphaBean();
-        try {
-            bub.getProperty(bean, "class");
-            fail("Could access class property!");
-        } catch (final NoSuchMethodException ex) {
-            // ok
-        }
+        assertThrows(NoSuchMethodException.class, () -> bub.getProperty(bean, 
"class"));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/bugs/Jira465TestCase.java 
b/src/test/java/org/apache/commons/beanutils2/bugs/Jira465TestCase.java
index c97052f2..7105dc59 100644
--- a/src/test/java/org/apache/commons/beanutils2/bugs/Jira465TestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/bugs/Jira465TestCase.java
@@ -17,8 +17,8 @@
 package org.apache.commons.beanutils2.bugs;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -93,38 +93,36 @@ public class Jira465TestCase {
      * Changes the value of the test property.
      *
      * @param bean the bean to be updated
+     * @throws InvocationTargetException
+     * @throws IllegalAccessException
      */
-    private static void changeValue(final Object bean) {
-        try {
-            BeanUtils.setProperty(bean, PATH, NEW_VALUE);
-        } catch (final Exception e) {
-            fail("Could not set property: " + e);
-        }
+    private static void changeValue(final Object bean) throws 
IllegalAccessException, InvocationTargetException {
+        BeanUtils.setProperty(bean, PATH, NEW_VALUE);
     }
 
     @Test
-    public void testArrayIndexedProperty() {
+    public void testArrayIndexedProperty() throws Exception {
         final ArrayIndexedProp bean = new ArrayIndexedProp();
         changeValue(bean);
         assertEquals(NEW_VALUE, bean.getFoo(0), "Wrong value");
     }
 
     @Test
-    public void testArrayProperty() {
+    public void testArrayProperty() throws Exception {
         final ArrayProp bean = new ArrayProp();
         changeValue(bean);
         assertEquals(NEW_VALUE, bean.getFoo()[0], "Wrong value");
     }
 
     @Test
-    public void testListIndexedProperty() {
+    public void testListIndexedProperty() throws Exception {
         final ListIndexedProp bean = new ListIndexedProp();
         changeValue(bean);
         assertEquals(NEW_VALUE, bean.getFoo(0), "Wrong value");
     }
 
     @Test
-    public void testListProperty() {
+    public void testListProperty() throws Exception {
         final ListProp bean = new ListProp();
         changeValue(bean);
         assertEquals(NEW_VALUE, bean.getFoo().get(0), "Wrong value");
diff --git 
a/src/test/java/org/apache/commons/beanutils2/bugs/Jira520TestCase.java 
b/src/test/java/org/apache/commons/beanutils2/bugs/Jira520TestCase.java
index c7bfba48..a1e8909b 100644
--- a/src/test/java/org/apache/commons/beanutils2/bugs/Jira520TestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/bugs/Jira520TestCase.java
@@ -17,7 +17,7 @@
 package org.apache.commons.beanutils2.bugs;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import org.apache.commons.beanutils2.AlphaBean;
 import org.apache.commons.beanutils2.BeanUtilsBean;
@@ -39,8 +39,7 @@ public class Jira520TestCase {
         
bub.getPropertyUtils().removeBeanIntrospector(SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS);
         final AlphaBean bean = new AlphaBean();
         final String result = bub.getProperty(bean, "class");
-        assertEquals("class org.apache.commons.beanutils2.AlphaBean", result,
-                                "Class property should have been accessed");
+        assertEquals("class org.apache.commons.beanutils2.AlphaBean", result, 
"Class property should have been accessed");
     }
 
     /**
@@ -50,11 +49,6 @@ public class Jira520TestCase {
     public void testSuppressClassPropertyByDefault() throws Exception {
         final BeanUtilsBean bub = new BeanUtilsBean();
         final AlphaBean bean = new AlphaBean();
-        try {
-            bub.getProperty(bean, "class");
-            fail("Could access class property!");
-        } catch (final NoSuchMethodException ex) {
-            // ok
-        }
+        assertThrows(NoSuchMethodException.class, () -> bub.getProperty(bean, 
"class"));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/bugs/Jira87TestCase.java 
b/src/test/java/org/apache/commons/beanutils2/bugs/Jira87TestCase.java
index d5981074..cf6bdc5b 100644
--- a/src/test/java/org/apache/commons/beanutils2/bugs/Jira87TestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/bugs/Jira87TestCase.java
@@ -17,7 +17,6 @@
 package org.apache.commons.beanutils2.bugs;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import org.apache.commons.beanutils2.PropertyUtils;
 import org.apache.commons.beanutils2.bugs.other.Jira87BeanFactory;
@@ -65,15 +64,10 @@ public class Jira87TestCase {
      * Interface definition with a mapped property
      */
     @Test
-    public void testJira87() {
+    public void testJira87() throws Exception {
 
         final Jira87BeanFactory.PublicMappedInterface bean = 
Jira87BeanFactory.createMappedPropertyBean();
-        try {
-            // N.B. The test impl. returns the key value
-            assertEquals("foo", PropertyUtils.getMappedProperty(bean, 
"value(foo)"));
-        } catch (final Throwable t) {
-            LOG.error("ERROR " + t, t);
-            fail("Threw exception: " + t);
-        }
+        // N.B. The test impl. returns the key value
+        assertEquals("foo", PropertyUtils.getMappedProperty(bean, 
"value(foo)"));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/ArrayConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/ArrayConverterTestCase.java
index 460162e9..8e362737 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/ArrayConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/ArrayConverterTestCase.java
@@ -20,7 +20,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import java.lang.reflect.Array;
 import java.util.ArrayList;
@@ -102,117 +101,61 @@ public class ArrayConverterTestCase {
         String msg = null;
 
         // String --> int[]
-        try {
-            msg = "String --> int[]";
-            checkArray(msg, intArray, arrayConverter.convert(int[].class, 
stringA));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "String --> int[]";
+        checkArray(msg, intArray, arrayConverter.convert(int[].class, 
stringA));
 
         // String --> int[] (with braces)
-        try {
-            msg = "String --> Integer[] (with braces)";
-            checkArray(msg, IntegerArray, 
arrayConverter.convert(Integer[].class, "{" + stringA + "}"));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "String --> Integer[] (with braces)";
+        checkArray(msg, IntegerArray, arrayConverter.convert(Integer[].class, 
"{" + stringA + "}"));
 
         // String[] --> int[]
-        try {
-            msg = "String[] --> int[]";
-            checkArray(msg, intArray, arrayConverter.convert(int[].class, 
strArray));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "String[] --> int[]";
+        checkArray(msg, intArray, arrayConverter.convert(int[].class, 
strArray));
 
         // String[] --> Integer[]
-        try {
-            msg = "String[] --> Integer[]";
-            checkArray(msg, IntegerArray, 
arrayConverter.convert(Integer[].class, strArray));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "String[] --> Integer[]";
+        checkArray(msg, IntegerArray, arrayConverter.convert(Integer[].class, 
strArray));
 
         // long[] --> int[]
-        try {
-            msg = "long[] --> int[]";
-            checkArray(msg, intArray, arrayConverter.convert(int[].class, 
longArray));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "long[] --> int[]";
+        checkArray(msg, intArray, arrayConverter.convert(int[].class, 
longArray));
 
         // Long --> int[]
-        try {
-            msg = "Long --> int[]";
-            checkArray(msg, new int[] { LONGArray[0].intValue() }, 
arrayConverter.convert(int[].class, LONGArray[0]));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "Long --> int[]";
+        checkArray(msg, new int[] { LONGArray[0].intValue() }, 
arrayConverter.convert(int[].class, LONGArray[0]));
 
         // LONG[] --> int[]
-        try {
-            msg = "LONG[] --> int[]";
-            checkArray(msg, intArray, arrayConverter.convert(int[].class, 
LONGArray));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "LONG[] --> int[]";
+        checkArray(msg, intArray, arrayConverter.convert(int[].class, 
LONGArray));
 
         // Long --> String
-        try {
-            msg = "Long --> String";
-            assertEquals(LONGArray[0] + "", 
arrayConverter.convert(String.class, LONGArray[0]), msg);
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "Long --> String";
+        assertEquals(LONGArray[0] + "", arrayConverter.convert(String.class, 
LONGArray[0]), msg);
 
         // LONG[] --> String (first)
-        try {
-            msg = "LONG[] --> String (first)";
-            assertEquals(LONGArray[0] + "", 
arrayConverter.convert(String.class, LONGArray), msg);
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "LONG[] --> String (first)";
+        assertEquals(LONGArray[0] + "", arrayConverter.convert(String.class, 
LONGArray), msg);
 
         // LONG[] --> String (all)
-        try {
-            msg = "LONG[] --> String (all)";
-            arrayConverter.setOnlyFirstToString(false);
-            assertEquals(stringB, arrayConverter.convert(String.class, 
LONGArray), msg);
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "LONG[] --> String (all)";
+        arrayConverter.setOnlyFirstToString(false);
+        assertEquals(stringB, arrayConverter.convert(String.class, LONGArray), 
msg);
 
         // Collection of Long --> String
-        try {
-            msg = "Collection of Long --> String";
-            assertEquals(stringB, arrayConverter.convert(String.class, 
longList), msg);
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "Collection of Long --> String";
+        assertEquals(stringB, arrayConverter.convert(String.class, longList), 
msg);
 
         // LONG[] --> String[]
-        try {
-            msg = "long[] --> String[]";
-            checkArray(msg, strArray, arrayConverter.convert(String[].class, 
LONGArray));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "long[] --> String[]";
+        checkArray(msg, strArray, arrayConverter.convert(String[].class, 
LONGArray));
 
         // Collection of String --> Integer[]
-        try {
-            msg = "Collection of String --> Integer[]";
-            checkArray(msg, IntegerArray, 
arrayConverter.convert(Integer[].class, strList));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "Collection of String --> Integer[]";
+        checkArray(msg, IntegerArray, arrayConverter.convert(Integer[].class, 
strList));
 
         // Collection of Long --> int[]
-        try {
-            msg = "Collection of Long --> int[]";
-            checkArray(msg, intArray, arrayConverter.convert(int[].class, 
longList));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "Collection of Long --> int[]";
+        checkArray(msg, intArray, arrayConverter.convert(int[].class, 
longList));
     }
 
     /**
@@ -224,8 +167,7 @@ public class ArrayConverterTestCase {
         final IntegerConverter intConverter = new IntegerConverter();
 
         checkArray("Empty String", zeroArray, new ArrayConverter(int[].class, 
intConverter, -1).convert(int[].class, ""));
-        assertEquals(null, new ArrayConverter(int[].class, 
intConverter).convert(String.class, null),
-                                "Default String");
+        assertEquals(null, new ArrayConverter(int[].class, 
intConverter).convert(String.class, null), "Default String");
     }
 
     /**
@@ -247,8 +189,7 @@ public class ArrayConverterTestCase {
         final int[] oneArray = new int[1];
         final IntegerConverter intConverter = new IntegerConverter();
 
-        assertEquals(null, new ArrayConverter(int[].class, intConverter, 
-1).convert(int[].class, null),
-                                "Null Default");
+        assertEquals(null, new ArrayConverter(int[].class, intConverter, 
-1).convert(int[].class, null), "Null Default");
         checkArray("Zero Length", zeroArray, new ArrayConverter(int[].class, 
intConverter, 0).convert(int[].class, null));
         checkArray("One Length", oneArray, new ArrayConverter(Integer[].class, 
intConverter, 1).convert(int[].class, null));
     }
@@ -275,36 +216,20 @@ public class ArrayConverterTestCase {
                 Integer.valueOf(expectedInt[3]) };
 
         // Test String[] --> int[]
-        try {
-            msg = "String[] --> int[]";
-            checkArray(msg, expectedInt, arrayConverter.convert(int[].class, 
array));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "String[] --> int[]";
+        checkArray(msg, expectedInt, arrayConverter.convert(int[].class, 
array));
 
         // Test String[] --> Integer[]
-        try {
-            msg = "String[] --> Integer[]";
-            checkArray(msg, expectedInteger, 
arrayConverter.convert(Integer[].class, array));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "String[] --> Integer[]";
+        checkArray(msg, expectedInteger, 
arrayConverter.convert(Integer[].class, array));
 
         // Test List --> int[]
-        try {
-            msg = "List --> int[]";
-            checkArray(msg, expectedInt, arrayConverter.convert(int[].class, 
list));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "List --> int[]";
+        checkArray(msg, expectedInt, arrayConverter.convert(int[].class, 
list));
 
         // Test List --> Integer[]
-        try {
-            msg = "List --> Integer[]";
-            checkArray(msg, expectedInteger, 
arrayConverter.convert(Integer[].class, list));
-        } catch (final Exception e) {
-            fail(msg + " failed " + e);
-        }
+        msg = "List --> Integer[]";
+        checkArray(msg, expectedInteger, 
arrayConverter.convert(Integer[].class, list));
     }
 
     /**
@@ -337,24 +262,20 @@ public class ArrayConverterTestCase {
         matrixConverter.setDelimiter(';');
         matrixConverter.setAllowedChars(new char[] { ',' });
 
-        try {
-            // Do the Conversion
-            final Object result = matrixConverter.convert(int[][].class, 
matrixString);
-
-            // Check it actually worked OK
-            assertEquals(int[][].class, result.getClass(), "Check 
int[][].class");
-            final int[][] matrix = (int[][]) result;
-            assertEquals(expected.length, matrix.length, "Check int[][] 
length");
-            for (int i = 0; i < expected.length; i++) {
-                assertEquals(expected[i].length, matrix[i].length, "Check 
int[" + i + "] length");
-                for (int j = 0; j < expected[i].length; j++) {
-                    final String label = "Matrix int[" + i + "," + j + "] 
element";
-                    assertEquals(expected[i][j], matrix[i][j], label);
-                    // System.out.println(label + " = " + matrix[i][j]);
-                }
+        // Do the Conversion
+        final Object result = matrixConverter.convert(int[][].class, 
matrixString);
+
+        // Check it actually worked OK
+        assertEquals(int[][].class, result.getClass(), "Check int[][].class");
+        final int[][] matrix = (int[][]) result;
+        assertEquals(expected.length, matrix.length, "Check int[][] length");
+        for (int i = 0; i < expected.length; i++) {
+            assertEquals(expected[i].length, matrix[i].length, "Check int[" + 
i + "] length");
+            for (int j = 0; j < expected[i].length; j++) {
+                final String label = "Matrix int[" + i + "," + j + "] element";
+                assertEquals(expected[i][j], matrix[i][j], label);
+                // System.out.println(label + " = " + matrix[i][j]);
             }
-        } catch (final Exception e) {
-            fail("Matrix Conversion threw " + e);
         }
     }
 
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/BooleanConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/BooleanConverterTestCase.java
index 698fee76..9e753d95 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/BooleanConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/BooleanConverterTestCase.java
@@ -19,8 +19,8 @@ package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import org.apache.commons.beanutils2.ConversionException;
 import org.junit.jupiter.api.Test;
@@ -40,18 +40,8 @@ public class BooleanConverterTestCase {
         final AbstractConverter<Boolean> converter = new 
BooleanConverter(trueStrings, falseStrings);
         testConversionValues(converter, new String[] { "sure", "Sure" }, new 
String[] { "nope", "nOpE" });
 
-        try {
-            converter.convert(Boolean.class, "true");
-            fail("Converting obsolete true value should have generated an 
exception");
-        } catch (final ConversionException expected) {
-            // Exception is successful test
-        }
-        try {
-            converter.convert(Boolean.class, "bogus");
-            fail("Converting invalid string should have generated an 
exception");
-        } catch (final ConversionException expected) {
-            // Exception is successful test
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Boolean.class, "true"));
+        assertThrows(ConversionException.class, () -> 
converter.convert(Boolean.class, "bogus"));
     }
 
     @Test
@@ -66,12 +56,7 @@ public class BooleanConverterTestCase {
     @Test
     public void testConversionToOtherType() {
         final AbstractConverter<Boolean> converter = new BooleanConverter();
-        try {
-            converter.convert(Integer.class, STANDARD_TRUES[0]);
-            fail("Could convert to unsupported type!");
-        } catch (final ConversionException cex) {
-            // Expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, STANDARD_TRUES[0]));
     }
 
     protected void testConversionValues(final AbstractConverter<Boolean> 
converter, final String[] trueValues, final String[] falseValues) {
@@ -96,12 +81,7 @@ public class BooleanConverterTestCase {
     @Test
     public void testInvalidString() {
         final AbstractConverter<Boolean> converter = new BooleanConverter();
-        try {
-            converter.convert(Boolean.class, "bogus");
-            fail("Converting invalid string should have generated an 
exception");
-        } catch (final ConversionException expected) {
-            // Exception is successful test
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Boolean.class, "bogus"));
     }
 
     /**
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/CharacterConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/CharacterConverterTestCase.java
index db3c2cc2..ba763dd9 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/CharacterConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/CharacterConverterTestCase.java
@@ -17,7 +17,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import org.apache.commons.beanutils2.ConversionException;
 import org.apache.commons.beanutils2.Converter;
@@ -55,11 +55,9 @@ public class CharacterConverterTestCase {
     @Test
     public void testConvertToCharacter() {
         final Converter<Character> converter = new CharacterConverter();
-        assertEquals(Character.valueOf('N'), 
converter.convert(Character.class, Character.valueOf('N')),
-                                "Character Test");
+        assertEquals(Character.valueOf('N'), 
converter.convert(Character.class, Character.valueOf('N')), "Character Test");
         assertEquals(Character.valueOf('F'), 
converter.convert(Character.class, "FOO"), "String Test");
-        assertEquals(Character.valueOf('3'), 
converter.convert(Character.class, Integer.valueOf(321)),
-                                "Integer Test");
+        assertEquals(Character.valueOf('3'), 
converter.convert(Character.class, Integer.valueOf(321)), "Integer Test");
     }
 
     /**
@@ -68,12 +66,7 @@ public class CharacterConverterTestCase {
     @Test
     public void testConvertToCharacterNullNoDefault() {
         final Converter<Character> converter = new CharacterConverter();
-        try {
-            converter.convert(Character.class, null);
-            fail("Expected a ConversionException for null value");
-        } catch (final Exception e) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Character.class, null));
     }
 
     /**
@@ -101,12 +94,7 @@ public class CharacterConverterTestCase {
     public void testConvertToUnsupportedType() {
         @SuppressWarnings("rawtypes") // tests failure so allow mismatch
         final Converter converter = new CharacterConverter();
-        try {
-            converter.convert(Integer.class, "Test");
-            fail("Could convert to unsupported type!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "Test"));
     }
 
     /**
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/ClassConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/ClassConverterTestCase.java
index 9021451e..f27da5bb 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/ClassConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/ClassConverterTestCase.java
@@ -17,7 +17,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import org.apache.commons.beanutils2.ConversionException;
 import org.apache.commons.beanutils2.Converter;
@@ -46,11 +46,8 @@ public class ClassConverterTestCase {
     @Test
     public void testArray() {
         final Converter<Class<?>> converter = new ClassConverter();
-
         // Test Array Class to String
-        assertEquals("[Ljava.lang.Boolean;", converter.convert(String.class, 
Boolean[].class),
-                                "Array to String");
-
+        assertEquals("[Ljava.lang.Boolean;", converter.convert(String.class, 
Boolean[].class), "Array to String");
         // *** N.B. for some reason the following works on m1, but not m2
         // Test String to Array Class
         // assertEquals("String to Array", Boolean[].class, 
converter.convert(Class.class, "[Ljava.lang.Boolean;"));
@@ -62,27 +59,13 @@ public class ClassConverterTestCase {
     @Test
     public void testConvertToClass() {
         final Converter<Class<?>> converter = new ClassConverter();
-
         assertEquals(Integer.class, converter.convert(Class.class, 
Integer.class), "Class Test");
         assertEquals(Integer.class, converter.convert(Class.class, 
"java.lang.Integer"), "String Test");
-        assertEquals(Integer.class, converter.convert(Class.class, new 
StringBuilder("java.lang.Integer")),
-                                "StringBuilder Test");
-
+        assertEquals(Integer.class, converter.convert(Class.class, new 
StringBuilder("java.lang.Integer")), "StringBuilder Test");
         // Invalid Test
-        try {
-            converter.convert(Class.class, Integer.valueOf(6));
-            fail("Expected invalid value to fail");
-        } catch (final ConversionException e) {
-            // expected result
-        }
-
+        assertThrows(ConversionException.class, () -> 
converter.convert(Class.class, Integer.valueOf(6)));
         // Test Null
-        try {
-            converter.convert(Class.class, null);
-            fail("Expected null value to fail");
-        } catch (final ConversionException e) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Class.class, null));
     }
 
     /**
@@ -90,9 +73,7 @@ public class ClassConverterTestCase {
      */
     @Test
     public void testConvertToClassDefault() {
-
         final Converter<Class<?>> converter = new ClassConverter(Object.class);
-
         assertEquals(Object.class, converter.convert(Class.class, 
Integer.valueOf(6)), "Invalid Test");
         assertEquals(Object.class, converter.convert(Class.class, null), "Null 
Test");
     }
@@ -102,9 +83,7 @@ public class ClassConverterTestCase {
      */
     @Test
     public void testConvertToClassDefaultNull() {
-
         final Converter<Class<?>> converter = new ClassConverter(null);
-
         assertEquals(null, converter.convert(Class.class, Integer.valueOf(6)), 
"Invalid Test");
         assertEquals(null, converter.convert(Class.class, null), "Null Test");
     }
@@ -115,7 +94,6 @@ public class ClassConverterTestCase {
     @Test
     public void testConvertToString() {
         final Converter<Class<?>> converter = new ClassConverter();
-
         assertEquals("java.lang.Integer", converter.convert(String.class, 
Integer.class), "Class Test");
         assertEquals("foo", converter.convert(String.class, "foo"), "Value 
Test");
         assertEquals("bar", converter.convert(String.class, new 
StringBuilder("bar")), "Value Test");
@@ -128,14 +106,8 @@ public class ClassConverterTestCase {
     @Test
     public void testInvalid() {
         final Converter<Class<?>> converter = new ClassConverter();
-
         // Test invalid class name
-        try {
-            converter.convert(Class.class, "foo.bar");
-            fail("Invalid class name, expected ConversionException");
-        } catch (final ConversionException e) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Class.class, "foo.bar"));
     }
 
     /**
@@ -144,11 +116,6 @@ public class ClassConverterTestCase {
     @Test
     public void testUnsupportedTargetType() {
         final Converter<Class<?>> converter = new ClassConverter();
-        try {
-            converter.convert(Integer.class, getClass().getName());
-            fail("Invalid target class not detected!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, getClass().getName()));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/DurationConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/DurationConverterTestCase.java
index a81d0d28..0dca5532 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/DurationConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/DurationConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.time.Duration;
 
@@ -76,11 +76,6 @@ public class DurationConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/EnumConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/EnumConverterTestCase.java
index 5f970de3..65ad0287 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/EnumConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/EnumConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import org.apache.commons.beanutils2.ConversionException;
 import org.apache.commons.beanutils2.Converter;
@@ -78,11 +78,6 @@ public class EnumConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/FileConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/FileConverterTestCase.java
index 23133255..8f07dbc1 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/FileConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/FileConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.io.File;
 
@@ -72,11 +72,6 @@ public class FileConverterTestCase {
      */
     @Test
     public void testUnsupportedTargetType() {
-        try {
-            converter.convert(Integer.class, "/tmp");
-            fail("Could convert to unsupported type!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "/tmp"));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/LocalTimeConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/LocalTimeConverterTestCase.java
index 8782cb20..ed9db4a1 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/LocalTimeConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/LocalTimeConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.time.LocalTime;
 
@@ -76,11 +76,6 @@ public class LocalTimeConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/MonthDayConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/MonthDayConverterTestCase.java
index 95038c73..b819a5f4 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/MonthDayConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/MonthDayConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.time.MonthDay;
 
@@ -76,11 +76,6 @@ public class MonthDayConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/OffsetTimeConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/OffsetTimeConverterTestCase.java
index 15314690..74870559 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/OffsetTimeConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/OffsetTimeConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.time.OffsetTime;
 
@@ -76,11 +76,6 @@ public class OffsetTimeConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/PathConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/PathConverterTestCase.java
index fb066f93..1e39ab79 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/PathConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/PathConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.io.File;
 import java.nio.file.Path;
@@ -81,11 +81,6 @@ public class PathConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/PeriodConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/PeriodConverterTestCase.java
index 19104541..66e4f962 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/PeriodConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/PeriodConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.time.Period;
 
@@ -76,11 +76,6 @@ public class PeriodConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/URIConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/URIConverterTestCase.java
index 7814bd0c..77211c97 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/URIConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/URIConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.net.URI;
 
@@ -79,11 +79,6 @@ public class URIConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/UUIDConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/UUIDConverterTestCase.java
index 72ee206e..5036bd33 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/UUIDConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/UUIDConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.util.UUID;
 
@@ -76,11 +76,6 @@ public class UUIDConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/YearConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/YearConverterTestCase.java
index 82dccd18..65fd5558 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/YearConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/YearConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.time.Year;
 
@@ -76,11 +76,6 @@ public class YearConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/YearMonthConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/YearMonthConverterTestCase.java
index 960071dc..7baa01e4 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/YearMonthConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/YearMonthConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.time.YearMonth;
 
@@ -76,11 +76,6 @@ public class YearMonthConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/ZoneIdConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/ZoneIdConverterTestCase.java
index 1ec54d9e..1ff67a66 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/ZoneIdConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/ZoneIdConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.time.ZoneId;
 
@@ -76,11 +76,6 @@ public class ZoneIdConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(Integer.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/converters/ZoneOffsetConverterTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/converters/ZoneOffsetConverterTestCase.java
index ebd07873..fedab449 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/converters/ZoneOffsetConverterTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/converters/ZoneOffsetConverterTestCase.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2.converters;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.time.ZoneOffset;
 
@@ -76,11 +76,6 @@ public class ZoneOffsetConverterTestCase {
      */
     @Test
     public void testUnsupportedType() {
-        try {
-            converter.convert(Integer.class, "http://www.apache.org";);
-            fail("Unsupported type could be converted!");
-        } catch (final ConversionException cex) {
-            // expected result
-        }
+        assertThrows(ConversionException.class, () -> 
converter.convert(ConversionException.class, "http://www.apache.org";));
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/expression/DefaultResolverTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/expression/DefaultResolverTestCase.java
index d717085d..a264927a 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/expression/DefaultResolverTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/expression/DefaultResolverTestCase.java
@@ -18,8 +18,8 @@ package org.apache.commons.beanutils2.expression;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
@@ -72,71 +72,39 @@ public class DefaultResolverTestCase {
      * Test getIndex() method.
      */
     @Test
-    public void testGetIndex() {
+    public void testGetIndex() throws Exception {
         String label = null;
 
         // Simple Properties (expect -1)
         for (int i = 0; i < validProperties.length; i++) {
-            try {
-                label = "Simple " + label(validProperties[i], i);
-                assertEquals(-1, resolver.getIndex(validProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Simple " + label(validProperties[i], i);
+            assertEquals(-1, resolver.getIndex(validProperties[i]), label);
         }
 
         // Indexed Properties (expect correct index value)
         for (int i = 0; i < validIndexProperties.length; i++) {
-            try {
-                label = "Indexed " + label(validIndexProperties[i], i);
-                assertEquals(validIndexValues[i], 
resolver.getIndex(validIndexProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Indexed " + label(validIndexProperties[i], i);
+            assertEquals(validIndexValues[i], 
resolver.getIndex(validIndexProperties[i]), label);
         }
 
         // Mapped Properties (expect -1)
         for (int i = 0; i < validMapProperties.length; i++) {
-            try {
-                label = "Mapped " + label(validMapProperties[i], i);
-                assertEquals(-1, resolver.getIndex(validMapProperties[i]), 
label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Mapped " + label(validMapProperties[i], i);
+            assertEquals(-1, resolver.getIndex(validMapProperties[i]), label);
         }
 
         // Missing Index Value
         label = "Missing Index";
-        try {
-            final int index = resolver.getIndex("foo[]");
-            fail(label + " expected IllegalArgumentException: " + index);
-        } catch (final IllegalArgumentException e) {
-            assertEquals("No Index Value", e.getMessage(), label + " Error 
Message");
-        } catch (final Throwable t) {
-            fail(label + " expected IllegalArgumentException: " + t);
-        }
+        assertThrows(IllegalArgumentException.class, () -> 
resolver.getIndex("foo[]"));
 
         // Malformed
         label = "Malformed";
-        try {
-            final int index = resolver.getIndex("foo[12");
-            fail(label + " expected IllegalArgumentException: " + index);
-        } catch (final IllegalArgumentException e) {
-            assertEquals("Missing End Delimiter", e.getMessage(), label + " 
Error Message");
-        } catch (final Throwable t) {
-            fail(label + " expected IllegalArgumentException: " + t);
-        }
+        assertThrows(IllegalArgumentException.class, () -> 
resolver.getIndex("foo[12"));
 
         // Non-numeric
         label = "Malformed";
-        try {
-            final int index = resolver.getIndex("foo[BAR]");
-            fail(label + " expected IllegalArgumentException: " + index);
-        } catch (final IllegalArgumentException e) {
-            assertEquals("Invalid index value 'BAR'", e.getMessage(), label + 
" Error Message");
-        } catch (final Throwable t) {
-            fail(label + " expected IllegalArgumentException: " + t);
-        }
+        IllegalArgumentException e = 
assertThrows(IllegalArgumentException.class, () -> 
resolver.getIndex("foo[BAR]"));
+        assertEquals("Invalid index value 'BAR'", e.getMessage(), label + " 
Error Message");
     }
 
     /**
@@ -148,44 +116,26 @@ public class DefaultResolverTestCase {
 
         // Simple Properties (expect null)
         for (int i = 0; i < validProperties.length; i++) {
-            try {
-                label = "Simple " + label(validProperties[i], i);
-                assertEquals(null, resolver.getKey(validProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Simple " + label(validProperties[i], i);
+            assertEquals(null, resolver.getKey(validProperties[i]), label);
         }
 
         // Indexed Properties (expect null)
         for (int i = 0; i < validIndexProperties.length; i++) {
-            try {
-                label = "Indexed " + label(validIndexProperties[i], i);
-                assertEquals(null, resolver.getKey(validIndexProperties[i]), 
label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Indexed " + label(validIndexProperties[i], i);
+            assertEquals(null, resolver.getKey(validIndexProperties[i]), 
label);
         }
 
         // Mapped Properties (expect correct map key)
         for (int i = 0; i < validMapProperties.length; i++) {
-            try {
-                label = "Mapped " + label(validMapProperties[i], i);
-                assertEquals(validMapKeys[i], 
resolver.getKey(validMapProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Mapped " + label(validMapProperties[i], i);
+            assertEquals(validMapKeys[i], 
resolver.getKey(validMapProperties[i]), label);
         }
 
         // Malformed
         label = "Malformed";
-        try {
-            final String key = resolver.getKey("foo(bar");
-            fail(label + " expected IllegalArgumentException: " + key);
-        } catch (final IllegalArgumentException e) {
-            assertEquals("Missing End Delimiter", e.getMessage(), label + " 
Error Message");
-        } catch (final Throwable t) {
-            fail(label + " expected IllegalArgumentException: " + t);
-        }
+        IllegalArgumentException e = 
assertThrows(IllegalArgumentException.class, () -> resolver.getKey("foo(bar"));
+        assertEquals("Missing End Delimiter", e.getMessage(), label + " Error 
Message");
     }
 
     /**
@@ -197,32 +147,20 @@ public class DefaultResolverTestCase {
 
         // Simple Properties
         for (int i = 0; i < validProperties.length; i++) {
-            try {
-                label = "Simple " + label(validProperties[i], i);
-                assertEquals(validNames[i], 
resolver.getProperty(validProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Simple " + label(validProperties[i], i);
+            assertEquals(validNames[i], 
resolver.getProperty(validProperties[i]), label);
         }
 
         // Indexed Properties
         for (int i = 0; i < validIndexProperties.length; i++) {
-            try {
-                label = "Indexed " + label(validIndexProperties[i], i);
-                assertEquals(validIndexNames[i], 
resolver.getProperty(validIndexProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Indexed " + label(validIndexProperties[i], i);
+            assertEquals(validIndexNames[i], 
resolver.getProperty(validIndexProperties[i]), label);
         }
 
         // Mapped Properties
         for (int i = 0; i < validMapProperties.length; i++) {
-            try {
-                label = "Mapped " + label(validMapProperties[i], i);
-                assertEquals(validMapNames[i], 
resolver.getProperty(validMapProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Mapped " + label(validMapProperties[i], i);
+            assertEquals(validMapNames[i], 
resolver.getProperty(validMapProperties[i]), label);
         }
     }
 
@@ -235,32 +173,20 @@ public class DefaultResolverTestCase {
 
         // Simple Properties (expect -1)
         for (int i = 0; i < validProperties.length; i++) {
-            try {
-                label = "Simple " + label(validProperties[i], i);
-                assertFalse(resolver.isIndexed(validProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Simple " + label(validProperties[i], i);
+            assertFalse(resolver.isIndexed(validProperties[i]), label);
         }
 
         // Indexed Properties (expect correct index value)
         for (int i = 0; i < validIndexProperties.length; i++) {
-            try {
-                label = "Indexed " + label(validIndexProperties[i], i);
-                assertTrue(resolver.isIndexed(validIndexProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Indexed " + label(validIndexProperties[i], i);
+            assertTrue(resolver.isIndexed(validIndexProperties[i]), label);
         }
 
         // Mapped Properties (expect -1)
         for (int i = 0; i < validMapProperties.length; i++) {
-            try {
-                label = "Mapped " + label(validMapProperties[i], i);
-                assertFalse(resolver.isIndexed(validMapProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Mapped " + label(validMapProperties[i], i);
+            assertFalse(resolver.isIndexed(validMapProperties[i]), label);
         }
     }
 
@@ -273,32 +199,20 @@ public class DefaultResolverTestCase {
 
         // Simple Properties (expect null)
         for (int i = 0; i < validProperties.length; i++) {
-            try {
-                label = "Simple " + label(validProperties[i], i);
-                assertFalse(resolver.isMapped(validProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Simple " + label(validProperties[i], i);
+            assertFalse(resolver.isMapped(validProperties[i]), label);
         }
 
         // Indexed Properties (expect null)
         for (int i = 0; i < validIndexProperties.length; i++) {
-            try {
-                label = "Indexed " + label(validIndexProperties[i], i);
-                assertFalse(resolver.isMapped(validIndexProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Indexed " + label(validIndexProperties[i], i);
+            assertFalse(resolver.isMapped(validIndexProperties[i]), label);
         }
 
         // Mapped Properties (expect correct map key)
         for (int i = 0; i < validMapProperties.length; i++) {
-            try {
-                label = "Mapped " + label(validMapProperties[i], i);
-                assertTrue(resolver.isMapped(validMapProperties[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = "Mapped " + label(validMapProperties[i], i);
+            assertTrue(resolver.isMapped(validMapProperties[i]), label);
         }
     }
 
@@ -309,12 +223,8 @@ public class DefaultResolverTestCase {
     public void testNext() {
         String label = null;
         for (int i = 0; i < nextExpressions.length; i++) {
-            try {
-                label = label(nextExpressions[i], i);
-                assertEquals(nextProperties[i], 
resolver.next(nextExpressions[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = label(nextExpressions[i], i);
+            assertEquals(nextProperties[i], resolver.next(nextExpressions[i]), 
label);
         }
     }
 
@@ -325,12 +235,8 @@ public class DefaultResolverTestCase {
     public void testRemove() {
         String label = null;
         for (int i = 0; i < nextExpressions.length; i++) {
-            try {
-                label = label(nextExpressions[i], i);
-                assertEquals(removeProperties[i], 
resolver.remove(nextExpressions[i]), label);
-            } catch (final Throwable t) {
-                fail(label + " threw " + t);
-            }
+            label = label(nextExpressions[i], i);
+            assertEquals(removeProperties[i], 
resolver.remove(nextExpressions[i]), label);
         }
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/locale/LocaleBeanUtilsTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/locale/LocaleBeanUtilsTestCase.java
index b61b1031..e5be4333 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/locale/LocaleBeanUtilsTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/locale/LocaleBeanUtilsTestCase.java
@@ -17,7 +17,6 @@
 package org.apache.commons.beanutils2.locale;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import org.apache.commons.beanutils2.TestBean;
 import org.apache.commons.logging.Log;
@@ -35,16 +34,11 @@ public class LocaleBeanUtilsTestCase {
      * Test setting a nested indexed property
      */
     @Test
-    public void testSetNestedPropertyIndexed() {
+    public void testSetNestedPropertyIndexed() throws Exception {
         final TestBean bean = new TestBean();
         bean.getNested().setIntIndexed(1, 51);
         assertEquals(51, bean.getNested().getIntIndexed(1), "Initial value[1] 
51");
-        try {
-            LocaleBeanUtils.setProperty(bean, "nested.intIndexed[1]", "123", 
null);
-        } catch (final Throwable t) {
-            LOG.error(t);
-            fail("Threw " + t);
-        }
+        LocaleBeanUtils.setProperty(bean, "nested.intIndexed[1]", "123", null);
         assertEquals(123, bean.getNested().getIntIndexed(1), "Check Set 
Value");
     }
 
@@ -52,16 +46,11 @@ public class LocaleBeanUtilsTestCase {
      * Test setting a nested simple property
      */
     @Test
-    public void testSetNestedPropertySimple() {
+    public void testSetNestedPropertySimple() throws Exception {
         final TestBean bean = new TestBean();
         bean.getNested().setIntProperty(5);
         assertEquals(5, bean.getNested().getIntProperty(), "Initial value 5");
-        try {
-            LocaleBeanUtils.setProperty(bean, "nested.intProperty", "123", 
null);
-        } catch (final Throwable t) {
-            LOG.error(t);
-            fail("Threw " + t);
-        }
+        LocaleBeanUtils.setProperty(bean, "nested.intProperty", "123", null);
         assertEquals(123, bean.getNested().getIntProperty(), "Check Set 
Value");
     }
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/locale/LocaleBeanificationTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/locale/LocaleBeanificationTestCase.java
index df7124dd..3a90b778 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/locale/LocaleBeanificationTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/locale/LocaleBeanificationTestCase.java
@@ -18,10 +18,10 @@
 package org.apache.commons.beanutils2.locale;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
@@ -31,7 +31,6 @@ import java.util.WeakHashMap;
 
 import org.apache.commons.beanutils2.BeanUtilsBean;
 import org.apache.commons.beanutils2.ContextClassLoaderLocal;
-import org.apache.commons.beanutils2.ConversionException;
 import org.apache.commons.beanutils2.ConvertUtils;
 import org.apache.commons.beanutils2.PrimitiveBean;
 import org.apache.commons.beanutils2.locale.converters.LongLocaleConverter;
@@ -160,6 +159,7 @@ public class LocaleBeanificationTestCase {
     }
 
     /** Tests whether calls are independent for different class loaders */
+    @Test
     public void testContextClassloaderIndependence() throws Exception {
 
         final class TestIndependenceThread extends Thread {
@@ -234,6 +234,7 @@ public class LocaleBeanificationTestCase {
     /**
      * Tests whether difference instances are loaded by different context 
class loaders.
      */
+    @Test
     public void testContextClassLoaderLocal() throws Exception {
 
         final class CCLLTesterThread extends Thread {
@@ -278,6 +279,7 @@ public class LocaleBeanificationTestCase {
     }
 
     /** Tests whether the unset method works */
+    @Test
     public void testContextClassLoaderUnset() {
         final LocaleBeanUtilsBean beanOne = new LocaleBeanUtilsBean();
         final ContextClassLoaderLocal<LocaleBeanUtilsBean> ccll = new 
ContextClassLoaderLocal<>();
@@ -290,6 +292,7 @@ public class LocaleBeanificationTestCase {
     /**
      * Tests whether difference instances are loaded by different context 
class loaders.
      */
+    @Test
     public void testGetByContextClassLoader() throws Exception {
 
         final class GetBeanUtilsBeanThread extends Thread {
@@ -330,48 +333,37 @@ public class LocaleBeanificationTestCase {
     /**
      * Test registering a locale-aware converter with the standard 
ConvertUtils.
      */
+    @Test
     public void testLocaleAwareConverterInConvertUtils() {
         try {
             // first use the default non-locale-aware converter
-            try {
-                final Long data = (Long) ConvertUtils.convert("777", 
Long.class);
-                assertEquals(777, data.longValue(), "Standard format long 
converted ok");
-            } catch (final ConversionException ex) {
-                fail("Unable to convert non-locale-aware number 777");
-            }
+            Long data = (Long) ConvertUtils.convert("777", Long.class);
+            assertEquals(777, data.longValue(), "Standard format long 
converted ok");
 
             // now try default converter with special delimiters
-            try {
-                // This conversion will cause an error. But the default
-                // Long converter is set up to return a default value of
-                // zero on error.
-                final Long data = (Long) ConvertUtils.convert("1.000.000", 
Long.class);
-                assertEquals(0, data.longValue(), "Standard format behaved as 
expected");
-            } catch (final ConversionException ex) {
-                fail("Unexpected exception from standard Long converter.");
-            }
+            // This conversion will cause an error. But the default
+            // Long converter is set up to return a default value of
+            // zero on error.
+            data = (Long) ConvertUtils.convert("1.000.000", Long.class);
+            assertEquals(0, data.longValue(), "Standard format behaved as 
expected");
 
             // Now try using a locale-aware converter together with
             // locale-specific input string. Note that in the german locale,
             // large numbers can be split up into groups of three digits
             // using a dot character (and comma is the decimal-point 
indicator).
-            try {
-
-                final Locale germanLocale = Locale.GERMAN;
-                final LongLocaleConverter longLocaleConverter = 
LongLocaleConverter.builder().setLocale(germanLocale).get();
-                ConvertUtils.register(longLocaleConverter, Long.class);
+            final Locale germanLocale = Locale.GERMAN;
+            final LongLocaleConverter longLocaleConverter = 
LongLocaleConverter.builder().setLocale(germanLocale).get();
+            ConvertUtils.register(longLocaleConverter, Long.class);
 
-                final Long data = (Long) ConvertUtils.convert("1.000.000", 
Long.class);
-                assertEquals(1000000, data.longValue(), "German-format long 
converted ok");
-            } catch (final ConversionException ex) {
-                fail("Unable to convert german-format number");
-            }
+            data = (Long) ConvertUtils.convert("1.000.000", Long.class);
+            assertEquals(1000000, data.longValue(), "German-format long 
converted ok");
         } finally {
             ConvertUtils.deregister();
         }
     }
 
     /** Tests whether class loaders and beans are released from memory */
+    @Test
     public void testMemoryLeak() throws Exception {
         // many thanks to Juozas Baliuka for suggesting this methodology
         TestClassLoader loader = new TestClassLoader();
@@ -424,9 +416,8 @@ public class LocaleBeanificationTestCase {
         while (true) {
             LocaleBeanUtilsBean.getLocaleBeanUtilsInstance();
             System.gc();
-            if (iterations++ > MAX_GC_ITERATIONS) {
-                fail("Max iterations reached before resource released.");
-            }
+
+            assertFalse(iterations++ > MAX_GC_ITERATIONS, "Max iterations 
reached before resource released.");
 
             if (loaderReference.get() == null && beanUtilsReference.get() == 
null && convertUtilsReference.get() == null) {
                 break;
@@ -439,6 +430,7 @@ public class LocaleBeanificationTestCase {
     }
 
     /** Tests whether class loaders and beans are released from memory by the 
map used by BeanUtils */
+    @Test
     public void testMemoryLeak2() {
         // many thanks to Juozas Baliuka for suggesting this methodology
         TestClassLoader loader = new TestClassLoader();
@@ -463,9 +455,7 @@ public class LocaleBeanificationTestCase {
         int bytz = 2;
         while (true) {
             System.gc();
-            if (iterations++ > MAX_GC_ITERATIONS) {
-                fail("Max iterations reached before resource released.");
-            }
+            assertFalse(iterations++ > MAX_GC_ITERATIONS, "Max iterations 
reached before resource released.");
             map.isEmpty();
 
             if (loaderReference.get() == null && testReference.get() == null) {
@@ -479,6 +469,7 @@ public class LocaleBeanificationTestCase {
     }
 
     /** Test of the methodology we'll use for some of the later tests */
+    @Test
     public void testMemoryTestMethodology() throws Exception {
         // test methodology
         // many thanks to Juozas Baliuka for suggesting this method
@@ -497,9 +488,7 @@ public class LocaleBeanificationTestCase {
         int bytz = 2;
         while (true) {
             System.gc();
-            if (iterations++ > MAX_GC_ITERATIONS) {
-                fail("Max iterations reached before resource released.");
-            }
+            assertFalse(iterations++ > MAX_GC_ITERATIONS, "Max iterations 
reached before resource released.");
             if (reference.get() == null) {
                 break;
 
diff --git 
a/src/test/java/org/apache/commons/beanutils2/locale/LocaleConvertUtilsTestCase.java
 
b/src/test/java/org/apache/commons/beanutils2/locale/LocaleConvertUtilsTestCase.java
index 1e6372d0..e900d2a8 100644
--- 
a/src/test/java/org/apache/commons/beanutils2/locale/LocaleConvertUtilsTestCase.java
+++ 
b/src/test/java/org/apache/commons/beanutils2/locale/LocaleConvertUtilsTestCase.java
@@ -20,7 +20,7 @@ package org.apache.commons.beanutils2.locale;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.sql.Date;
 import java.sql.Time;
@@ -30,6 +30,7 @@ import java.text.NumberFormat;
 import org.apache.commons.beanutils2.ConversionException;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -68,10 +69,10 @@ public class LocaleConvertUtilsTestCase {
     /**
      * Negative String to primitive integer array tests.
      */
+    @Test
+    @Disabled("Array conversions not implemented yet.")
     public void fixmetestNegativeIntegerArray() {
 
-        fail("Array conversions not implemented yet.");
-
         Object value;
         final int[] intArray = {};
 
@@ -95,10 +96,10 @@ public class LocaleConvertUtilsTestCase {
     /**
      * Negative String to String array tests.
      */
+    @Test
+    @Disabled("Array conversions not implemented yet.")
     public void fixmetestNegativeStringArray() {
 
-        fail("Array conversions not implemented yet.");
-
         Object value;
         final String[] stringArray = {};
 
@@ -109,9 +110,10 @@ public class LocaleConvertUtilsTestCase {
     /**
      * Test conversion of object to string for arrays - .
      */
+    @Test
+    @Disabled("Array conversions not implemented yet.")
     public void fixmetestObjectToStringArray() {
 
-        fail("Array conversions not implemented yet.");
         final int[] intArray0 = {};
         final int[] intArray1 = { 123 };
         final int[] intArray2 = { 123, 456 };
@@ -132,10 +134,10 @@ public class LocaleConvertUtilsTestCase {
     /**
      * Positive array conversion tests.
      */
+    @Test
+    @Disabled("Array conversions not implemented yet.")
     public void fixmetestPositiveArray() {
 
-        fail("Array conversions not implemented yet.");
-
         final String[] values1 = { "10", "20", "30" };
         Object value = LocaleConvertUtils.convert(values1, Integer.TYPE);
         final int[] shape = {};
@@ -157,10 +159,10 @@ public class LocaleConvertUtilsTestCase {
     /**
      * Positive String to primitive integer array tests.
      */
+    @Test
+    @Disabled("Array conversions not implemented yet.")
     public void fixmetestPositiveIntegerArray() {
 
-        fail("Array conversions not implemented yet.");
-
         Object value;
         final int[] intArray = {};
         final int[] intArray1 = { 0 };
@@ -193,10 +195,10 @@ public class LocaleConvertUtilsTestCase {
     /**
      * Positive String to String array tests.
      */
+    @Test
+    @Disabled("Array conversions not implemented yet.")
     public void fixmetestPositiveStringArray() {
 
-        fail("Array conversions not implemented yet.");
-
         Object value;
         final String[] stringArray = {};
         final String[] stringArray1 = { "abc" };
@@ -268,13 +270,7 @@ public class LocaleConvertUtilsTestCase {
      */
     @Test
     public void testConvertStringArrayLocaleNull() {
-        Object result = null;
-        try {
-            result = LocaleConvertUtils.convert(new String[] { "123" }, 
Integer[].class, null, "#,###");
-        } catch (final Exception e) {
-            e.printStackTrace();
-            fail("Threw: " + e);
-        }
+        final Object result = LocaleConvertUtils.convert(new String[] { "123" 
}, Integer[].class, null, "#,###");
         assertNotNull(result, "Null Result");
         assertEquals(Integer[].class, result.getClass(), "Integer Array Type");
         assertEquals(1, ((Integer[]) result).length, "Integer Array Length");
@@ -286,13 +282,7 @@ public class LocaleConvertUtilsTestCase {
      */
     @Test
     public void testConvertStringLocaleNull() {
-        Object result = null;
-        try {
-            result = LocaleConvertUtils.convert("123", Integer.class, null, 
"#,###");
-        } catch (final Exception e) {
-            e.printStackTrace();
-            fail("Threw: " + e);
-        }
+        final Object result = LocaleConvertUtils.convert("123", Integer.class, 
null, "#,###");
         assertNotNull(result, "Null Result");
         assertEquals(Integer.class, result.getClass(), "Integer Type");
         assertEquals(Integer.valueOf(123), result, "Integer Value");
@@ -305,8 +295,7 @@ public class LocaleConvertUtilsTestCase {
     @Test
     public void testDefaultToStringConversionUnsupportedType() {
         final Integer value = 20131101;
-        assertEquals(value.toString(), 
LocaleConvertUtils.convert(value.toString(), getClass()),
-                                "Wrong result");
+        assertEquals(value.toString(), 
LocaleConvertUtils.convert(value.toString(), getClass()), "Wrong result");
     }
 
     /**
@@ -314,102 +303,27 @@ public class LocaleConvertUtilsTestCase {
      */
     @Test
     public void testNegativeScalar() {
-
         /*
          * fixme Boolean converters not implemented at this point value = 
LocaleConvertUtils.convert("foo", Boolean.TYPE); ...
          *
          * value = LocaleConvertUtils.convert("foo", Boolean.class); ...
          */
-
-        try {
-            LocaleConvertUtils.convert("foo", Byte.TYPE);
-            fail("Should have thrown conversion exception (1)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
-        try {
-            LocaleConvertUtils.convert("foo", Byte.class);
-            fail("Should have thrown conversion exception (2)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Byte.TYPE));
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Byte.class));
         /*
          * fixme - not implemented try { value = 
LocaleConvertUtils.convert("org.apache.commons.beanutils2.Undefined", 
Class.class);
          * fail("Should have thrown conversion exception"); } catch 
(ConversionException e) { ; // Expected result }
          */
-
-        try {
-            LocaleConvertUtils.convert("foo", Double.TYPE);
-            fail("Should have thrown conversion exception (3)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
-        try {
-            LocaleConvertUtils.convert("foo", Double.class);
-            fail("Should have thrown conversion exception (4)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
-        try {
-            LocaleConvertUtils.convert("foo", Float.TYPE);
-            fail("Should have thrown conversion exception (5)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
-        try {
-            LocaleConvertUtils.convert("foo", Float.class);
-            fail("Should have thrown conversion exception (6)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
-        try {
-            LocaleConvertUtils.convert("foo", Integer.TYPE);
-            fail("Should have thrown conversion exception (7)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
-        try {
-            LocaleConvertUtils.convert("foo", Integer.class);
-            fail("Should have thrown conversion exception (8)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
-        try {
-            LocaleConvertUtils.convert("foo", Byte.TYPE);
-            fail("Should have thrown conversion exception (9)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
-        try {
-            LocaleConvertUtils.convert("foo", Long.class);
-            fail("Should have thrown conversion exception (10)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
-        try {
-            LocaleConvertUtils.convert("foo", Short.TYPE);
-            fail("Should have thrown conversion exception (11)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
-        try {
-            LocaleConvertUtils.convert("foo", Short.class);
-            fail("Should have thrown conversion exception (12)");
-        } catch (final ConversionException e) {
-            // Expected result
-        }
-
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Double.TYPE));
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Double.class));
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Float.TYPE));
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Float.class));
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Integer.TYPE));
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Integer.class));
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Byte.TYPE));
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Long.class));
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Short.TYPE));
+        assertThrows(ConversionException.class, () -> 
LocaleConvertUtils.convert("foo", Short.class));
     }
 
     /**
@@ -422,10 +336,8 @@ public class LocaleConvertUtilsTestCase {
         assertEquals("true", LocaleConvertUtils.convert(Boolean.TRUE), 
"Boolean->String");
         assertEquals("123", LocaleConvertUtils.convert(Byte.valueOf((byte) 
123)), "Byte->String");
         assertEquals("a", LocaleConvertUtils.convert(Character.valueOf('a')), 
"Character->String");
-        assertEquals("123" + decimalSeparator + "4", 
LocaleConvertUtils.convert(Double.valueOf(123.4)),
-                                "Double->String");
-        assertEquals("123" + decimalSeparator + "4",
-                                
LocaleConvertUtils.convert(Float.valueOf((float) 123.4)), "Float->String");
+        assertEquals("123" + decimalSeparator + "4", 
LocaleConvertUtils.convert(Double.valueOf(123.4)), "Double->String");
+        assertEquals("123" + decimalSeparator + "4", 
LocaleConvertUtils.convert(Float.valueOf((float) 123.4)), "Float->String");
         assertEquals("123", LocaleConvertUtils.convert(Integer.valueOf(123)), 
"Integer->String");
         assertEquals("123", LocaleConvertUtils.convert(Long.valueOf(123)), 
"Long->String");
         assertEquals("123", LocaleConvertUtils.convert(Short.valueOf((short) 
123)), "Short->String");
@@ -448,9 +360,11 @@ public class LocaleConvertUtilsTestCase {
          * value = LocaleConvertUtils.convert("true", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
          * true);
          *
-         * value = LocaleConvertUtils.convert("yes", Boolean.TYPE); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(), true);
+         * value = LocaleConvertUtils.convert("yes", Boolean.TYPE); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
+         * true);
          *
-         * value = LocaleConvertUtils.convert("yes", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(), true);
+         * value = LocaleConvertUtils.convert("yes", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
+         * true);
          *
          * value = LocaleConvertUtils.convert("y", Boolean.TYPE); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(), true);
          *
@@ -458,7 +372,8 @@ public class LocaleConvertUtilsTestCase {
          *
          * value = LocaleConvertUtils.convert("on", Boolean.TYPE); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(), true);
          *
-         * value = LocaleConvertUtils.convert("on", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(), true);
+         * value = LocaleConvertUtils.convert("on", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
+         * true);
          *
          * value = LocaleConvertUtils.convert("false", Boolean.TYPE); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
          * false);
@@ -466,15 +381,19 @@ public class LocaleConvertUtilsTestCase {
          * value = LocaleConvertUtils.convert("false", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
          * false);
          *
-         * value = LocaleConvertUtils.convert("no", Boolean.TYPE); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(), false);
+         * value = LocaleConvertUtils.convert("no", Boolean.TYPE); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
+         * false);
          *
-         * value = LocaleConvertUtils.convert("no", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(), false);
+         * value = LocaleConvertUtils.convert("no", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
+         * false);
          *
          * value = LocaleConvertUtils.convert("n", Boolean.TYPE); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(), false);
          *
-         * value = LocaleConvertUtils.convert("n", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(), false);
+         * value = LocaleConvertUtils.convert("n", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
+         * false);
          *
-         * value = LocaleConvertUtils.convert("off", Boolean.TYPE); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(), false);
+         * value = LocaleConvertUtils.convert("off", Boolean.TYPE); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
+         * false);
          *
          * value = LocaleConvertUtils.convert("off", Boolean.class); 
assertInstanceOf(Boolean.class, value); assertEquals(((Boolean) 
value).booleanValue(),
          * false);
@@ -492,7 +411,8 @@ public class LocaleConvertUtilsTestCase {
          * fixme Character conversion not implemented yet value = 
LocaleConvertUtils.convert("a", Character.TYPE); 
assertInstanceOf(Character.class, value);
          * assertEquals(((Character) value).charValue(), 'a');
          *
-         * value = LocaleConvertUtils.convert("a", Character.class); 
assertInstanceOf(Character.class, value); assertEquals(((Character) 
value).charValue(), 'a');
+         * value = LocaleConvertUtils.convert("a", Character.class); 
assertInstanceOf(Character.class, value); assertEquals(((Character) 
value).charValue(),
+         * 'a');
          */
         /*
          * fixme - this is a discrepancy with standard converters ( probably 
not major issue ) value = LocaleConvertUtils.convert("java.lang.String",
@@ -535,7 +455,8 @@ public class LocaleConvertUtilsTestCase {
          * fixme - Short conversion not implemented at this point value = 
LocaleConvertUtils.convert("123", Short.TYPE); assertInstanceOf(Short.class, 
value);
          * assertEquals(((Short) value).shortValue(), (short) 123);
          *
-         * value = LocaleConvertUtils.convert("123", Short.class); 
assertInstanceOf(Short.class, value); assertEquals(((Short) 
value).shortValue(), (short) 123);
+         * value = LocaleConvertUtils.convert("123", Short.class); 
assertInstanceOf(Short.class, value); assertEquals(((Short) 
value).shortValue(), (short)
+         * 123);
          */
 
         String input;
diff --git 
a/src/test/java/org/apache/commons/beanutils2/sql/DynaResultSetTestCase.java 
b/src/test/java/org/apache/commons/beanutils2/sql/DynaResultSetTestCase.java
index 5f9f5c8b..90ef6f78 100644
--- a/src/test/java/org/apache/commons/beanutils2/sql/DynaResultSetTestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/sql/DynaResultSetTestCase.java
@@ -18,11 +18,11 @@
 package org.apache.commons.beanutils2.sql;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import java.math.BigDecimal;
 import java.util.Iterator;
@@ -54,9 +54,7 @@ public class DynaResultSetTestCase {
      */
     @BeforeEach
     public void setUp() throws Exception {
-
         dynaClass = new ResultSetDynaClass(TestResultSet.createProxy());
-
     }
 
     /**
@@ -64,9 +62,7 @@ public class DynaResultSetTestCase {
      */
     @AfterEach
     public void tearDown() {
-
         dynaClass = null;
-
     }
 
     @Test
@@ -97,8 +93,7 @@ public class DynaResultSetTestCase {
 
     @Test
     public void testGetName() {
-        assertEquals("org.apache.commons.beanutils2.sql.ResultSetDynaClass", 
dynaClass.getName(),
-                                "DynaClass name");
+        assertEquals("org.apache.commons.beanutils2.sql.ResultSetDynaClass", 
dynaClass.getName(), "DynaClass name");
     }
 
     @Test
@@ -110,9 +105,7 @@ public class DynaResultSetTestCase {
         while (rows.hasNext()) {
             rows.next();
             n++;
-            if (n > 10) {
-                fail("Returned too many rows");
-            }
+            assertFalse(n > 10);
         }
         assertEquals(5, n, "iterator rows");
 
@@ -128,20 +121,14 @@ public class DynaResultSetTestCase {
         final DynaBean row = rows.next();
 
         // Invalid argument test
-        try {
-            row.get("unknownProperty");
-            fail("Did not throw IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            // Expected result
-        }
+        assertThrows(IllegalArgumentException.class, () -> 
row.get("unknownProperty"));
 
         // Verify property values
 
         final Object bigDecimalProperty = row.get("bigdecimalproperty");
         assertNotNull(bigDecimalProperty, "bigDecimalProperty exists");
         assertInstanceOf(BigDecimal.class, bigDecimalProperty, 
"bigDecimalProperty type");
-        assertEquals(123.45, ((BigDecimal) bigDecimalProperty).doubleValue(), 
0.005,
-                                "bigDecimalProperty value");
+        assertEquals(123.45, ((BigDecimal) bigDecimalProperty).doubleValue(), 
0.005, "bigDecimalProperty value");
 
         final Object intProperty = row.get("intproperty");
         assertNotNull(intProperty, "intProperty exists");
@@ -162,13 +149,8 @@ public class DynaResultSetTestCase {
      * Test normal case column names (i.e. not converted to lower case)
      */
     @Test
-    public void testIteratorResultsNormalCase() {
-        ResultSetDynaClass dynaClass = null;
-        try {
-            dynaClass = new ResultSetDynaClass(TestResultSet.createProxy(), 
false);
-        } catch (final Exception e) {
-            fail("Error creating ResultSetDynaClass: " + e);
-        }
+    public void testIteratorResultsNormalCase() throws Exception {
+        ResultSetDynaClass dynaClass = new 
ResultSetDynaClass(TestResultSet.createProxy(), false);
 
         // Grab the third row
         final Iterator<DynaBean> rows = dynaClass.iterator();
@@ -177,20 +159,14 @@ public class DynaResultSetTestCase {
         final DynaBean row = rows.next();
 
         // Invalid argument test
-        try {
-            row.get("unknownProperty");
-            fail("Did not throw IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            // Expected result
-        }
+        assertThrows(IllegalArgumentException.class, () -> 
row.get("unknownProperty"));
 
         // Verify property values
 
         final Object bigDecimalProperty = row.get("bigDecimalProperty");
         assertNotNull(bigDecimalProperty, "bigDecimalProperty exists");
         assertInstanceOf(BigDecimal.class, bigDecimalProperty, 
"bigDecimalProperty type");
-        assertEquals(123.45, ((BigDecimal) bigDecimalProperty).doubleValue(), 
0.005,
-                                "bigDecimalProperty value");
+        assertEquals(123.45, ((BigDecimal) bigDecimalProperty).doubleValue(), 
0.005, "bigDecimalProperty value");
 
         final Object intProperty = row.get("intProperty");
         assertNotNull(intProperty, "intProperty exists");
@@ -209,16 +185,7 @@ public class DynaResultSetTestCase {
 
     @Test
     public void testNewInstance() {
-
-        try {
-            dynaClass.newInstance();
-            fail("Did not throw UnsupportedOperationException()");
-        } catch (final UnsupportedOperationException e) {
-            // Expected result
-        } catch (final Exception e) {
-            fail("Threw exception " + e);
-        }
-
+        assertThrows(UnsupportedOperationException.class, () -> 
dynaClass.newInstance());
     }
 
 }
diff --git 
a/src/test/java/org/apache/commons/beanutils2/sql/DynaRowSetTestCase.java 
b/src/test/java/org/apache/commons/beanutils2/sql/DynaRowSetTestCase.java
index 12909f4b..f12f73a0 100644
--- a/src/test/java/org/apache/commons/beanutils2/sql/DynaRowSetTestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/sql/DynaRowSetTestCase.java
@@ -22,7 +22,6 @@ import static 
org.junit.jupiter.api.Assertions.assertInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import java.math.BigDecimal;
 import java.sql.Date;
@@ -166,8 +165,7 @@ public class DynaRowSetTestCase {
 
     @Test
     public void testGetName() {
-        assertEquals("org.apache.commons.beanutils2.sql.RowSetDynaClass", 
dynaClass.getName(),
-                                "DynaClass name");
+        assertEquals("org.apache.commons.beanutils2.sql.RowSetDynaClass", 
dynaClass.getName(), "DynaClass name");
     }
 
     /**
@@ -194,11 +192,9 @@ public class DynaRowSetTestCase {
         // Timestamp column class returns a custom Timestamp impl for the 
column class name and ResultSet getObject
         final int timestampColIdx = 13;
         assertEquals("timestampProperty", 
metaData.getColumnName(timestampColIdx), "Timestamp Meta Name");
-        assertEquals(CustomTimestamp.class.getName(), 
metaData.getColumnClassName(timestampColIdx),
-                                "Timestamp Meta Class");
+        assertEquals(CustomTimestamp.class.getName(), 
metaData.getColumnClassName(timestampColIdx), "Timestamp Meta Class");
         assertEquals(Types.TIMESTAMP, metaData.getColumnType(timestampColIdx), 
"Timestamp Meta Type");
-        assertEquals(CustomTimestamp.class, 
resultSet.getObject("timestampProperty").getClass(),
-                                "Timestamp ResultSet Value");
+        assertEquals(CustomTimestamp.class, 
resultSet.getObject("timestampProperty").getClass(), "Timestamp ResultSet 
Value");
 
         final RowSetDynaClass inconsistentDynaClass = new 
RowSetDynaClass(resultSet);
         final DynaBean firstRow = inconsistentDynaClass.getRows().get(0);
@@ -246,20 +242,14 @@ public class DynaRowSetTestCase {
         final DynaBean row = rows.get(2);
 
         // Invalid argument test
-        try {
-            row.get("unknownProperty");
-            fail("Did not throw IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            // Expected result
-        }
+        assertThrows(IllegalArgumentException.class, () -> 
row.get("unknownProperty"));
 
         // Verify property values
 
         final Object bigDecimalProperty = row.get("bigdecimalproperty");
         assertNotNull(bigDecimalProperty, "bigDecimalProperty exists");
         assertInstanceOf(BigDecimal.class, bigDecimalProperty, 
"bigDecimalProperty type");
-        assertEquals(123.45, ((BigDecimal) bigDecimalProperty).doubleValue(), 
0.005,
-                                "bigDecimalProperty value");
+        assertEquals(123.45, ((BigDecimal) bigDecimalProperty).doubleValue(), 
0.005, "bigDecimalProperty value");
 
         final Object intProperty = row.get("intproperty");
         assertNotNull(intProperty, "intProperty exists");
@@ -280,33 +270,22 @@ public class DynaRowSetTestCase {
      * Test normal case column names (i.e. not converted to lower case)
      */
     @Test
-    public void testListResultsNormalCase() {
-        RowSetDynaClass dynaClass = null;
-        try {
-            dynaClass = new RowSetDynaClass(TestResultSet.createProxy(), 
false);
-        } catch (final Exception e) {
-            fail("Error creating RowSetDynaClass: " + e);
-        }
+    public void testListResultsNormalCase() throws Exception {
+        final RowSetDynaClass dynaClass = new 
RowSetDynaClass(TestResultSet.createProxy(), false);
 
         // Grab the third row
         final List<DynaBean> rows = dynaClass.getRows();
         final DynaBean row = rows.get(2);
 
         // Invalid argument test
-        try {
-            row.get("unknownProperty");
-            fail("Did not throw IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            // Expected result
-        }
+        assertThrows(IllegalArgumentException.class, () -> 
row.get("unknownProperty"));
 
         // Verify property values
 
         final Object bigDecimalProperty = row.get("bigDecimalProperty");
         assertNotNull(bigDecimalProperty, "bigDecimalProperty exists");
         assertInstanceOf(BigDecimal.class, bigDecimalProperty, 
"bigDecimalProperty type");
-        assertEquals(123.45, ((BigDecimal) bigDecimalProperty).doubleValue(), 
0.005,
-                                "bigDecimalProperty value");
+        assertEquals(123.45, ((BigDecimal) bigDecimalProperty).doubleValue(), 
0.005, "bigDecimalProperty value");
 
         final Object intProperty = row.get("intProperty");
         assertNotNull(intProperty, "intProperty exists");
@@ -325,15 +304,6 @@ public class DynaRowSetTestCase {
 
     @Test
     public void testNewInstance() {
-
-        try {
-            dynaClass.newInstance();
-            fail("Did not throw UnsupportedOperationException()");
-        } catch (final UnsupportedOperationException e) {
-            // Expected result
-        } catch (final Exception e) {
-            fail("Threw exception " + e);
-        }
-
+        assertThrows(UnsupportedOperationException.class, () -> 
dynaClass.newInstance());
     }
 }

Reply via email to