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-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a73261  Simplify assertions with equivalent but more simple. (#792)
0a73261 is described below

commit 0a73261eefd00b3431466f26e5600a0f3e80b18a
Author: Arturo Bernal <arturobern...@gmail.com>
AuthorDate: Sun Aug 29 21:47:30 2021 +0200

    Simplify assertions with equivalent but more simple. (#792)
---
 .../org/apache/commons/lang3/ArrayUtilsTest.java   |  8 +-
 .../org/apache/commons/lang3/BooleanUtilsTest.java | 96 +++++++++++-----------
 .../org/apache/commons/lang3/ObjectUtilsTest.java  | 10 +--
 .../commons/lang3/RandomStringUtilsTest.java       | 22 ++---
 .../org/apache/commons/lang3/StringUtilsTest.java  |  7 +-
 .../compare/ObjectToStringComparatorTest.java      |  9 +-
 .../lang3/exception/ExceptionUtilsTest.java        | 81 +++++++++---------
 7 files changed, 117 insertions(+), 116 deletions(-)

diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index 405845d..292a4a5 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -402,9 +402,9 @@ public class ArrayUtilsTest {
         assertNull(ArrayUtils.get(array0, 0));
         assertNull(ArrayUtils.get(array0, 1));
         final String[] array1 = { StringUtils.EMPTY };
-        assertEquals(null, ArrayUtils.get(array1, -1));
+        assertNull(ArrayUtils.get(array1, -1));
         assertEquals(StringUtils.EMPTY, ArrayUtils.get(array1, 0));
-        assertEquals(null, ArrayUtils.get(array1, 1));
+        assertNull(ArrayUtils.get(array1, 1));
     }
 
     @Test
@@ -428,9 +428,9 @@ public class ArrayUtilsTest {
             assertNull(ArrayUtils.get(array0, 0, null));
             assertNull(ArrayUtils.get(array0, 1, null));
             final String[] array1 = { StringUtils.EMPTY };
-            assertEquals(null, ArrayUtils.get(array1, -1, null));
+            assertNull(ArrayUtils.get(array1, -1, null));
             assertEquals(StringUtils.EMPTY, ArrayUtils.get(array1, 0, null));
-            assertEquals(null, ArrayUtils.get(array1, 1, null));
+            assertNull(ArrayUtils.get(array1, 1, null));
         }
         // non-null default
         {
diff --git a/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java
index 58d7ab4..98147d7 100644
--- a/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java
@@ -452,20 +452,20 @@ public class BooleanUtilsTest {
                     .booleanValue(),
                 "False result for (true, true)");
 
-        assertTrue(
-                ! BooleanUtils
+        assertFalse(
+                BooleanUtils
                     .and(new Boolean[] { Boolean.FALSE, Boolean.FALSE })
                     .booleanValue(),
                 "True result for (false, false)");
 
-        assertTrue(
-                ! BooleanUtils
+        assertFalse(
+                BooleanUtils
                     .and(new Boolean[] { Boolean.TRUE, Boolean.FALSE })
                     .booleanValue(),
                 "True result for (true, false)");
 
-        assertTrue(
-                ! BooleanUtils
+        assertFalse(
+                BooleanUtils
                     .and(new Boolean[] { Boolean.FALSE, Boolean.TRUE })
                     .booleanValue(),
                 "True result for (false, true)");
@@ -473,8 +473,8 @@ public class BooleanUtilsTest {
 
     @Test
     public void testAnd_object_validInput_3items() {
-        assertTrue(
-                ! BooleanUtils
+        assertFalse(
+                BooleanUtils
                     .and(
                         new Boolean[] {
                             Boolean.FALSE,
@@ -483,8 +483,8 @@ public class BooleanUtilsTest {
                             .booleanValue(),
                 "True result for (false, false, true)");
 
-        assertTrue(
-                ! BooleanUtils
+        assertFalse(
+                BooleanUtils
                     .and(
                         new Boolean[] {
                             Boolean.FALSE,
@@ -493,8 +493,8 @@ public class BooleanUtilsTest {
                             .booleanValue(),
                 "True result for (false, true, false)");
 
-        assertTrue(
-                ! BooleanUtils
+        assertFalse(
+                BooleanUtils
                     .and(
                         new Boolean[] {
                             Boolean.TRUE,
@@ -509,8 +509,8 @@ public class BooleanUtilsTest {
                     .booleanValue(),
                 "False result for (true, true, true)");
 
-        assertTrue(
-                ! BooleanUtils.and(
+        assertFalse(
+                BooleanUtils.and(
                         new Boolean[] {
                             Boolean.FALSE,
                             Boolean.FALSE,
@@ -518,8 +518,8 @@ public class BooleanUtilsTest {
                             .booleanValue(),
                 "True result for (false, false)");
 
-        assertTrue(
-                ! BooleanUtils.and(
+        assertFalse(
+                BooleanUtils.and(
                         new Boolean[] {
                             Boolean.TRUE,
                             Boolean.TRUE,
@@ -527,8 +527,8 @@ public class BooleanUtilsTest {
                             .booleanValue(),
                 "True result for (true, true, false)");
 
-        assertTrue(
-                ! BooleanUtils.and(
+        assertFalse(
+                BooleanUtils.and(
                         new Boolean[] {
                             Boolean.TRUE,
                             Boolean.FALSE,
@@ -536,8 +536,8 @@ public class BooleanUtilsTest {
                             .booleanValue(),
                 "True result for (true, false, true)");
 
-        assertTrue(
-                ! BooleanUtils.and(
+        assertFalse(
+                BooleanUtils.and(
                         new Boolean[] {
                             Boolean.FALSE,
                             Boolean.TRUE,
@@ -562,51 +562,51 @@ public class BooleanUtilsTest {
                 BooleanUtils.and(new boolean[] { true, true }),
                 "False result for (true, true)");
 
-        assertTrue(
-                ! BooleanUtils.and(new boolean[] { false, false }),
+        assertFalse(
+                BooleanUtils.and(new boolean[] { false, false }),
                 "True result for (false, false)");
 
-        assertTrue(
-                ! BooleanUtils.and(new boolean[] { true, false }),
+        assertFalse(
+                BooleanUtils.and(new boolean[] { true, false }),
                 "True result for (true, false)");
 
-        assertTrue(
-                ! BooleanUtils.and(new boolean[] { false, true }),
+        assertFalse(
+                BooleanUtils.and(new boolean[] { false, true }),
                 "True result for (false, true)");
     }
 
     @Test
     public void testAnd_primitive_validInput_3items() {
-        assertTrue(
-                ! BooleanUtils.and(new boolean[] { false, false, true }),
+        assertFalse(
+                BooleanUtils.and(new boolean[] { false, false, true }),
                 "True result for (false, false, true)");
 
-        assertTrue(
-                ! BooleanUtils.and(new boolean[] { false, true, false }),
+        assertFalse(
+                BooleanUtils.and(new boolean[] { false, true, false }),
                 "True result for (false, true, false)");
 
-        assertTrue(
-                ! BooleanUtils.and(new boolean[] { true, false, false }),
+        assertFalse(
+                BooleanUtils.and(new boolean[] { true, false, false }),
                 "True result for (true, false, false)");
 
         assertTrue(
                 BooleanUtils.and(new boolean[] { true, true, true }),
                 "False result for (true, true, true)");
 
-        assertTrue(
-                ! BooleanUtils.and(new boolean[] { false, false, false }),
+        assertFalse(
+                BooleanUtils.and(new boolean[] { false, false, false }),
                 "True result for (false, false)");
 
-        assertTrue(
-                ! BooleanUtils.and(new boolean[] { true, true, false }),
+        assertFalse(
+                BooleanUtils.and(new boolean[] { true, true, false }),
                 "True result for (true, true, false)");
 
-        assertTrue(
-                ! BooleanUtils.and(new boolean[] { true, false, true }),
+        assertFalse(
+                BooleanUtils.and(new boolean[] { true, false, true }),
                 "True result for (true, false, true)");
 
-        assertTrue(
-                ! BooleanUtils.and(new boolean[] { false, true, true }),
+        assertFalse(
+                BooleanUtils.and(new boolean[] { false, true, true }),
                 "True result for (false, true, true)");
     }
 
@@ -651,8 +651,8 @@ public class BooleanUtilsTest {
                     .booleanValue(),
                 "False result for (true, true)");
 
-        assertTrue(
-                ! BooleanUtils
+        assertFalse(
+                BooleanUtils
                     .or(new Boolean[] { Boolean.FALSE, Boolean.FALSE })
                     .booleanValue(),
                 "True result for (false, false)");
@@ -708,8 +708,8 @@ public class BooleanUtilsTest {
                     .booleanValue(),
                 "False result for (true, true, true)");
 
-        assertTrue(
-                ! BooleanUtils.or(
+        assertFalse(
+                BooleanUtils.or(
                         new Boolean[] {
                             Boolean.FALSE,
                             Boolean.FALSE,
@@ -761,8 +761,8 @@ public class BooleanUtilsTest {
                 BooleanUtils.or(new boolean[] { true, true }),
                 "False result for (true, true)");
 
-        assertTrue(
-                ! BooleanUtils.or(new boolean[] { false, false }),
+        assertFalse(
+                BooleanUtils.or(new boolean[] { false, false }),
                 "True result for (false, false)");
 
         assertTrue(
@@ -792,8 +792,8 @@ public class BooleanUtilsTest {
                 BooleanUtils.or(new boolean[] { true, true, true }),
                 "False result for (true, true, true)");
 
-        assertTrue(
-                ! BooleanUtils.or(new boolean[] { false, false, false }),
+        assertFalse(
+                BooleanUtils.or(new boolean[] { false, false, false }),
                 "True result for (false, false)");
 
         assertTrue(
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index 637ea24..a4cd46d 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -397,9 +397,9 @@ public class ObjectUtilsTest {
     @Test
     public void testEquals() {
         assertTrue(ObjectUtils.equals(null, null), "ObjectUtils.equals(null, 
null) returned false");
-        assertTrue(!ObjectUtils.equals(FOO, null), 
"ObjectUtils.equals(\"foo\", null) returned true");
-        assertTrue(!ObjectUtils.equals(null, BAR), "ObjectUtils.equals(null, 
\"bar\") returned true");
-        assertTrue(!ObjectUtils.equals(FOO, BAR), "ObjectUtils.equals(\"foo\", 
\"bar\") returned true");
+        assertFalse(ObjectUtils.equals(FOO, null), 
"ObjectUtils.equals(\"foo\", null) returned true");
+        assertFalse(ObjectUtils.equals(null, BAR), "ObjectUtils.equals(null, 
\"bar\") returned true");
+        assertFalse(ObjectUtils.equals(FOO, BAR), "ObjectUtils.equals(\"foo\", 
\"bar\") returned true");
         assertTrue(ObjectUtils.equals(FOO, FOO), "ObjectUtils.equals(\"foo\", 
\"foo\") returned false");
     }
 
@@ -776,8 +776,8 @@ public class ObjectUtilsTest {
 
     @Test
     public void testToString_SupplierString() {
-        assertEquals(null, ObjectUtils.toString(null, (Supplier<String>) 
null));
-        assertEquals(null, ObjectUtils.toString(null, () -> null));
+        assertNull(ObjectUtils.toString(null, (Supplier<String>) null));
+        assertNull(ObjectUtils.toString(null, () -> null));
         // Pretend computing BAR is expensive.
         assertEquals(BAR, ObjectUtils.toString(null, () -> BAR));
         assertEquals(Boolean.TRUE.toString(), 
ObjectUtils.toString(Boolean.TRUE, () -> BAR));
diff --git a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
index f358906..f523016 100644
--- a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
@@ -60,7 +60,7 @@ public class RandomStringUtilsTest {
         assertEquals(50, r1.length(), "random(50) length");
         String r2 = RandomStringUtils.random(50);
         assertEquals(50, r2.length(), "random(50) length");
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         r1 = RandomStringUtils.randomAscii(50);
         assertEquals(50, r1.length(), "randomAscii(50) length");
@@ -68,7 +68,7 @@ public class RandomStringUtilsTest {
             assertTrue(r1.charAt(i) >= 32 && r1.charAt(i) <= 127, "char 
between 32 and 127");
         }
         r2 = RandomStringUtils.randomAscii(50);
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         r1 = RandomStringUtils.randomAlphabetic(50);
         assertEquals(50, r1.length(), "randomAlphabetic(50)");
@@ -76,7 +76,7 @@ public class RandomStringUtilsTest {
             assertTrue(Character.isLetter(r1.charAt(i)) && 
!Character.isDigit(r1.charAt(i)), "r1 contains alphabetic");
         }
         r2 = RandomStringUtils.randomAlphabetic(50);
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         r1 = RandomStringUtils.randomAlphanumeric(50);
         assertEquals(50, r1.length(), "randomAlphanumeric(50)");
@@ -84,7 +84,7 @@ public class RandomStringUtilsTest {
             assertTrue(Character.isLetterOrDigit(r1.charAt(i)), "r1 contains 
alphanumeric");
         }
         r2 = RandomStringUtils.randomAlphabetic(50);
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         r1 = RandomStringUtils.randomGraph(50);
         assertEquals(50, r1.length(), "randomGraph(50) length");
@@ -92,7 +92,7 @@ public class RandomStringUtilsTest {
             assertTrue(r1.charAt(i) >= 33 && r1.charAt(i) <= 126, "char 
between 33 and 126");
         }
         r2 = RandomStringUtils.randomGraph(50);
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         r1 = RandomStringUtils.randomNumeric(50);
         assertEquals(50, r1.length(), "randomNumeric(50)");
@@ -100,7 +100,7 @@ public class RandomStringUtilsTest {
             assertTrue(Character.isDigit(r1.charAt(i)) && 
!Character.isLetter(r1.charAt(i)), "r1 contains numeric");
         }
         r2 = RandomStringUtils.randomNumeric(50);
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         r1 = RandomStringUtils.randomPrint(50);
         assertEquals(50, r1.length(), "randomPrint(50) length");
@@ -108,7 +108,7 @@ public class RandomStringUtilsTest {
             assertTrue(r1.charAt(i) >= 32 && r1.charAt(i) <= 126, "char 
between 32 and 126");
         }
         r2 = RandomStringUtils.randomPrint(50);
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         String set = "abcdefg";
         r1 = RandomStringUtils.random(50, set);
@@ -117,13 +117,13 @@ public class RandomStringUtilsTest {
             assertTrue(set.indexOf(r1.charAt(i)) > -1, "random char in set");
         }
         r2 = RandomStringUtils.random(50, set);
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         r1 = RandomStringUtils.random(50, (String) null);
         assertEquals(50, r1.length(), "random(50) length");
         r2 = RandomStringUtils.random(50, (String) null);
         assertEquals(50, r2.length(), "random(50) length");
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         set = "stuvwxyz";
         r1 = RandomStringUtils.random(50, set.toCharArray());
@@ -132,13 +132,13 @@ public class RandomStringUtilsTest {
             assertTrue(set.indexOf(r1.charAt(i)) > -1, "random char in set");
         }
         r2 = RandomStringUtils.random(50, set);
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         r1 = RandomStringUtils.random(50, (char[]) null);
         assertEquals(50, r1.length(), "random(50) length");
         r2 = RandomStringUtils.random(50, (char[]) null);
         assertEquals(50, r2.length(), "random(50) length");
-        assertTrue(!r1.equals(r2), "!r1.equals(r2)");
+        assertFalse(r1.equals(r2), "!r1.equals(r2)");
 
         final long seedMillis = System.currentTimeMillis();
         r1 = RandomStringUtils.random(50, 0, 0, true, true, null, new 
Random(seedMillis));
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index 2f6d9a7..5750f8b 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -2910,8 +2910,7 @@ public class StringUtilsTest {
                 // don't actively test for that.
                 final Class<?>[] params = m.getParameterTypes();
                 if (params.length > 0 && (params[0] == CharSequence.class || 
params[0] == CharSequence[].class)) {
-                    assertTrue(!ArrayUtils.contains(excludeMethods, methodStr),
-                            "The method \"" + methodStr + "\" appears to be 
mutable in spirit and therefore must not accept a CharSequence");
+                    assertFalse(ArrayUtils.contains(excludeMethods, 
methodStr), "The method \"" + methodStr + "\" appears to be mutable in spirit 
and therefore must not accept a CharSequence");
                 }
             } else {
                 // Assume this is immutable in spirit and ensure the first 
parameter is not String.
@@ -3288,7 +3287,7 @@ public class StringUtilsTest {
 
     @Test
     public void testToRootLowerCase() {
-        assertEquals(null, StringUtils.toRootLowerCase(null));
+        assertNull(StringUtils.toRootLowerCase(null));
         assertEquals("a", StringUtils.toRootLowerCase("A"));
         assertEquals("a", StringUtils.toRootLowerCase("a"));
         final Locale TURKISH = Locale.forLanguageTag("tr");
@@ -3308,7 +3307,7 @@ public class StringUtilsTest {
 
     @Test
     public void testToRootUpperCase() {
-        assertEquals(null, StringUtils.toRootUpperCase(null));
+        assertNull(StringUtils.toRootUpperCase(null));
         assertEquals("A", StringUtils.toRootUpperCase("a"));
         assertEquals("A", StringUtils.toRootUpperCase("A"));
         final Locale TURKISH = Locale.forLanguageTag("tr");
diff --git 
a/src/test/java/org/apache/commons/lang3/compare/ObjectToStringComparatorTest.java
 
b/src/test/java/org/apache/commons/lang3/compare/ObjectToStringComparatorTest.java
index 489c310..9a03f76 100644
--- 
a/src/test/java/org/apache/commons/lang3/compare/ObjectToStringComparatorTest.java
+++ 
b/src/test/java/org/apache/commons/lang3/compare/ObjectToStringComparatorTest.java
@@ -18,6 +18,7 @@
 package org.apache.commons.lang3.compare;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 import java.util.Arrays;
 import java.util.List;
@@ -48,8 +49,8 @@ public class ObjectToStringComparatorTest {
         final List<Thing> things = Arrays.asList(null, new Thing("y"), null);
         things.sort(ObjectToStringComparator.INSTANCE);
         assertEquals("y", things.get(0).string);
-        assertEquals(null, things.get(1));
-        assertEquals(null, things.get(2));
+        assertNull(things.get(1));
+        assertNull(things.get(2));
     }
 
     @Test
@@ -57,8 +58,8 @@ public class ObjectToStringComparatorTest {
         final List<Thing> things = Arrays.asList(new Thing(null), new 
Thing("y"), new Thing(null));
         things.sort(ObjectToStringComparator.INSTANCE);
         assertEquals("y", things.get(0).string);
-        assertEquals(null, things.get(1).string);
-        assertEquals(null, things.get(2).string);
+        assertNull(things.get(1).string);
+        assertNull(things.get(2).string);
     }
 
     @Test
diff --git 
a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
index 8a4d652..acbc438 100644
--- a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
@@ -20,6 +20,7 @@ import static 
org.junit.jupiter.api.Assertions.assertArrayEquals;
 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.assertSame;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -562,73 +563,73 @@ public class ExceptionUtilsTest {
 
     @Test
     public void testThrowableOf_ThrowableClass() {
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(null, null));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(null, 
NestableException.class));
+        assertNull(ExceptionUtils.throwableOfThrowable(null, null));
+        assertNull(ExceptionUtils.throwableOfThrowable(null, 
NestableException.class));
 
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withoutCause, 
null));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withoutCause, 
ExceptionWithCause.class));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withoutCause, 
NestableException.class));
+        assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, null));
+        assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, 
ExceptionWithCause.class));
+        assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, 
NestableException.class));
         assertEquals(withoutCause, 
ExceptionUtils.throwableOfThrowable(withoutCause, ExceptionWithoutCause.class));
 
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(nested, null));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(nested, 
ExceptionWithCause.class));
+        assertNull(ExceptionUtils.throwableOfThrowable(nested, null));
+        assertNull(ExceptionUtils.throwableOfThrowable(nested, 
ExceptionWithCause.class));
         assertEquals(nested, ExceptionUtils.throwableOfThrowable(nested, 
NestableException.class));
         assertEquals(nested.getCause(), 
ExceptionUtils.throwableOfThrowable(nested, ExceptionWithoutCause.class));
 
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withCause, 
null));
+        assertNull(ExceptionUtils.throwableOfThrowable(withCause, null));
         assertEquals(withCause, ExceptionUtils.throwableOfThrowable(withCause, 
ExceptionWithCause.class));
         assertEquals(withCause.getCause(), 
ExceptionUtils.throwableOfThrowable(withCause, NestableException.class));
         assertEquals(withCause.getCause().getCause(), 
ExceptionUtils.throwableOfThrowable(withCause, ExceptionWithoutCause.class));
 
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withCause, 
Exception.class));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withCause, 
Throwable.class));
+        assertNull(ExceptionUtils.throwableOfThrowable(withCause, 
Exception.class));
+        assertNull(ExceptionUtils.throwableOfThrowable(withCause, 
Throwable.class));
     }
 
     @Test
     public void testThrowableOf_ThrowableClassInt() {
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(null, null, 0));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(null, 
NestableException.class, 0));
+        assertNull(ExceptionUtils.throwableOfThrowable(null, null, 0));
+        assertNull(ExceptionUtils.throwableOfThrowable(null, 
NestableException.class, 0));
 
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withoutCause, 
null));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withoutCause, 
ExceptionWithCause.class, 0));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withoutCause, 
NestableException.class, 0));
+        assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, null));
+        assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, 
ExceptionWithCause.class, 0));
+        assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, 
NestableException.class, 0));
         assertEquals(withoutCause, 
ExceptionUtils.throwableOfThrowable(withoutCause, ExceptionWithoutCause.class, 
0));
 
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(nested, null, 
0));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(nested, 
ExceptionWithCause.class, 0));
+        assertNull(ExceptionUtils.throwableOfThrowable(nested, null, 0));
+        assertNull(ExceptionUtils.throwableOfThrowable(nested, 
ExceptionWithCause.class, 0));
         assertEquals(nested, ExceptionUtils.throwableOfThrowable(nested, 
NestableException.class, 0));
         assertEquals(nested.getCause(), 
ExceptionUtils.throwableOfThrowable(nested, ExceptionWithoutCause.class, 0));
 
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withCause, 
null));
+        assertNull(ExceptionUtils.throwableOfThrowable(withCause, null));
         assertEquals(withCause, ExceptionUtils.throwableOfThrowable(withCause, 
ExceptionWithCause.class, 0));
         assertEquals(withCause.getCause(), 
ExceptionUtils.throwableOfThrowable(withCause, NestableException.class, 0));
         assertEquals(withCause.getCause().getCause(), 
ExceptionUtils.throwableOfThrowable(withCause, ExceptionWithoutCause.class, 0));
 
         assertEquals(withCause, ExceptionUtils.throwableOfThrowable(withCause, 
ExceptionWithCause.class, -1));
         assertEquals(withCause, ExceptionUtils.throwableOfThrowable(withCause, 
ExceptionWithCause.class, 0));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withCause, 
ExceptionWithCause.class, 1));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withCause, 
ExceptionWithCause.class, 9));
+        assertNull(ExceptionUtils.throwableOfThrowable(withCause, 
ExceptionWithCause.class, 1));
+        assertNull(ExceptionUtils.throwableOfThrowable(withCause, 
ExceptionWithCause.class, 9));
 
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withCause, 
Exception.class, 0));
-        assertEquals(null, ExceptionUtils.throwableOfThrowable(withCause, 
Throwable.class, 0));
+        assertNull(ExceptionUtils.throwableOfThrowable(withCause, 
Exception.class, 0));
+        assertNull(ExceptionUtils.throwableOfThrowable(withCause, 
Throwable.class, 0));
     }
 
     @Test
     public void testThrowableOfType_ThrowableClass() {
-        assertEquals(null, ExceptionUtils.throwableOfType(null, null));
-        assertEquals(null, ExceptionUtils.throwableOfType(null, 
NestableException.class));
+        assertNull(ExceptionUtils.throwableOfType(null, null));
+        assertNull(ExceptionUtils.throwableOfType(null, 
NestableException.class));
 
-        assertEquals(null, ExceptionUtils.throwableOfType(withoutCause, null));
-        assertEquals(null, ExceptionUtils.throwableOfType(withoutCause, 
ExceptionWithCause.class));
-        assertEquals(null, ExceptionUtils.throwableOfType(withoutCause, 
NestableException.class));
+        assertNull(ExceptionUtils.throwableOfType(withoutCause, null));
+        assertNull(ExceptionUtils.throwableOfType(withoutCause, 
ExceptionWithCause.class));
+        assertNull(ExceptionUtils.throwableOfType(withoutCause, 
NestableException.class));
         assertEquals(withoutCause, 
ExceptionUtils.throwableOfType(withoutCause, ExceptionWithoutCause.class));
 
-        assertEquals(null, ExceptionUtils.throwableOfType(nested, null));
-        assertEquals(null, ExceptionUtils.throwableOfType(nested, 
ExceptionWithCause.class));
+        assertNull(ExceptionUtils.throwableOfType(nested, null));
+        assertNull(ExceptionUtils.throwableOfType(nested, 
ExceptionWithCause.class));
         assertEquals(nested, ExceptionUtils.throwableOfType(nested, 
NestableException.class));
         assertEquals(nested.getCause(), ExceptionUtils.throwableOfType(nested, 
ExceptionWithoutCause.class));
 
-        assertEquals(null, ExceptionUtils.throwableOfType(withCause, null));
+        assertNull(ExceptionUtils.throwableOfType(withCause, null));
         assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, 
ExceptionWithCause.class));
         assertEquals(withCause.getCause(), 
ExceptionUtils.throwableOfType(withCause, NestableException.class));
         assertEquals(withCause.getCause().getCause(), 
ExceptionUtils.throwableOfType(withCause, ExceptionWithoutCause.class));
@@ -639,28 +640,28 @@ public class ExceptionUtilsTest {
 
     @Test
     public void testThrowableOfType_ThrowableClassInt() {
-        assertEquals(null, ExceptionUtils.throwableOfType(null, null, 0));
-        assertEquals(null, ExceptionUtils.throwableOfType(null, 
NestableException.class, 0));
+        assertNull(ExceptionUtils.throwableOfType(null, null, 0));
+        assertNull(ExceptionUtils.throwableOfType(null, 
NestableException.class, 0));
 
-        assertEquals(null, ExceptionUtils.throwableOfType(withoutCause, null));
-        assertEquals(null, ExceptionUtils.throwableOfType(withoutCause, 
ExceptionWithCause.class, 0));
-        assertEquals(null, ExceptionUtils.throwableOfType(withoutCause, 
NestableException.class, 0));
+        assertNull(ExceptionUtils.throwableOfType(withoutCause, null));
+        assertNull(ExceptionUtils.throwableOfType(withoutCause, 
ExceptionWithCause.class, 0));
+        assertNull(ExceptionUtils.throwableOfType(withoutCause, 
NestableException.class, 0));
         assertEquals(withoutCause, 
ExceptionUtils.throwableOfType(withoutCause, ExceptionWithoutCause.class, 0));
 
-        assertEquals(null, ExceptionUtils.throwableOfType(nested, null, 0));
-        assertEquals(null, ExceptionUtils.throwableOfType(nested, 
ExceptionWithCause.class, 0));
+        assertNull(ExceptionUtils.throwableOfType(nested, null, 0));
+        assertNull(ExceptionUtils.throwableOfType(nested, 
ExceptionWithCause.class, 0));
         assertEquals(nested, ExceptionUtils.throwableOfType(nested, 
NestableException.class, 0));
         assertEquals(nested.getCause(), ExceptionUtils.throwableOfType(nested, 
ExceptionWithoutCause.class, 0));
 
-        assertEquals(null, ExceptionUtils.throwableOfType(withCause, null));
+        assertNull(ExceptionUtils.throwableOfType(withCause, null));
         assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, 
ExceptionWithCause.class, 0));
         assertEquals(withCause.getCause(), 
ExceptionUtils.throwableOfType(withCause, NestableException.class, 0));
         assertEquals(withCause.getCause().getCause(), 
ExceptionUtils.throwableOfType(withCause, ExceptionWithoutCause.class, 0));
 
         assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, 
ExceptionWithCause.class, -1));
         assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, 
ExceptionWithCause.class, 0));
-        assertEquals(null, ExceptionUtils.throwableOfType(withCause, 
ExceptionWithCause.class, 1));
-        assertEquals(null, ExceptionUtils.throwableOfType(withCause, 
ExceptionWithCause.class, 9));
+        assertNull(ExceptionUtils.throwableOfType(withCause, 
ExceptionWithCause.class, 1));
+        assertNull(ExceptionUtils.throwableOfType(withCause, 
ExceptionWithCause.class, 9));
 
         assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, 
Exception.class, 0));
         assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, 
Throwable.class, 0));

Reply via email to