From 5b6030595205f5f843549f1f12a0e1037bf4a50f Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 2 Jul 2023 15:36:17 -0400 Subject: [PATCH] Fix Javadoc @since tags Sort members --- .../lang3/exception/ExceptionUtils.java | 4 +- .../lang3/exception/ExceptionUtilsTest.java | 82 +++++++++---------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java index 26ffed3bd..6f320a27d 100644 --- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java +++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java @@ -978,7 +978,7 @@ public class ExceptionUtils { * @param throwable * The throwable to check. * @return True if the given Throwable is a checked exception. - * @since 3.13 + * @since 3.13.0 */ public static boolean isChecked(final Throwable throwable) { return throwable != null && !(throwable instanceof Error) && !(throwable instanceof RuntimeException); @@ -990,7 +990,7 @@ public class ExceptionUtils { * @param throwable * The throwable to check. * @return True if the given Throwable is an unchecked exception. - * @since 3.13 + * @since 3.13.0 */ public static boolean isUnchecked(final Throwable throwable) { return !isChecked(throwable); 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 bcb2762ee..e8a4652f0 100644 --- a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java @@ -123,19 +123,19 @@ public class ExceptionUtilsTest extends AbstractLangTest { } } + private ExceptionWithCause cyclicCause; + + + private Throwable jdkNoCause; + private NestableException nested; + private Throwable notVisibleException; private Throwable withCause; private Throwable withoutCause; - private Throwable jdkNoCause; - - private ExceptionWithCause cyclicCause; - - private Throwable notVisibleException; - private Throwable createExceptionWithCause() { try { try { @@ -610,6 +610,41 @@ public class ExceptionUtilsTest extends AbstractLangTest { assertEquals(0, ExceptionUtils.indexOfType(withCause, Throwable.class, 0)); } + @Test + public void testIsChecked_checked() { + assertTrue(ExceptionUtils.isChecked(new IOException())); + } + + @Test + public void testIsChecked_error() { + assertFalse(ExceptionUtils.isChecked(new StackOverflowError())); + } + + @Test + public void testIsChecked_null() { + assertFalse(ExceptionUtils.isChecked(null)); + } + + @Test + public void testIsChecked_unchecked() { + assertFalse(ExceptionUtils.isChecked(new IllegalArgumentException())); + } + + @Test + public void testIsUnchecked_checked() { + assertFalse(ExceptionUtils.isUnchecked(new IOException())); + } + + @Test + public void testIsUnchecked_error() { + assertTrue(ExceptionUtils.isUnchecked(new StackOverflowError())); + } + + @Test + public void testIsUnchecked_unchecked() { + assertTrue(ExceptionUtils.isUnchecked(new IllegalArgumentException())); + } + @Test public void testPrintRootCauseStackTrace_Throwable() { ExceptionUtils.printRootCauseStackTrace(null); @@ -850,39 +885,4 @@ public class ExceptionUtilsTest extends AbstractLangTest { final Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new TestThrowable())); assertTrue(ExceptionUtils.hasCause(t, TestThrowable.class)); } - - @Test - public void testIsChecked_null() { - assertFalse(ExceptionUtils.isChecked(null)); - } - - @Test - public void testIsChecked_unchecked() { - assertFalse(ExceptionUtils.isChecked(new IllegalArgumentException())); - } - - @Test - public void testIsChecked_checked() { - assertTrue(ExceptionUtils.isChecked(new IOException())); - } - - @Test - public void testIsChecked_error() { - assertFalse(ExceptionUtils.isChecked(new StackOverflowError())); - } - - @Test - public void testIsUnchecked_unchecked() { - assertTrue(ExceptionUtils.isUnchecked(new IllegalArgumentException())); - } - - @Test - public void testIsUnchecked_checked() { - assertFalse(ExceptionUtils.isUnchecked(new IOException())); - } - - @Test - public void testIsUnchecked_error() { - assertTrue(ExceptionUtils.isUnchecked(new StackOverflowError())); - } }