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

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 7087776  Remove duplicate methods in ThrowableUtils.
7087776 is described below

commit 7087776ca66fbca1cb574228737f229a9b7c15d5
Author: JamesBognar <[email protected]>
AuthorDate: Mon Mar 8 14:15:45 2021 -0500

    Remove duplicate methods in ThrowableUtils.
---
 .../main/java/org/apache/juneau/config/Config.java |  24 ++---
 .../main/java/org/apache/juneau/BeanSession.java   |   7 +-
 .../org/apache/juneau/internal/ArrayUtils.java     |   9 +-
 .../java/org/apache/juneau/internal/FileUtils.java |   6 +-
 .../org/apache/juneau/internal/FilteredMap.java    |   7 +-
 .../org/apache/juneau/internal/MultiIterable.java  |   5 +-
 .../java/org/apache/juneau/internal/MultiSet.java  |   5 +-
 .../java/org/apache/juneau/internal/SimpleMap.java |   5 +-
 .../org/apache/juneau/internal/StringUtils.java    |   5 +-
 .../org/apache/juneau/internal/ThrowableUtils.java | 100 ---------------------
 .../java/org/apache/juneau/ComboRoundTripTest.java |  18 ++--
 .../java/org/apache/juneau/ComboSerializeTest.java |   5 +-
 .../java/org/apache/juneau/config/ConfigTest.java  |  18 ++--
 13 files changed, 55 insertions(+), 159 deletions(-)

diff --git 
a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java 
b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java
index 5664d42..b206060 100644
--- 
a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java
+++ 
b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java
@@ -12,9 +12,9 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.config;
 
+import static org.apache.juneau.assertions.Assertions.*;
 import static org.apache.juneau.config.ConfigMod.*;
 import static org.apache.juneau.internal.StringUtils.*;
-import static org.apache.juneau.internal.ThrowableUtils.*;
 import static org.apache.juneau.internal.IOUtils.*;
 
 import java.beans.*;
@@ -572,7 +572,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
         */
        public Config set(String key, String value) {
                checkWrite();
-               assertFieldNotNull(key, "key");
+               assertArgNotNull("key", key);
                String sname = sname(key);
                String skey = skey(key);
 
@@ -679,7 +679,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
         */
        public Config set(String key, Object value, Serializer serializer, 
ConfigMod[] modifiers, String comment, List<String> preLines) throws 
SerializeException {
                checkWrite();
-               assertFieldNotNull(key, "key");
+               assertArgNotNull("key", key);
                String sname = sname(key);
                String skey = skey(key);
 
@@ -1117,7 +1117,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
         * @return The value, or <jk>null</jk> if the section or key does not 
exist.
         */
        public <T> T getObject(String key, Parser parser, Type type, 
Type...args) throws ParseException {
-               assertFieldNotNull(type, "type");
+               assertArgNotNull("type", type);
                return parse(getString(key), parser, type, args);
        }
 
@@ -1172,7 +1172,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
         * @see BeanSession#getClassMeta(Type,Type...) for argument syntax for 
maps and collections.
         */
        public <T> T getObject(String key, Parser parser, Class<T> type) throws 
ParseException {
-               assertFieldNotNull(type, "c");
+               assertArgNotNull("c", type);
                return parse(getString(key), parser, type);
        }
 
@@ -1206,7 +1206,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
         * @return The value, or <jk>null</jk> if the section or key does not 
exist.
         */
        public <T> T getObjectWithDefault(String key, Parser parser, T def, 
Class<T> type) throws ParseException {
-               assertFieldNotNull(type, "c");
+               assertArgNotNull("type", type);
                T t = parse(getString(key), parser, type);
                return (t == null ? def : t);
        }
@@ -1253,7 +1253,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
         * @return The value, or <jk>null</jk> if the section or key does not 
exist.
         */
        public <T> T getObjectWithDefault(String key, Parser parser, T def, 
Type type, Type...args) throws ParseException {
-               assertFieldNotNull(type, "type");
+               assertArgNotNull("type", type);
                T t = parse(getString(key), parser, type, args);
                return (t == null ? def : t);
        }
@@ -1335,7 +1335,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
         */
        public Config writeProperties(String section, Object bean, boolean 
ignoreUnknownProperties) throws ParseException {
                checkWrite();
-               assertFieldNotNull(bean, "bean");
+               assertArgNotNull("bean", bean);
                section = section(section);
 
                Set<String> keys = configMap.getKeys(section);
@@ -1414,7 +1414,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
         * @throws ParseException Unknown property was encountered in section.
         */
        public <T> T getSectionAsBean(String section, Class<T> c, boolean 
ignoreUnknownProperties) throws ParseException {
-               assertFieldNotNull(c, "c");
+               assertArgNotNull("c", c);
                section = section(section);
 
                if (! configMap.hasSection(section))
@@ -1534,7 +1534,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
         */
        @SuppressWarnings("unchecked")
        public <T> T getSectionAsInterface(String section, final Class<T> c) {
-               assertFieldNotNull(c, "c");
+               assertArgNotNull("c", c);
                final String section2 = section(section);
 
                if (! c.isInterface())
@@ -1958,7 +1958,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
        }
 
        private String sname(String key) {
-               assertFieldNotNull(key, "key");
+               assertArgNotNull("key", key);
                int i = key.indexOf('/');
                if (i == -1)
                        return "";
@@ -1973,7 +1973,7 @@ public final class Config extends Context implements 
ConfigEventListener, Writab
        }
 
        private String section(String section) {
-               assertFieldNotNull(section, "section");
+               assertArgNotNull("section", section);
                if (isEmpty(section))
                        return "";
                return section;
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
index 30c12f1..88ab2be 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
@@ -14,6 +14,7 @@ package org.apache.juneau;
 
 import static org.apache.juneau.internal.StringUtils.*;
 import static org.apache.juneau.internal.ThrowableUtils.*;
+import static org.apache.juneau.assertions.Assertions.*;
 import static org.apache.juneau.internal.IOUtils.*;
 
 import java.io.*;
@@ -829,8 +830,8 @@ public class BeanSession extends Session {
         * class.
         */
        public final <T> BeanMap<T> toBeanMap(T o, Class<? super T> c) throws 
BeanRuntimeException {
-               assertFieldNotNull(o, "o");
-               assertFieldNotNull(c, "c");
+               assertArgNotNull("o", o);
+               assertArgNotNull("c", c);
 
                if (! c.isInstance(o))
                        illegalArg("The specified object is not an instance of 
the specified class.  class=''{0}'', objectClass=''{1}'', object=''{2}''", 
c.getName(), o.getClass().getName(), 0);
@@ -1014,7 +1015,7 @@ public class BeanSession extends Session {
         * @return The args {@link ClassMeta} object corresponding to the 
classes.  Never <jk>null</jk>.
         */
        protected final ClassMeta<Object[]> getArgsClassMeta(Type[] classes) {
-               assertFieldNotNull(classes, "classes");
+               assertArgNotNull("classes", classes);
                ClassMeta[] cm = new ClassMeta<?>[classes.length];
                for (int i = 0; i < classes.length; i++)
                        cm[i] = getClassMeta(classes[i]);
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ArrayUtils.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ArrayUtils.java
index 814cfca..b540959 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ArrayUtils.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ArrayUtils.java
@@ -12,9 +12,8 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.internal;
 
+import static org.apache.juneau.assertions.Assertions.*;
 import static org.apache.juneau.internal.StringUtils.*;
-import static org.apache.juneau.internal.ThrowableUtils.*;
-
 import java.lang.reflect.*;
 import java.util.*;
 
@@ -57,7 +56,7 @@ public final class ArrayUtils {
         */
        @SuppressWarnings("unchecked")
        public static <T> T[] append(T[] array, Collection<T> newElements) {
-               assertFieldNotNull(array, "array");
+               assertArgNotNull("array", array);
                if (newElements.size() == 0)
                        return array;
                T[] a = 
(T[])Array.newInstance(array.getClass().getComponentType(), array.length + 
newElements.size());
@@ -77,7 +76,7 @@ public final class ArrayUtils {
         */
        @SuppressWarnings("unchecked")
        public static <T> T[] combine(T[]...arrays) {
-               assertFieldNotNull(arrays, "arrays");
+               assertArgNotNull("arrays", arrays);
                int l = 0;
                T[] a1 = null;
                for (T[] a : arrays) {
@@ -143,7 +142,7 @@ public final class ArrayUtils {
         * @return The new set.
         */
        public static <T> Set<T> asSet(final T[] array) {
-               assertFieldNotNull(array, "array");
+               assertArgNotNull("array", array);
                return new AbstractSet<T>() {
 
                        @Override /* Set */
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FileUtils.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FileUtils.java
index 0fdc2dc..6e432bc 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FileUtils.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FileUtils.java
@@ -12,7 +12,7 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.internal;
 
-import static org.apache.juneau.internal.ThrowableUtils.*;
+import static org.apache.juneau.assertions.Assertions.*;
 import static org.apache.juneau.internal.StringUtils.*;
 
 import java.io.*;
@@ -34,7 +34,7 @@ public class FileUtils {
         * @throws RuntimeException if directory could not be created.
         */
        public static File mkdirs(File f, boolean clean) {
-               assertFieldNotNull(f, "f");
+               assertArgNotNull("f", f);
                if (f.exists()) {
                        if (clean) {
                                if (! delete(f))
@@ -56,7 +56,7 @@ public class FileUtils {
         * @return The directory.
         */
        public static File mkdirs(String path, boolean clean) {
-               assertFieldNotNull(path, "path");
+               assertArgNotNull("path", path);
                return mkdirs(new File(path), clean);
        }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FilteredMap.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FilteredMap.java
index f0845e1..8240995 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FilteredMap.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FilteredMap.java
@@ -12,8 +12,7 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.internal;
 
-import static org.apache.juneau.internal.ThrowableUtils.*;
-
+import static org.apache.juneau.assertions.Assertions.*;
 import java.util.*;
 
 import org.apache.juneau.*;
@@ -38,8 +37,8 @@ public final class FilteredMap<K,V> extends AbstractMap<K,V> 
implements Delegate
         * @param keys The keys in the new map.  Must not be <jk>null</jk>.
         */
        public FilteredMap(ClassMeta<Map<K,V>> classMeta, Map<K,V> innerMap, 
K[] keys) {
-               assertFieldNotNull(innerMap, "innerMap");
-               assertFieldNotNull(keys, "keys");
+               assertArgNotNull("innerMap", innerMap);
+               assertArgNotNull("keys", keys);
 
                this.classMeta = classMeta;
                this.innerMap = innerMap;
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MultiIterable.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MultiIterable.java
index c283076..d3a70f1 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MultiIterable.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MultiIterable.java
@@ -12,8 +12,7 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.internal;
 
-import static org.apache.juneau.internal.ThrowableUtils.*;
-
+import static org.apache.juneau.assertions.Assertions.*;
 import java.util.*;
 
 /**
@@ -43,7 +42,7 @@ public class MultiIterable<E> implements Iterable<E> {
         * @return This object (for method chaining).
         */
        public MultiIterable<E> append(Iterator<E> iterator) {
-               assertFieldNotNull(iterator, "iterator");
+               assertArgNotNull("iterator", iterator);
                this.iterators.add(iterator);
                return this;
        }
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MultiSet.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MultiSet.java
index 1da34a2..f184156 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MultiSet.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/MultiSet.java
@@ -12,8 +12,7 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.internal;
 
-import static org.apache.juneau.internal.ThrowableUtils.*;
-
+import static org.apache.juneau.assertions.Assertions.*;
 import java.util.*;
 
 /**
@@ -44,7 +43,7 @@ public class MultiSet<E> extends AbstractSet<E> {
         * @return This object (for method chaining).
         */
        public MultiSet<E> append(Collection<E> c) {
-               assertFieldNotNull(c, "c");
+               assertArgNotNull("c", c);
                l.add(c);
                return this;
        }
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/SimpleMap.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/SimpleMap.java
index ee09132..f08ba1c 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/SimpleMap.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/SimpleMap.java
@@ -12,6 +12,7 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.internal;
 
+import static org.apache.juneau.assertions.Assertions.*;
 import static org.apache.juneau.internal.ArrayUtils.*;
 import static org.apache.juneau.internal.ThrowableUtils.*;
 
@@ -49,8 +50,8 @@ public final class SimpleMap<K,V> extends AbstractMap<K,V> {
         */
        @SuppressWarnings("unchecked")
        public SimpleMap(K[] keys, V[] values) {
-               assertFieldNotNull(keys, "keys");
-               assertFieldNotNull(values, "values");
+               assertArgNotNull("keys", keys);
+               assertArgNotNull("values", values);
                if (keys.length != values.length)
                        illegalArg("keys ''{0}'' and values ''{1}'' array 
lengths differ", keys.length, values.length);
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
index 9e035fa..3bbeaa2 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
@@ -12,6 +12,7 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.internal;
 
+import static org.apache.juneau.assertions.Assertions.*;
 import static org.apache.juneau.internal.IOUtils.*;
 import static org.apache.juneau.internal.ThrowableUtils.*;
 
@@ -2471,7 +2472,7 @@ public final class StringUtils {
         * @return The parsed value.
         */
        public static int parseIntWithSuffix(String s) {
-               assertFieldNotNull(s, "s");
+               assertArgNotNull("s", s);
                int m = 1;
                if (s.endsWith("G")) {
                        m = 1024*1024*1024;
@@ -2501,7 +2502,7 @@ public final class StringUtils {
         * @return The parsed value.
         */
        public static long parseLongWithSuffix(String s) {
-               assertFieldNotNull(s, "s");
+               assertArgNotNull("s", s);
                int m = 1;
                if (s.endsWith("G")) {
                        m = 1024*1024*1024;
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ThrowableUtils.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ThrowableUtils.java
index 227c8f3..836eadd 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ThrowableUtils.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ThrowableUtils.java
@@ -15,7 +15,6 @@ package org.apache.juneau.internal;
 import java.text.*;
 
 import org.apache.juneau.*;
-import org.apache.juneau.reflect.*;
 
 /**
  * Various utility methods for creating and working with throwables.
@@ -23,43 +22,6 @@ import org.apache.juneau.reflect.*;
 public class ThrowableUtils {
 
        /**
-        * Throws an {@link IllegalArgumentException} if the specified object 
is <jk>null</jk>.
-        *
-        * @param o The object to check.
-        * @param msg The message of the IllegalArgumentException.
-        * @param args Optional {@link MessageFormat}-style arguments.
-        * @throws IllegalArgumentException Constructed exception.
-        */
-       public static void assertNotNull(Object o, String msg, Object...args) 
throws IllegalArgumentException {
-               if (o == null)
-                       throw new BasicIllegalArgumentException(msg, args);
-       }
-
-       /**
-        * Throws an {@link IllegalArgumentException} if the specified field is 
<jk>null</jk>.
-        *
-        * @param fieldValue The object to check.
-        * @param fieldName The name of the field.
-        * @throws IllegalArgumentException Constructed exception.
-        */
-       public static void assertFieldNotNull(Object fieldValue, String 
fieldName) throws IllegalArgumentException {
-               if (fieldValue == null)
-                       throw new IllegalArgumentException("Field 
'"+fieldName+"' cannot be null.");
-       }
-
-       /**
-        * Throws an {@link IllegalArgumentException} if the specified field is 
<c>&lt;=0</c>.
-        *
-        * @param fieldValue The object to check.
-        * @param fieldName The name of the field.
-        * @throws IllegalArgumentException Constructed exception.
-        */
-       public static void assertFieldPositive(int fieldValue, String 
fieldName) throws IllegalArgumentException {
-               if (fieldValue <= 0)
-                       throw new IllegalArgumentException("Field 
'"+fieldName+"' must be a positive integer.");
-       }
-
-       /**
         * Shortcut for calling <code><jk>new</jk> 
IllegalArgumentException(MessageFormat.<jsm>format</jsm>(msg, args));</code>
         *
         * @param msg The message of the IllegalArgumentException.
@@ -71,37 +33,6 @@ public class ThrowableUtils {
        }
 
        /**
-        * Throws an exception if the specified thread ID is not the same as 
the current thread.
-        *
-        * @param threadId The ID of the thread to compare against.
-        * @param msg The message of the IllegalStateException.
-        * @param args Optional {@link MessageFormat}-style arguments.
-        * @throws IllegalStateException Constructed exception.
-        */
-       public static void assertSameThread(long threadId, String msg, 
Object...args) throws IllegalStateException {
-               if (Thread.currentThread().getId() != threadId)
-                       throw new BasicIllegalArgumentException(msg, args);
-       }
-
-       /**
-        * Throws an assertion error if the specified throwable or throwable 
causes do not contain the specified message string.
-        *
-        * @param t The throwable to check.
-        * @param msg The message text to check for.
-        * @throws AssertionError Assertion failed.
-        */
-       public static void assertExceptionContainsMessage(Throwable t, String 
msg) throws AssertionError {
-               Throwable t2 = t;
-               while (t2 != null) {
-                       if (t2.getMessage() != null && 
t2.getMessage().contains(msg))
-                               return;
-                       t2 = t2.getCause();
-               }
-               t.printStackTrace();
-               throw new BasicAssertionError(t, "Throwable did not contain the 
expected message.  Message=[{0}]", msg);
-       }
-
-       /**
         * Same as {@link Throwable#getCause()} but searches the throwable 
chain for an exception of the specified type.
         *
         * @param c The throwable type to search for.
@@ -118,35 +49,4 @@ public class ThrowableUtils {
                }
                return null;
        }
-
-       /**
-        * Given a list of available throwable types, attempts to create and 
throw the exception based on name.
-        *
-        * @param name The exception name.  Can be a simple name or 
fully-qualified.
-        * @param message The exception message passed to the exception 
constructor.
-        * @param throwables The list of available throwable classes to choose 
from.
-        * @throws Throwable The thrown exception if it was possible to create.
-        */
-       public static void throwException(String name, String message, 
Class<?>...throwables) throws Throwable {
-               if (name != null)
-                       for (Class<?> t : throwables)
-                               if (t.getName().endsWith(name))
-                                       doThrow(t, message);
-       }
-
-       private static void doThrow(Class<?> t, String msg) throws Throwable {
-               ConstructorInfo c = null;
-               ClassInfo ci = ClassInfo.of(t);
-               if (msg != null) {
-                       c = ci.getPublicConstructor(String.class);
-                       if (c != null)
-                               throw c.<Throwable>invoke(msg);
-                       c = ci.getPublicConstructor(Object.class);
-                       if (c != null)
-                               throw c.<Throwable>invoke(msg);
-               }
-               c = ci.getPublicConstructor();
-               if (c != null)
-                       throw c.<Throwable>invoke();
-       }
 }
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/ComboRoundTripTest.java 
b/juneau-utest/src/test/java/org/apache/juneau/ComboRoundTripTest.java
index ac46362..d20092c 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/ComboRoundTripTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/ComboRoundTripTest.java
@@ -15,8 +15,6 @@ package org.apache.juneau;
 import static org.junit.Assert.*;
 import static org.junit.runners.MethodSorters.*;
 import static org.apache.juneau.assertions.Assertions.*;
-import static org.apache.juneau.internal.ThrowableUtils.*;
-
 import java.lang.reflect.*;
 import java.util.*;
 
@@ -123,14 +121,14 @@ public abstract class ComboRoundTripTest {
                } catch (AssertionError e) {
                        if (comboInput.exceptionMsg == null)
                                throw e;
-                       assertExceptionContainsMessage(e, 
comboInput.exceptionMsg);
+                       assertThrowable(e).contains(comboInput.exceptionMsg);
                } catch (Exception e) {
                        if (comboInput.exceptionMsg == null) {
                                e.printStackTrace();
                                throw new AssertionError(comboInput.label + "/" 
+ testName + " failed.  exception=" + e.getLocalizedMessage());
 
                        }
-                       assertExceptionContainsMessage(e, 
comboInput.exceptionMsg);
+                       assertThrowable(e).contains(comboInput.exceptionMsg);
                }
        }
 
@@ -167,13 +165,13 @@ public abstract class ComboRoundTripTest {
                } catch (AssertionError e) {
                        if (comboInput.exceptionMsg == null)
                                throw e;
-                       assertExceptionContainsMessage(e, 
comboInput.exceptionMsg);
+                       assertThrowable(e).contains(comboInput.exceptionMsg);
                } catch (Throwable e) {
                        if (comboInput.exceptionMsg == null) {
                                e.printStackTrace();
                                throw new AssertionError(comboInput.label + "/" 
+ testName + " failed.  exception=" + e.getLocalizedMessage());
                        }
-                       assertExceptionContainsMessage(e, 
comboInput.exceptionMsg);
+                       assertThrowable(e).contains(comboInput.exceptionMsg);
                }
        }
 
@@ -198,13 +196,13 @@ public abstract class ComboRoundTripTest {
                } catch (AssertionError e) {
                        if (comboInput.exceptionMsg == null)
                                throw e;
-                       assertExceptionContainsMessage(e, 
comboInput.exceptionMsg);
+                       assertThrowable(e).contains(comboInput.exceptionMsg);
                } catch (Exception e) {
                        if (comboInput.exceptionMsg == null) {
                                e.printStackTrace();
                                throw new AssertionError(comboInput.label + "/" 
+ testName + " failed.  exception=" + e.getLocalizedMessage());
                        }
-                       assertExceptionContainsMessage(e, 
comboInput.exceptionMsg);
+                       assertThrowable(e).contains(comboInput.exceptionMsg);
                }
        }
 
@@ -229,13 +227,13 @@ public abstract class ComboRoundTripTest {
                } catch (AssertionError e) {
                        if (comboInput.exceptionMsg == null)
                                throw e;
-                       assertExceptionContainsMessage(e, 
comboInput.exceptionMsg);
+                       assertThrowable(e).contains(comboInput.exceptionMsg);
                } catch (Exception e) {
                        if (comboInput.exceptionMsg == null) {
                                e.printStackTrace();
                                throw new AssertionError(comboInput.label + "/" 
+ testName + " failed.  exception=" + e.getLocalizedMessage());
                        }
-                       assertExceptionContainsMessage(e, 
comboInput.exceptionMsg);
+                       assertThrowable(e).contains(comboInput.exceptionMsg);
                }
        }
 
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/ComboSerializeTest.java 
b/juneau-utest/src/test/java/org/apache/juneau/ComboSerializeTest.java
index baf857e..bed081a 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/ComboSerializeTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/ComboSerializeTest.java
@@ -13,7 +13,6 @@
 package org.apache.juneau;
 
 import static org.apache.juneau.assertions.Assertions.*;
-import static org.apache.juneau.internal.ThrowableUtils.*;
 import static org.junit.runners.MethodSorters.*;
 
 import java.util.*;
@@ -103,13 +102,13 @@ public abstract class ComboSerializeTest {
                } catch (AssertionError e) {
                        if (comboInput.exceptionMsg == null)
                                throw e;
-                       assertExceptionContainsMessage(e, 
comboInput.exceptionMsg);
+                       assertThrowable(e).contains(comboInput.exceptionMsg);
                } catch (Exception e) {
                        if (comboInput.exceptionMsg == null) {
                                e.printStackTrace();
                                throw new AssertionError(comboInput.label + "/" 
+ testName + " failed.  exception=" + e.getLocalizedMessage());
                        }
-                       assertExceptionContainsMessage(e, 
comboInput.exceptionMsg);
+                       assertThrowable(e).contains(comboInput.exceptionMsg);
                }
        }
 
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/config/ConfigTest.java 
b/juneau-utest/src/test/java/org/apache/juneau/config/ConfigTest.java
index 786a4bf..052bdcc 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/config/ConfigTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/config/ConfigTest.java
@@ -52,7 +52,7 @@ public class ConfigTest {
                assertNull(c.get("b"));
                assertNull(c.get("S/c"));
                assertNull(c.get("T/d"));
-               assertThrown(()->c.get(null)).is("Field 'key' cannot be null.");
+               assertThrown(()->c.get(null)).is("Argument 'key' cannot be 
null");
                c.close();
        }
 
@@ -800,7 +800,7 @@ public class ConfigTest {
                assertObject(c.getKeys("S")).asJson().is("['b1','b2']");
                assertTrue(c.getKeys("T").isEmpty());
 
-               assertThrown(()->c.getKeys(null)).is("Field 'section' cannot be 
null.");
+               assertThrown(()->c.getKeys(null)).is("Argument 'section' cannot 
be null");
        }
 
        
//====================================================================================================
@@ -823,7 +823,7 @@ public class ConfigTest {
                c.writeProperties("", a, true);
                assertObject(a).asJson().is("{foo:'qux'}");
 
-               assertThrown(()->c.writeProperties(null, a, true)).is("Field 
'section' cannot be null.");
+               assertThrown(()->c.writeProperties(null, a, true)).is("Argument 
'section' cannot be null");
        }
 
        
//====================================================================================================
@@ -852,8 +852,8 @@ public class ConfigTest {
 
                assertThrown(()->c.getSectionAsBean("T", 
ABean.class)).is("Unknown property 'bar' encountered in configuration section 
'T'.");
                assertThrown(()->c.getSectionAsBean("T", 
BBean.class)).is("Unknown property 'bar' encountered in configuration section 
'T'.");
-               assertThrown(()->c.getSectionAsBean(null, 
ABean.class)).is("Field 'section' cannot be null.");
-               assertThrown(()->c.getSectionAsBean(null, 
BBean.class)).is("Field 'section' cannot be null.");
+               assertThrown(()->c.getSectionAsBean(null, 
ABean.class)).is("Argument 'section' cannot be null");
+               assertThrown(()->c.getSectionAsBean(null, 
BBean.class)).is("Argument 'section' cannot be null");
        }
 
        
//====================================================================================================
@@ -888,7 +888,7 @@ public class ConfigTest {
                assertObject(c.getSectionAsMap("T")).asJson().is("{}");
                assertNull(c.getSectionAsMap("U"));
 
-               assertThrown(()->c.getSectionAsMap(null)).is("Field 'section' 
cannot be null.");
+               assertThrown(()->c.getSectionAsMap(null)).is("Argument 
'section' cannot be null");
        }
 
        
//====================================================================================================
@@ -912,7 +912,7 @@ public class ConfigTest {
                assertEquals("qux", a.getFoo());
 
                assertThrown(()->c.getSectionAsInterface("T", 
ABean.class)).is("Class 'org.apache.juneau.config.ConfigTest$ABean' passed to 
getSectionAsInterface() is not an interface.");
-               assertThrown(()->c.getSectionAsInterface(null, 
AInterface.class)).is("Field 'section' cannot be null.");
+               assertThrown(()->c.getSectionAsInterface(null, 
AInterface.class)).is("Argument 'section' cannot be null");
        }
 
        public static interface AInterface {
@@ -956,7 +956,7 @@ public class ConfigTest {
                c.setSection("S1", Collections.<String>emptyList());
                assertString(c).replaceAll("\\r?\\n", "|").is("#C3|#C4||[S1]|");
 
-               assertThrown(()->c.setSection(null, Arrays.asList("", "#C5", 
"#C6"))).is("Field 'section' cannot be null.");
+               assertThrown(()->c.setSection(null, Arrays.asList("", "#C5", 
"#C6"))).is("Argument 'section' cannot be null");
        }
 
        
//====================================================================================================
@@ -982,7 +982,7 @@ public class ConfigTest {
                c.setSection("S1", Collections.<String>emptyList(), m);
                assertString(c).replaceAll("\\r?\\n", "|").is("#C3|#C4||a = 
b|[S1]|a = b|");
 
-               assertThrown(()->c.setSection(null, Arrays.asList("", "#C5", 
"#C6"), m)).is("Field 'section' cannot be null.");
+               assertThrown(()->c.setSection(null, Arrays.asList("", "#C5", 
"#C6"), m)).is("Argument 'section' cannot be null");
        }
 
        
//====================================================================================================

Reply via email to