From b3d86ca08a22afb47338dea0a3fcad2a58ece49c Mon Sep 17 00:00:00 2001 From: Allon Mureinik Date: Sat, 13 Oct 2018 19:49:52 +0300 Subject: [PATCH] Clean up redundant throws clauses --- .../commons/lang3/ArrayUtilsInsertTest.java | 18 ++--- .../apache/commons/lang3/ArrayUtilsTest.java | 76 +++++++++---------- .../commons/lang3/CharEncodingTest.java | 2 +- .../commons/lang3/CharSequenceUtilsTest.java | 2 +- .../org/apache/commons/lang3/CharSetTest.java | 2 +- .../commons/lang3/ClassPathUtilsTest.java | 8 +- .../apache/commons/lang3/ClassUtilsTest.java | 22 +++--- .../apache/commons/lang3/LocaleUtilsTest.java | 2 +- .../commons/lang3/RandomStringUtilsTest.java | 4 +- .../commons/lang3/SerializationUtilsTest.java | 6 +- .../commons/lang3/StringEscapeUtilsTest.java | 12 +-- .../apache/commons/lang3/StringUtilsTest.java | 8 +- .../apache/commons/lang3/SystemUtilsTest.java | 4 +- .../apache/commons/lang3/ThreadUtilsTest.java | 12 +-- .../builder/DefaultToStringStyleTest.java | 4 +- .../lang3/builder/DiffBuilderTest.java | 30 ++++---- .../lang3/builder/EqualsBuilderTest.java | 4 +- .../lang3/builder/HashCodeBuilderTest.java | 2 +- .../lang3/builder/JsonToStringStyleTest.java | 4 +- .../builder/MultiLineToStringStyleTest.java | 4 +- .../MultilineRecursiveToStringStyleTest.java | 2 +- .../builder/NoClassNameToStringStyleTest.java | 4 +- .../NoFieldNamesToStringStyleTest.java | 4 +- .../builder/RecursiveToStringStyleTest.java | 4 +- ...ngBuilderMutateInspectConcurrencyTest.java | 2 +- .../builder/ShortPrefixToStringStyleTest.java | 4 +- .../builder/SimpleToStringStyleTest.java | 4 +- .../builder/StandardToStringStyleTest.java | 4 +- .../lang3/builder/ToStringBuilderTest.java | 2 +- .../concurrent/AtomicInitializerTest.java | 2 +- .../concurrent/AtomicSafeInitializerTest.java | 4 +- .../concurrent/BackgroundInitializerTest.java | 4 +- .../concurrent/BasicThreadFactoryTest.java | 2 +- .../CallableBackgroundInitializerTest.java | 2 +- .../CircuitBreakingExceptionTest.java | 6 +- .../lang3/concurrent/ConcurrentUtilsTest.java | 8 +- .../concurrent/ConstantInitializerTest.java | 2 +- .../lang3/concurrent/LazyInitializerTest.java | 2 +- .../MultiBackgroundInitializerTest.java | 2 +- .../lang3/concurrent/TimedSemaphoreTest.java | 4 +- .../commons/lang3/event/EventUtilsTest.java | 2 +- .../exception/CloneFailedExceptionTest.java | 6 +- .../lang3/exception/ExceptionUtilsTest.java | 14 ++-- .../lang3/reflect/ConstructorUtilsTest.java | 6 +- .../commons/lang3/reflect/FieldUtilsTest.java | 6 +- .../lang3/reflect/MethodUtilsTest.java | 19 +++-- .../commons/lang3/reflect/TypeUtilsTest.java | 8 +- .../lang3/text/ExtendedMessageFormatTest.java | 2 +- .../commons/lang3/text/StrBuilderTest.java | 4 +- .../lang3/text/StrSubstitutorTest.java | 4 +- .../commons/lang3/text/WordUtilsTest.java | 4 +- .../lang3/time/DateFormatUtilsTest.java | 4 +- .../lang3/time/DateUtilsFragmentTest.java | 8 +- .../lang3/time/DateUtilsRoundingTest.java | 2 +- .../commons/lang3/time/DateUtilsTest.java | 14 +--- .../lang3/time/FastDateFormatTest.java | 2 +- .../lang3/time/FastDatePrinterTest.java | 9 +-- .../lang3/tuple/ImmutablePairTest.java | 10 +-- .../lang3/tuple/ImmutableTripleTest.java | 10 +-- .../commons/lang3/tuple/MutablePairTest.java | 14 ++-- .../lang3/tuple/MutableTripleTest.java | 14 ++-- .../apache/commons/lang3/tuple/PairTest.java | 18 ++--- .../commons/lang3/tuple/TripleTest.java | 20 ++--- 63 files changed, 238 insertions(+), 256 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java index cf2d4a5cc..63b63866d 100644 --- a/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java +++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java @@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test; public class ArrayUtilsInsertTest { @Test - public void testInsertBooleans() throws Exception { + public void testInsertBooleans() { final boolean[] array = {true,false,true}; final boolean[] values = {false,true,false}; @@ -55,7 +55,7 @@ public class ArrayUtilsInsertTest { @Test - public void testInsertBytes() throws Exception { + public void testInsertBytes() { final byte[] array = {1,2,3}; final byte[] values = {4,5,6}; @@ -79,7 +79,7 @@ public class ArrayUtilsInsertTest { } @Test - public void testInsertChars() throws Exception { + public void testInsertChars() { final char[] array = {'a','b','c'}; final char[] values = {'d','e','f'}; @@ -103,7 +103,7 @@ public class ArrayUtilsInsertTest { } @Test - public void testInsertDoubles() throws Exception { + public void testInsertDoubles() { final double[] array = {1,2,3}; final double[] values = {4,5,6}; final double delta = 0.000001; @@ -128,7 +128,7 @@ public class ArrayUtilsInsertTest { } @Test - public void testInsertFloats() throws Exception { + public void testInsertFloats() { final float[] array = {1,2,3}; final float[] values = {4,5,6}; final float delta = 0.000001f; @@ -153,7 +153,7 @@ public class ArrayUtilsInsertTest { } @Test - public void testInsertInts() throws Exception { + public void testInsertInts() { final int[] array = {1,2,3}; final int[] values = {4,5,6}; @@ -178,7 +178,7 @@ public class ArrayUtilsInsertTest { @Test - public void testInsertLongs() throws Exception { + public void testInsertLongs() { final long[] array = {1,2,3}; final long[] values = {4,5,6}; @@ -203,7 +203,7 @@ public class ArrayUtilsInsertTest { @Test - public void testInsertShorts() throws Exception { + public void testInsertShorts() { final short[] array = {1,2,3}; final short[] values = {4,5,6}; @@ -228,7 +228,7 @@ public class ArrayUtilsInsertTest { @Test - public void testInsertGenericArray() throws Exception { + public void testInsertGenericArray() { final String[] array = {"a","b","c"}; final String[] values = {"d","e","f"}; diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java index 380cee2e6..97658f8fd 100644 --- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java @@ -392,12 +392,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyBooleanNull() throws Exception { + public void testNullToEmptyBooleanNull() { assertEquals(ArrayUtils.EMPTY_BOOLEAN_ARRAY, ArrayUtils.nullToEmpty((boolean[]) null)); } @Test - public void testNullToEmptyBooleanEmptyArray() throws Exception { + public void testNullToEmptyBooleanEmptyArray() { final boolean[] empty = new boolean[]{}; final boolean[] result = ArrayUtils.nullToEmpty(empty); assertEquals(ArrayUtils.EMPTY_BOOLEAN_ARRAY, result); @@ -411,12 +411,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyLongNull() throws Exception { + public void testNullToEmptyLongNull() { assertEquals(ArrayUtils.EMPTY_LONG_ARRAY, ArrayUtils.nullToEmpty((long[]) null)); } @Test - public void testNullToEmptyLongEmptyArray() throws Exception { + public void testNullToEmptyLongEmptyArray() { final long[] empty = new long[]{}; final long[] result = ArrayUtils.nullToEmpty(empty); assertEquals(ArrayUtils.EMPTY_LONG_ARRAY, result); @@ -430,12 +430,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyIntNull() throws Exception { + public void testNullToEmptyIntNull() { assertEquals(ArrayUtils.EMPTY_INT_ARRAY, ArrayUtils.nullToEmpty((int[]) null)); } @Test - public void testNullToEmptyIntEmptyArray() throws Exception { + public void testNullToEmptyIntEmptyArray() { final int[] empty = new int[]{}; final int[] result = ArrayUtils.nullToEmpty(empty); assertEquals(ArrayUtils.EMPTY_INT_ARRAY, result); @@ -449,12 +449,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyShortNull() throws Exception { + public void testNullToEmptyShortNull() { assertEquals(ArrayUtils.EMPTY_SHORT_ARRAY, ArrayUtils.nullToEmpty((short[]) null)); } @Test - public void testNullToEmptyShortEmptyArray() throws Exception { + public void testNullToEmptyShortEmptyArray() { final short[] empty = new short[]{}; final short[] result = ArrayUtils.nullToEmpty(empty); assertEquals(ArrayUtils.EMPTY_SHORT_ARRAY, result); @@ -468,12 +468,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyCharNull() throws Exception { + public void testNullToEmptyCharNull() { assertEquals(ArrayUtils.EMPTY_CHAR_ARRAY, ArrayUtils.nullToEmpty((char[]) null)); } @Test - public void testNullToEmptyCharEmptyArray() throws Exception { + public void testNullToEmptyCharEmptyArray() { final char[] empty = new char[]{}; final char[] result = ArrayUtils.nullToEmpty(empty); assertEquals(ArrayUtils.EMPTY_CHAR_ARRAY, result); @@ -487,12 +487,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyByteNull() throws Exception { + public void testNullToEmptyByteNull() { assertEquals(ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.nullToEmpty((byte[]) null)); } @Test - public void testNullToEmptyByteEmptyArray() throws Exception { + public void testNullToEmptyByteEmptyArray() { final byte[] empty = new byte[]{}; final byte[] result = ArrayUtils.nullToEmpty(empty); assertEquals(ArrayUtils.EMPTY_BYTE_ARRAY, result); @@ -506,12 +506,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyDoubleNull() throws Exception { + public void testNullToEmptyDoubleNull() { assertEquals(ArrayUtils.EMPTY_DOUBLE_ARRAY, ArrayUtils.nullToEmpty((double[]) null)); } @Test - public void testNullToEmptyDoubleEmptyArray() throws Exception { + public void testNullToEmptyDoubleEmptyArray() { final double[] empty = new double[]{}; final double[] result = ArrayUtils.nullToEmpty(empty); assertEquals(ArrayUtils.EMPTY_DOUBLE_ARRAY, result); @@ -525,12 +525,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyFloatNull() throws Exception { + public void testNullToEmptyFloatNull() { assertEquals(ArrayUtils.EMPTY_FLOAT_ARRAY, ArrayUtils.nullToEmpty((float[]) null)); } @Test - public void testNullToEmptyFloatEmptyArray() throws Exception { + public void testNullToEmptyFloatEmptyArray() { final float[] empty = new float[]{}; final float[] result = ArrayUtils.nullToEmpty(empty); assertEquals(ArrayUtils.EMPTY_FLOAT_ARRAY, result); @@ -544,12 +544,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyObjectNull() throws Exception { + public void testNullToEmptyObjectNull() { assertArrayEquals(ArrayUtils.EMPTY_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Object[]) null)); } @Test - public void testNullToEmptyObjectEmptyArray() throws Exception { + public void testNullToEmptyObjectEmptyArray() { final Object[] empty = new Object[]{}; final Object[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_OBJECT_ARRAY, result); @@ -563,12 +563,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyClassNull() throws Exception { + public void testNullToEmptyClassNull() { assertArrayEquals(ArrayUtils.EMPTY_CLASS_ARRAY, ArrayUtils.nullToEmpty((Class[]) null)); } @Test - public void testNullToEmptyClassEmptyArray() throws Exception { + public void testNullToEmptyClassEmptyArray() { final Class[] empty = {}; final Class[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_CLASS_ARRAY, result); @@ -582,12 +582,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyStringNull() throws Exception { + public void testNullToEmptyStringNull() { assertArrayEquals(ArrayUtils.EMPTY_STRING_ARRAY, ArrayUtils.nullToEmpty((String[]) null)); } @Test - public void testNullToEmptyStringEmptyArray() throws Exception { + public void testNullToEmptyStringEmptyArray() { final String[] empty = new String[]{}; final String[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_STRING_ARRAY, result); @@ -601,12 +601,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyBooleanObjectNull() throws Exception { + public void testNullToEmptyBooleanObjectNull() { assertArrayEquals(ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Boolean[]) null)); } @Test - public void testNullToEmptyBooleanObjectEmptyArray() throws Exception { + public void testNullToEmptyBooleanObjectEmptyArray() { final Boolean[] empty = new Boolean[]{}; final Boolean[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY, result); @@ -620,12 +620,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyLongObjectNull() throws Exception { + public void testNullToEmptyLongObjectNull() { assertArrayEquals(ArrayUtils.EMPTY_LONG_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Long[]) null)); } @Test - public void testNullToEmptyLongObjectEmptyArray() throws Exception { + public void testNullToEmptyLongObjectEmptyArray() { final Long[] empty = new Long[]{}; final Long[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_LONG_OBJECT_ARRAY, result); @@ -639,12 +639,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyIntObjectNull() throws Exception { + public void testNullToEmptyIntObjectNull() { assertArrayEquals(ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Integer[]) null)); } @Test - public void testNullToEmptyIntObjectEmptyArray() throws Exception { + public void testNullToEmptyIntObjectEmptyArray() { final Integer[] empty = new Integer[]{}; final Integer[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY, result); @@ -658,12 +658,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyShortObjectNull() throws Exception { + public void testNullToEmptyShortObjectNull() { assertArrayEquals(ArrayUtils.EMPTY_SHORT_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Short[]) null)); } @Test - public void testNullToEmptyShortObjectEmptyArray() throws Exception { + public void testNullToEmptyShortObjectEmptyArray() { final Short[] empty = new Short[]{}; final Short[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_SHORT_OBJECT_ARRAY, result); @@ -677,12 +677,12 @@ public class ArrayUtilsTest { } @Test - public void testNUllToEmptyCharObjectNull() throws Exception { + public void testNUllToEmptyCharObjectNull() { assertArrayEquals(ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Character[]) null)); } @Test - public void testNullToEmptyCharObjectEmptyArray() throws Exception { + public void testNullToEmptyCharObjectEmptyArray() { final Character[] empty = new Character[]{}; final Character[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, result); @@ -696,12 +696,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyByteObjectNull() throws Exception { + public void testNullToEmptyByteObjectNull() { assertArrayEquals(ArrayUtils.EMPTY_BYTE_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Byte[]) null)); } @Test - public void testNullToEmptyByteObjectEmptyArray() throws Exception { + public void testNullToEmptyByteObjectEmptyArray() { final Byte[] empty = new Byte[]{}; final Byte[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_BYTE_OBJECT_ARRAY, result); @@ -715,12 +715,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyDoubleObjectNull() throws Exception { + public void testNullToEmptyDoubleObjectNull() { assertArrayEquals(ArrayUtils.EMPTY_DOUBLE_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Double[]) null)); } @Test - public void testNullToEmptyDoubleObjectEmptyArray() throws Exception { + public void testNullToEmptyDoubleObjectEmptyArray() { final Double[] empty = new Double[]{}; final Double[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_DOUBLE_OBJECT_ARRAY, result); @@ -734,12 +734,12 @@ public class ArrayUtilsTest { } @Test - public void testNullToEmptyFloatObjectNull() throws Exception { + public void testNullToEmptyFloatObjectNull() { assertArrayEquals(ArrayUtils.EMPTY_FLOAT_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Float[]) null)); } @Test - public void testNullToEmptyFloatObjectEmptyArray() throws Exception { + public void testNullToEmptyFloatObjectEmptyArray() { final Float[] empty = new Float[]{}; final Float[] result = ArrayUtils.nullToEmpty(empty); assertArrayEquals(ArrayUtils.EMPTY_FLOAT_OBJECT_ARRAY, result); diff --git a/src/test/java/org/apache/commons/lang3/CharEncodingTest.java b/src/test/java/org/apache/commons/lang3/CharEncodingTest.java index b96a5d14d..37a09ae3e 100644 --- a/src/test/java/org/apache/commons/lang3/CharEncodingTest.java +++ b/src/test/java/org/apache/commons/lang3/CharEncodingTest.java @@ -73,7 +73,7 @@ public class CharEncodingTest { } @Test - public void testStandardCharsetsEquality() throws Exception { + public void testStandardCharsetsEquality() { assertEquals(StandardCharsets.ISO_8859_1.name(), CharEncoding.ISO_8859_1); assertEquals(StandardCharsets.US_ASCII.name(), CharEncoding.US_ASCII); assertEquals(StandardCharsets.UTF_8.name(), CharEncoding.UTF_8); diff --git a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java index 83b2ff8cb..abaf3461e 100644 --- a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java @@ -179,7 +179,7 @@ public class CharSequenceUtilsTest { @Test - public void testToCharArray() throws Exception { + public void testToCharArray() { final StringBuilder builder = new StringBuilder("abcdefg"); final char[] expected = builder.toString().toCharArray(); assertArrayEquals(expected, CharSequenceUtils.toCharArray(builder)); diff --git a/src/test/java/org/apache/commons/lang3/CharSetTest.java b/src/test/java/org/apache/commons/lang3/CharSetTest.java index 7401458da..50683f965 100644 --- a/src/test/java/org/apache/commons/lang3/CharSetTest.java +++ b/src/test/java/org/apache/commons/lang3/CharSetTest.java @@ -466,7 +466,7 @@ public class CharSetTest { } @Test - public void testJavadocExamples() throws Exception { + public void testJavadocExamples() { assertFalse(CharSet.getInstance("^a-c").contains('a')); assertTrue(CharSet.getInstance("^a-c").contains('d')); assertTrue(CharSet.getInstance("^^a-c").contains('a')); diff --git a/src/test/java/org/apache/commons/lang3/ClassPathUtilsTest.java b/src/test/java/org/apache/commons/lang3/ClassPathUtilsTest.java index ff67b8d23..aaf26d2a8 100644 --- a/src/test/java/org/apache/commons/lang3/ClassPathUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ClassPathUtilsTest.java @@ -53,7 +53,7 @@ public class ClassPathUtilsTest { } @Test - public void testToFullyQualifiedNameClassString() throws Exception { + public void testToFullyQualifiedNameClassString() { final String expected = "org.apache.commons.lang3.Test.properties"; final String actual = ClassPathUtils.toFullyQualifiedName(ClassPathUtils.class, "Test.properties"); @@ -73,7 +73,7 @@ public class ClassPathUtilsTest { } @Test - public void testToFullyQualifiedNamePackageString() throws Exception { + public void testToFullyQualifiedNamePackageString() { final String expected = "org.apache.commons.lang3.Test.properties"; final String actual = ClassPathUtils.toFullyQualifiedName(ClassPathUtils.class.getPackage(), "Test.properties"); @@ -92,7 +92,7 @@ public class ClassPathUtilsTest { } @Test - public void testToFullyQualifiedPathClass() throws Exception { + public void testToFullyQualifiedPathClass() { final String expected = "org/apache/commons/lang3/Test.properties"; final String actual = ClassPathUtils.toFullyQualifiedPath(ClassPathUtils.class, "Test.properties"); @@ -112,7 +112,7 @@ public class ClassPathUtilsTest { } @Test - public void testToFullyQualifiedPathPackage() throws Exception { + public void testToFullyQualifiedPathPackage() { final String expected = "org/apache/commons/lang3/Test.properties"; final String actual = ClassPathUtils.toFullyQualifiedPath(ClassPathUtils.class.getPackage(), "Test.properties"); diff --git a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java index 54d8949dc..219f0b856 100644 --- a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java @@ -92,7 +92,7 @@ public class ClassUtilsTest { assertEquals( c, ClassUtils.getClass( c.getName() ) ); } - private void assertGetClassThrowsClassNotFound( final String className ) throws Exception { + private void assertGetClassThrowsClassNotFound( final String className ) { assertGetClassThrowsException( className, ClassNotFoundException.class ); } @@ -102,7 +102,7 @@ public class ClassUtilsTest { "ClassUtils.getClass() should fail with an exception of type " + exceptionType.getName() + " when given class name \"" + className + "\"." ); } - private void assertGetClassThrowsNullPointerException( final String className ) throws Exception { + private void assertGetClassThrowsNullPointerException( final String className ) { assertGetClassThrowsException( className, NullPointerException.class ); } @@ -667,7 +667,7 @@ public class ClassUtilsTest { } @Test - public void test_isAssignable() throws Exception { + public void test_isAssignable() { assertFalse(ClassUtils.isAssignable((Class) null, null)); assertFalse(ClassUtils.isAssignable(String.class, null)); @@ -693,7 +693,7 @@ public class ClassUtilsTest { } @Test - public void test_isAssignable_Autoboxing() throws Exception { + public void test_isAssignable_Autoboxing() { assertFalse(ClassUtils.isAssignable((Class) null, null, true)); assertFalse(ClassUtils.isAssignable(String.class, null, true)); @@ -718,7 +718,7 @@ public class ClassUtilsTest { // ------------------------------------------------------------------------- @Test - public void test_isAssignable_ClassArray_ClassArray() throws Exception { + public void test_isAssignable_ClassArray_ClassArray() { final Class[] array2 = new Class[] {Object.class, Object.class}; final Class[] array1 = new Class[] {Object.class}; final Class[] array1s = new Class[] {String.class}; @@ -746,7 +746,7 @@ public class ClassUtilsTest { } @Test - public void test_isAssignable_ClassArray_ClassArray_Autoboxing() throws Exception { + public void test_isAssignable_ClassArray_ClassArray_Autoboxing() { final Class[] array2 = new Class[] {Object.class, Object.class}; final Class[] array1 = new Class[] {Object.class}; final Class[] array1s = new Class[] {String.class}; @@ -774,7 +774,7 @@ public class ClassUtilsTest { } @Test - public void test_isAssignable_ClassArray_ClassArray_NoAutoboxing() throws Exception { + public void test_isAssignable_ClassArray_ClassArray_NoAutoboxing() { final Class[] array2 = new Class[] {Object.class, Object.class}; final Class[] array1 = new Class[] {Object.class}; final Class[] array1s = new Class[] {String.class}; @@ -802,7 +802,7 @@ public class ClassUtilsTest { } @Test - public void test_isAssignable_DefaultUnboxing_Widening() throws Exception { + public void test_isAssignable_DefaultUnboxing_Widening() { // test byte conversions assertFalse(ClassUtils.isAssignable(Byte.class, Character.TYPE), "byte -> char"); assertTrue(ClassUtils.isAssignable(Byte.class, Byte.TYPE), "byte -> byte"); @@ -885,7 +885,7 @@ public class ClassUtilsTest { } @Test - public void test_isAssignable_NoAutoboxing() throws Exception { + public void test_isAssignable_NoAutoboxing() { assertFalse(ClassUtils.isAssignable((Class) null, null, false)); assertFalse(ClassUtils.isAssignable(String.class, null, false)); @@ -909,7 +909,7 @@ public class ClassUtilsTest { } @Test - public void test_isAssignable_Unboxing_Widening() throws Exception { + public void test_isAssignable_Unboxing_Widening() { // test byte conversions assertFalse(ClassUtils.isAssignable(Byte.class, Character.TYPE, true), "byte -> char"); assertTrue(ClassUtils.isAssignable(Byte.class, Byte.TYPE, true), "byte -> byte"); @@ -992,7 +992,7 @@ public class ClassUtilsTest { } @Test - public void test_isAssignable_Widening() throws Exception { + public void test_isAssignable_Widening() { // test byte conversions assertFalse(ClassUtils.isAssignable(Byte.TYPE, Character.TYPE), "byte -> char"); assertTrue(ClassUtils.isAssignable(Byte.TYPE, Byte.TYPE), "byte -> byte"); diff --git a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java index d428162e1..e5c140773 100644 --- a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java @@ -54,7 +54,7 @@ public class LocaleUtilsTest { private static final Locale LOCALE_QQ_ZZ = new Locale("qq", "ZZ"); @BeforeEach - public void setUp() throws Exception { + public void setUp() { // Testing #LANG-304. Must be called before availableLocaleSet is called. LocaleUtils.isAvailableLocale(Locale.getDefault()); } diff --git a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java index dd7aff566..ff8f8f54d 100644 --- a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java @@ -512,11 +512,9 @@ public class RandomStringUtilsTest { * Test for LANG-1286. Creates situation where old code would * overflow a char and result in a code point outside the specified * range. - * - * @throws Exception */ @Test - public void testCharOverflow() throws Exception { + public void testCharOverflow() { final int start = Character.MAX_VALUE; final int end = Integer.MAX_VALUE; diff --git a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java index c241d070e..6d77852f3 100644 --- a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java @@ -150,7 +150,7 @@ public class SerializationUtilsTest { } @Test - public void testSerializeIOException() throws Exception { + public void testSerializeIOException() { // forces an IOException when the ObjectOutputStream is created, to test not closing the stream // in the finally block final OutputStream streamTest = new OutputStream() { @@ -328,7 +328,7 @@ public class SerializationUtilsTest { //----------------------------------------------------------------------- @Test - public void testClone() throws Exception { + public void testClone() { final Object test = SerializationUtils.clone(iMap); assertNotNull(test); assertTrue(test instanceof HashMap); @@ -342,7 +342,7 @@ public class SerializationUtilsTest { } @Test - public void testCloneNull() throws Exception { + public void testCloneNull() { final Object test = SerializationUtils.clone(null); assertNull(test); } diff --git a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java index 4a8696238..795a7bc5c 100644 --- a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java @@ -245,12 +245,12 @@ public class StringEscapeUtilsTest { } @Test - public void testUnescapeUnknownEntity() throws Exception { + public void testUnescapeUnknownEntity() { assertEquals("&zzzz;", StringEscapeUtils.unescapeHtml4("&zzzz;")); } @Test - public void testEscapeHtmlVersions() throws Exception { + public void testEscapeHtmlVersions() { assertEquals("Β", StringEscapeUtils.escapeHtml4("\u0392")); assertEquals("\u0392", StringEscapeUtils.unescapeHtml4("Β")); @@ -287,7 +287,7 @@ public class StringEscapeUtilsTest { } @Test - public void testEscapeXml10() throws Exception { + public void testEscapeXml10() { assertEquals("a<b>c"d'e&f", StringEscapeUtils.escapeXml10("ac\"d'e&f")); assertEquals("a\tb\rc\nd", StringEscapeUtils.escapeXml10("a\tb\rc\nd"), "XML 1.0 should not escape \t \n \r"); assertEquals("ab", StringEscapeUtils.escapeXml10("a\u0000\u0001\u0008\u000b\u000c\u000e\u001fb"), @@ -302,7 +302,7 @@ public class StringEscapeUtilsTest { } @Test - public void testEscapeXml11() throws Exception { + public void testEscapeXml11() { assertEquals("a<b>c"d'e&f", StringEscapeUtils.escapeXml11("ac\"d'e&f")); assertEquals("a\tb\rc\nd", StringEscapeUtils.escapeXml11("a\tb\rc\nd"), "XML 1.1 should not escape \t \n \r"); assertEquals("ab", StringEscapeUtils.escapeXml11("a\u0000b"), "XML 1.1 should omit #x0"); @@ -393,7 +393,7 @@ public class StringEscapeUtilsTest { } @Test - public void testEscapeCsvString() throws Exception { + public void testEscapeCsvString() { assertEquals("foo.bar", StringEscapeUtils.escapeCsv("foo.bar")); assertEquals("\"foo,bar\"", StringEscapeUtils.escapeCsv("foo,bar")); assertEquals("\"foo\nbar\"", StringEscapeUtils.escapeCsv("foo\nbar")); @@ -429,7 +429,7 @@ public class StringEscapeUtilsTest { } @Test - public void testUnescapeCsvString() throws Exception { + public void testUnescapeCsvString() { assertEquals("foo.bar", StringEscapeUtils.unescapeCsv("foo.bar")); assertEquals("foo,bar", StringEscapeUtils.unescapeCsv("\"foo,bar\"")); assertEquals("foo\nbar", StringEscapeUtils.unescapeCsv("\"foo\nbar\"")); diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java index 16a4f8fb9..4da5f0bf0 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java @@ -2442,7 +2442,7 @@ public class StringUtilsTest { } @Test - public void testGetFuzzyDistance() throws Exception { + public void testGetFuzzyDistance() { assertEquals(0, StringUtils.getFuzzyDistance("", "", Locale.ENGLISH)); assertEquals(0, StringUtils.getFuzzyDistance("Workshop", "b", Locale.ENGLISH)); assertEquals(1, StringUtils.getFuzzyDistance("Room", "o", Locale.ENGLISH)); @@ -2884,7 +2884,7 @@ public class StringUtilsTest { } @Test - public void testEscapeSurrogatePairs() throws Exception { + public void testEscapeSurrogatePairs() { assertEquals("\uD83D\uDE30", StringEscapeUtils.escapeCsv("\uD83D\uDE30")); // Examples from https://en.wikipedia.org/wiki/UTF-16 assertEquals("\uD800\uDC00", StringEscapeUtils.escapeCsv("\uD800\uDC00")); @@ -2905,7 +2905,7 @@ public class StringUtilsTest { } @Test - public void testUnescapeSurrogatePairs() throws Exception { + public void testUnescapeSurrogatePairs() { assertEquals("\uD83D\uDE30", StringEscapeUtils.unescapeCsv("\uD83D\uDE30")); // Examples from https://en.wikipedia.org/wiki/UTF-16 assertEquals("\uD800\uDC00", StringEscapeUtils.unescapeCsv("\uD800\uDC00")); @@ -3145,7 +3145,7 @@ public class StringUtilsTest { } @Test - public void testToCodePoints() throws Exception { + public void testToCodePoints() { final int orphanedHighSurrogate = 0xD801; final int orphanedLowSurrogate = 0xDC00; final int supplementary = 0x2070E; diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java index f5cd4674a..e56d1b0a2 100644 --- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java @@ -420,7 +420,7 @@ public class SystemUtilsTest { } @Test - public void testIsJavaVersionAtLeast() throws Exception { + public void testIsJavaVersionAtLeast() { if (SystemUtils.IS_JAVA_1_7) { assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1)); assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2)); @@ -524,7 +524,7 @@ public class SystemUtilsTest { } @Test - public void testOsVersionMatches() throws Exception { + public void testOsVersionMatches() { String osVersion = null; assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.1")); diff --git a/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java b/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java index abc1a8db1..877fbb851 100644 --- a/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java @@ -108,17 +108,17 @@ public class ThreadUtilsTest { } @Test - public void testNoThread() throws InterruptedException { + public void testNoThread() { assertEquals(0, ThreadUtils.findThreadsByName("some_thread_which_does_not_exist_18762ZucTT").size()); } @Test - public void testNoThreadGroup() throws InterruptedException { + public void testNoThreadGroup() { assertEquals(0, ThreadUtils.findThreadGroupsByName("some_thread_group_which_does_not_exist_18762ZucTTII").size()); } @Test - public void testSystemThreadGroupExists() throws InterruptedException { + public void testSystemThreadGroupExists() { final ThreadGroup systemThreadGroup = ThreadUtils.getSystemThreadGroup(); assertNotNull(systemThreadGroup); assertNull(systemThreadGroup.getParent()); @@ -126,12 +126,12 @@ public class ThreadUtilsTest { } @Test - public void testAtLeastOneThreadExists() throws InterruptedException { + public void testAtLeastOneThreadExists() { assertTrue(ThreadUtils.getAllThreads().size() > 0); } @Test - public void testAtLeastOneThreadGroupsExists() throws InterruptedException { + public void testAtLeastOneThreadGroupsExists() { assertTrue(ThreadUtils.getAllThreadGroups().size() > 0); } @@ -278,7 +278,7 @@ public class ThreadUtilsTest { } @Test - public void testConstructor() throws InterruptedException { + public void testConstructor() { assertNotNull(new ThreadUtils()); final Constructor[] cons = ThreadUtils.class.getDeclaredConstructors(); assertEquals(1, cons.length); diff --git a/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java index eeb6b80e7..5fe5e46b1 100644 --- a/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java @@ -35,12 +35,12 @@ public class DefaultToStringStyleTest { private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base)); @BeforeEach - public void setUp() throws Exception { + public void setUp() { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } @AfterEach - public void tearDown() throws Exception { + public void tearDown() { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } diff --git a/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java index 6acab1624..d5b443e54 100644 --- a/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java @@ -107,7 +107,7 @@ public class DiffBuilderTest { } @Test - public void testBooleanArray() throws Exception { + public void testBooleanArray() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class2.booleanArrayField = new boolean[] {false, false}; @@ -134,7 +134,7 @@ public class DiffBuilderTest { } @Test - public void testByteArray() throws Exception { + public void testByteArray() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class2.byteArrayField= new byte[] {0x01, 0x02}; @@ -161,7 +161,7 @@ public class DiffBuilderTest { @Test - public void testCharArray() throws Exception { + public void testCharArray() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class2.charArrayField = new char[] {'f', 'o', 'o'}; @@ -189,7 +189,7 @@ public class DiffBuilderTest { @Test - public void testDoubleArray() throws Exception { + public void testDoubleArray() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class2.doubleArrayField = new double[] {3.0, 2.9, 2.8}; @@ -216,7 +216,7 @@ public class DiffBuilderTest { @Test - public void testFloatArray() throws Exception { + public void testFloatArray() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class2.floatArrayField = new float[] {3.0F, 2.9F, 2.8F}; @@ -244,7 +244,7 @@ public class DiffBuilderTest { @Test - public void testIntArray() throws Exception { + public void testIntArray() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class2.intArrayField = new int[] {3, 2, 1}; @@ -271,7 +271,7 @@ public class DiffBuilderTest { @Test - public void testLongArray() throws Exception { + public void testLongArray() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class2.longArrayField = new long[] {3L, 2L, 1L}; @@ -298,7 +298,7 @@ public class DiffBuilderTest { @Test - public void testShortArray() throws Exception { + public void testShortArray() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class2.shortArrayField = new short[] {3, 2, 1}; @@ -312,7 +312,7 @@ public class DiffBuilderTest { } @Test - public void testObject() throws Exception { + public void testObject() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class2.objectField = "Some string"; @@ -327,7 +327,7 @@ public class DiffBuilderTest { * Test that "left" and "right" are the same instance and are equal. */ @Test - public void testObjectsSameAndEqual() throws Exception { + public void testObjectsSameAndEqual() { final Integer sameObject = 1; final TypeTestClass left = new TypeTestClass(); left.objectField = sameObject; @@ -344,7 +344,7 @@ public class DiffBuilderTest { * Test that "left" and "right" are the same instance but are equal. */ @Test - public void testObjectsNotSameButEqual() throws Exception { + public void testObjectsNotSameButEqual() { final TypeTestClass left = new TypeTestClass(); left.objectField = new Integer(1); final TypeTestClass right = new TypeTestClass(); @@ -360,7 +360,7 @@ public class DiffBuilderTest { * Test that "left" and "right" are not the same instance and are not equal. */ @Test - public void testObjectsNotSameNorEqual() throws Exception { + public void testObjectsNotSameNorEqual() { final TypeTestClass left = new TypeTestClass(); left.objectField = 4; final TypeTestClass right = new TypeTestClass(); @@ -373,7 +373,7 @@ public class DiffBuilderTest { } @Test - public void testObjectArray() throws Exception { + public void testObjectArray() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class2.objectArrayField = new Object[] {"string", 1, 2}; @@ -385,7 +385,7 @@ public class DiffBuilderTest { } @Test - public void testObjectArrayEqual() throws Exception { + public void testObjectArrayEqual() { final TypeTestClass class1 = new TypeTestClass(); final TypeTestClass class2 = new TypeTestClass(); class1.objectArrayField = new Object[] {"string", 1, 2}; @@ -396,7 +396,7 @@ public class DiffBuilderTest { @Test - public void testByteArrayEqualAsObject() throws Exception { + public void testByteArrayEqualAsObject() { final DiffResult list = new DiffBuilder("String1", "String2", SHORT_STYLE) .append("foo", new boolean[] {false}, new boolean[] {false}) .append("foo", new byte[] {0x01}, new byte[] {0x01}) diff --git a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java index f200fd6e6..dd725edf4 100644 --- a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java @@ -1222,7 +1222,7 @@ public class EqualsBuilderTest { } @Test - public void testReflectionEqualsExcludeFields() throws Exception { + public void testReflectionEqualsExcludeFields() { final TestObjectWithMultipleFields x1 = new TestObjectWithMultipleFields(1, 2, 3); final TestObjectWithMultipleFields x2 = new TestObjectWithMultipleFields(1, 3, 4); @@ -1311,7 +1311,7 @@ public class EqualsBuilderTest { } @Test - public void testReflectionArrays() throws Exception { + public void testReflectionArrays() { final TestObject one = new TestObject(1); final TestObject two = new TestObject(2); diff --git a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java index 606e5288e..148c53388 100644 --- a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java @@ -487,7 +487,7 @@ public class HashCodeBuilderTest { } @Test - public void testReflectionHashCodeExcludeFields() throws Exception { + public void testReflectionHashCodeExcludeFields() { final TestObjectWithMultipleFields x = new TestObjectWithMultipleFields(1, 2, 3); assertEquals(((17 * 37 + 1) * 37 + 2) * 37 + 3, HashCodeBuilder.reflectionHashCode(x)); diff --git a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java index 5237a0916..1e22842e3 100644 --- a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java @@ -36,12 +36,12 @@ public class JsonToStringStyleTest { private final Integer base = Integer.valueOf(5); @BeforeEach - public void setUp() throws Exception { + public void setUp() { ToStringBuilder.setDefaultStyle(ToStringStyle.JSON_STYLE); } @AfterEach - public void tearDown() throws Exception { + public void tearDown() { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } diff --git a/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java index 6096cc060..bce681dd9 100644 --- a/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java @@ -35,12 +35,12 @@ public class MultiLineToStringStyleTest { private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base)); @BeforeEach - public void setUp() throws Exception { + public void setUp() { ToStringBuilder.setDefaultStyle(ToStringStyle.MULTI_LINE_STYLE); } @AfterEach - public void tearDown() throws Exception { + public void tearDown() { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } diff --git a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java index cff15f1ca..4eb1db4cb 100644 --- a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java @@ -203,7 +203,7 @@ public class MultilineRecursiveToStringStyleTest { @Test - public void testLANG1319() throws Exception { + public void testLANG1319() { final String[] stringArray = {"1", "2"}; final String exp = getClassPrefix(stringArray) + "[" + BR diff --git a/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java index 8c9c4ed07..97a1e4d99 100644 --- a/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java @@ -34,12 +34,12 @@ public class NoClassNameToStringStyleTest { private final Integer base = Integer.valueOf(5); @BeforeEach - public void setUp() throws Exception { + public void setUp() { ToStringBuilder.setDefaultStyle(ToStringStyle.NO_CLASS_NAME_STYLE); } @AfterEach - public void tearDown() throws Exception { + public void tearDown() { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } diff --git a/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java index 4d2faf342..12caa73f2 100644 --- a/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java @@ -35,12 +35,12 @@ public class NoFieldNamesToStringStyleTest { private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base)); @BeforeEach - public void setUp() throws Exception { + public void setUp() { ToStringBuilder.setDefaultStyle(ToStringStyle.NO_FIELD_NAMES_STYLE); } @AfterEach - public void tearDown() throws Exception { + public void tearDown() { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } diff --git a/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java index 8cb2ff539..9ef82f1fb 100644 --- a/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java @@ -34,12 +34,12 @@ public class RecursiveToStringStyleTest { private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base)); @BeforeEach - public void setUp() throws Exception { + public void setUp() { ToStringBuilder.setDefaultStyle(new RecursiveToStringStyle()); } @AfterEach - public void tearDown() throws Exception { + public void tearDown() { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java index 8c2bf755b..4542ff828 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java @@ -91,7 +91,7 @@ public class ReflectionToStringBuilderMutateInspectConcurrencyTest { @Test @Disabled - public void testConcurrency() throws Exception { + public void testConcurrency() { final TestFixture testFixture = new TestFixture(); final int numMutators = 10; final int numIterations = 10; diff --git a/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java index 2e7d2f902..c39939f18 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java @@ -35,12 +35,12 @@ public class ShortPrefixToStringStyleTest { private final String baseStr = "Integer"; @BeforeEach - public void setUp() throws Exception { + public void setUp() { ToStringBuilder.setDefaultStyle(ToStringStyle.SHORT_PREFIX_STYLE); } @AfterEach - public void tearDown() throws Exception { + public void tearDown() { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } diff --git a/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java index d69777772..f44433a22 100644 --- a/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java @@ -34,12 +34,12 @@ public class SimpleToStringStyleTest { private final Integer base = Integer.valueOf(5); @BeforeEach - public void setUp() throws Exception { + public void setUp() { ToStringBuilder.setDefaultStyle(ToStringStyle.SIMPLE_STYLE); } @AfterEach - public void tearDown() throws Exception { + public void tearDown() { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } diff --git a/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java index f169b5325..7d4b6a01b 100644 --- a/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java @@ -50,12 +50,12 @@ public class StandardToStringStyleTest { } @BeforeEach - public void setUp() throws Exception { + public void setUp() { ToStringBuilder.setDefaultStyle(STYLE); } @AfterEach - public void tearDown() throws Exception { + public void tearDown() { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java index 97cf4acf5..3366721e7 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java @@ -425,7 +425,7 @@ public class ToStringBuilderTest { } @Test - public void testReflectionArrayArrayCycle() throws Exception { + public void testReflectionArrayArrayCycle() { final Object[][] objects = new Object[2][2]; objects[0][0] = objects; objects[0][1] = objects; diff --git a/src/test/java/org/apache/commons/lang3/concurrent/AtomicInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/AtomicInitializerTest.java index 36f54b912..9b05a1ae3 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/AtomicInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/AtomicInitializerTest.java @@ -29,7 +29,7 @@ public class AtomicInitializerTest extends AbstractConcurrentInitializerTest { protected ConcurrentInitializer createInitializer() { return new AtomicInitializer() { @Override - protected Object initialize() throws ConcurrentException { + protected Object initialize() { return new Object(); } }; diff --git a/src/test/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializerTest.java index 818fd0998..f2d8ddc17 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializerTest.java @@ -32,7 +32,7 @@ public class AtomicSafeInitializerTest extends private AtomicSafeInitializerTestImpl initializer; @BeforeEach - public void setUp() throws Exception { + public void setUp() { initializer = new AtomicSafeInitializerTestImpl(); } @@ -70,7 +70,7 @@ public class AtomicSafeInitializerTest extends final AtomicInteger initCounter = new AtomicInteger(); @Override - protected Object initialize() throws ConcurrentException { + protected Object initialize() { initCounter.incrementAndGet(); return new Object(); } diff --git a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java index daa126fa7..cbb726de0 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java @@ -162,11 +162,9 @@ public class BackgroundInitializerTest { /** * Tests calling get() before start(). This should cause an exception. - * - * @throws org.apache.commons.lang3.concurrent.ConcurrentException because the test implementation may throw it */ @Test - public void testGetBeforeStart() throws ConcurrentException { + public void testGetBeforeStart() { final BackgroundInitializerTestImpl init = new BackgroundInitializerTestImpl(); assertThrows(IllegalStateException.class, init::get); } diff --git a/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java b/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java index 808499775..9d481f5d2 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java @@ -42,7 +42,7 @@ public class BasicThreadFactoryTest { private BasicThreadFactory.Builder builder; @BeforeEach - public void setUp() throws Exception { + public void setUp() { builder = new BasicThreadFactory.Builder(); } diff --git a/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java index 91f8097e3..accef5c78 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java @@ -98,7 +98,7 @@ public class CallableBackgroundInitializerTest { * Records this invocation and returns the test result. */ @Override - public Integer call() throws Exception { + public Integer call() { callCount++; return RESULT; } diff --git a/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java b/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java index 36665cce6..573f1388c 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java @@ -59,7 +59,7 @@ public class CircuitBreakingExceptionTest extends AbstractExceptionTest { } @Test - public void testWithCauseAndMessage() throws Exception { + public void testWithCauseAndMessage() { final Exception exception = new CircuitBreakingException(EXCEPTION_MESSAGE, generateCause()); assertNotNull(exception); assertEquals(EXCEPTION_MESSAGE, exception.getMessage(), WRONG_EXCEPTION_MESSAGE); @@ -70,7 +70,7 @@ public class CircuitBreakingExceptionTest extends AbstractExceptionTest { } @Test - public void testWithoutCause() throws Exception { + public void testWithoutCause() { final Exception exception = new CircuitBreakingException(EXCEPTION_MESSAGE); assertNotNull(exception); assertEquals(EXCEPTION_MESSAGE, exception.getMessage(), WRONG_EXCEPTION_MESSAGE); @@ -80,7 +80,7 @@ public class CircuitBreakingExceptionTest extends AbstractExceptionTest { } @Test - public void testWithoutMessage() throws Exception { + public void testWithoutMessage() { final Exception exception = new CircuitBreakingException(generateCause()); assertNotNull(exception); assertNotNull(exception.getMessage()); diff --git a/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java b/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java index eda01187d..a5374de17 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java @@ -183,11 +183,9 @@ public class ConcurrentUtilsTest { /** * Tests handleCause() if the cause is an error. - * - * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test - public void testHandleCauseError() throws ConcurrentException { + public void testHandleCauseError() { final Error err = new AssertionError("Test"); Error e = assertThrows(Error.class, () -> ConcurrentUtils.handleCause(new ExecutionException(err))); assertEquals(err, e, "Wrong error"); @@ -195,11 +193,9 @@ public class ConcurrentUtilsTest { /** * Tests handleCause() if the cause is an unchecked exception. - * - * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test - public void testHandleCauseUncheckedException() throws ConcurrentException { + public void testHandleCauseUncheckedException() { final RuntimeException rex = new RuntimeException("Test"); RuntimeException r = assertThrows(RuntimeException.class, () -> ConcurrentUtils.handleCause(new ExecutionException(rex))); diff --git a/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java index ed9257407..7e7055a27 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java @@ -35,7 +35,7 @@ public class ConstantInitializerTest { private ConstantInitializer init; @BeforeEach - public void setUp() throws Exception { + public void setUp() { init = new ConstantInitializer<>(VALUE); } diff --git a/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java index b41ca7f5d..16eb12451 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java @@ -26,7 +26,7 @@ public class LazyInitializerTest extends AbstractConcurrentInitializerTest { private LazyInitializerTestImpl initializer; @BeforeEach - public void setUp() throws Exception { + public void setUp() { initializer = new LazyInitializerTestImpl(); } diff --git a/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java index 112fe6b35..068b5b6db 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java @@ -42,7 +42,7 @@ public class MultiBackgroundInitializerTest { private MultiBackgroundInitializer initializer; @BeforeEach - public void setUp() throws Exception { + public void setUp() { initializer = new MultiBackgroundInitializer(); } diff --git a/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java b/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java index 281bdf0f3..d263abad1 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java @@ -290,11 +290,9 @@ public class TimedSemaphoreTest { /** * Tries to call acquire() after shutdown(). This should cause an exception. - * - * @throws java.lang.InterruptedException so we don't have to catch it */ @Test - public void testPassAfterShutdown() throws InterruptedException { + public void testPassAfterShutdown() { final TimedSemaphore semaphore = new TimedSemaphore(PERIOD, UNIT, LIMIT); semaphore.shutdown(); assertThrows(IllegalStateException.class, semaphore::acquire); diff --git a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java index 030fca112..6fde95222 100644 --- a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java @@ -179,7 +179,7 @@ public class EventUtilsTest { } @Override - public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { + public Object invoke(final Object proxy, final Method method, final Object[] args) { final Integer count = eventCounts.get(method.getName()); if (count == null) { eventCounts.put(method.getName(), Integer.valueOf(1)); diff --git a/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java b/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java index 9a2173e3a..3ea05e7ea 100644 --- a/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java +++ b/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java @@ -50,7 +50,7 @@ public class CloneFailedExceptionTest extends AbstractExceptionTest { } @Test - public void testWithCauseAndMessage() throws Exception { + public void testWithCauseAndMessage() { final Exception exception = new CloneFailedException(EXCEPTION_MESSAGE, generateCause()); assertNotNull(exception); assertEquals(EXCEPTION_MESSAGE, exception.getMessage(), WRONG_EXCEPTION_MESSAGE); @@ -61,7 +61,7 @@ public class CloneFailedExceptionTest extends AbstractExceptionTest { } @Test - public void testWithoutCause() throws Exception { + public void testWithoutCause() { final Exception exception = new CloneFailedException(EXCEPTION_MESSAGE); assertNotNull(exception); assertEquals(EXCEPTION_MESSAGE, exception.getMessage(), WRONG_EXCEPTION_MESSAGE); @@ -71,7 +71,7 @@ public class CloneFailedExceptionTest extends AbstractExceptionTest { } @Test - public void testWithoutMessage() throws Exception { + public void testWithoutMessage() { final Exception exception = new CloneFailedException(generateCause()); assertNotNull(exception); assertNotNull(exception.getMessage()); 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 ebaab3fde..035b0b8dd 100644 --- a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java @@ -67,7 +67,7 @@ public class ExceptionUtilsTest { @AfterEach - public void tearDown() throws Exception { + public void tearDown() { withoutCause = null; nested = null; withCause = null; @@ -364,14 +364,14 @@ public class ExceptionUtilsTest { //----------------------------------------------------------------------- @Test - public void testPrintRootCauseStackTrace_Throwable() throws Exception { + public void testPrintRootCauseStackTrace_Throwable() { ExceptionUtils.printRootCauseStackTrace(null); // could pipe system.err to a known stream, but not much point as // internally this method calls stream method anyway } @Test - public void testPrintRootCauseStackTrace_ThrowableStream() throws Exception { + public void testPrintRootCauseStackTrace_ThrowableStream() { ByteArrayOutputStream out = new ByteArrayOutputStream(1024); ExceptionUtils.printRootCauseStackTrace(null, (PrintStream) null); ExceptionUtils.printRootCauseStackTrace(null, new PrintStream(out)); @@ -395,7 +395,7 @@ public class ExceptionUtilsTest { } @Test - public void testPrintRootCauseStackTrace_ThrowableWriter() throws Exception { + public void testPrintRootCauseStackTrace_ThrowableWriter() { StringWriter writer = new StringWriter(1024); ExceptionUtils.printRootCauseStackTrace(null, (PrintWriter) null); ExceptionUtils.printRootCauseStackTrace(null, new PrintWriter(writer)); @@ -420,7 +420,7 @@ public class ExceptionUtilsTest { //----------------------------------------------------------------------- @Test - public void testGetRootCauseStackTrace_Throwable() throws Exception { + public void testGetRootCauseStackTrace_Throwable() { assertEquals(0, ExceptionUtils.getRootCauseStackTrace(null).length); final Throwable cause = createExceptionWithCause(); @@ -446,7 +446,7 @@ public class ExceptionUtilsTest { } @Test - public void testRemoveCommonFrames_ListList() throws Exception { + public void testRemoveCommonFrames_ListList() { assertThrows(IllegalArgumentException.class, () -> ExceptionUtils.removeCommonFrames(null, null)); } @@ -550,7 +550,7 @@ public class ExceptionUtilsTest { assertEquals(1, ExceptionUtils.getThrowableCount(ioe)); } - private static int redeclareCheckedException() throws IOException { + private static int redeclareCheckedException() { return throwsCheckedException(); } diff --git a/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java index ed4cbb2a2..4519d5f09 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java @@ -130,7 +130,7 @@ public class ConstructorUtilsTest { @BeforeEach - public void setUp() throws Exception { + public void setUp() { classCache.clear(); } @@ -207,7 +207,7 @@ public class ConstructorUtilsTest { } @Test - public void testGetAccessibleConstructorFromDescription() throws Exception { + public void testGetAccessibleConstructorFromDescription() { assertNotNull(ConstructorUtils.getAccessibleConstructor(Object.class, ArrayUtils.EMPTY_CLASS_ARRAY)); assertNull(ConstructorUtils.getAccessibleConstructor( @@ -215,7 +215,7 @@ public class ConstructorUtilsTest { } @Test - public void testGetMatchingAccessibleMethod() throws Exception { + public void testGetMatchingAccessibleMethod() { expectMatchingAccessibleConstructorParameterTypes(TestBean.class, ArrayUtils.EMPTY_CLASS_ARRAY, ArrayUtils.EMPTY_CLASS_ARRAY); expectMatchingAccessibleConstructorParameterTypes(TestBean.class, null, diff --git a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java index d542b7296..9ed912330 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java @@ -335,7 +335,7 @@ public class FieldUtilsTest { } @Test - public void testReadStaticFieldIllegalArgumentException1() throws Exception { + public void testReadStaticFieldIllegalArgumentException1() { assertThrows(IllegalArgumentException.class, () -> FieldUtils.readStaticField(null)); } @@ -354,12 +354,12 @@ public class FieldUtilsTest { } @Test - public void testReadStaticFieldForceAccessIllegalArgumentException1() throws Exception { + public void testReadStaticFieldForceAccessIllegalArgumentException1() { assertThrows(IllegalArgumentException.class, () -> FieldUtils.readStaticField(null, true)); } @Test - public void testReadStaticFieldForceAccessIllegalArgumentException2() throws Exception { + public void testReadStaticFieldForceAccessIllegalArgumentException2() { final Field nonStaticField = FieldUtils.getField(PublicChild.class, "s", true); assumeTrue(nonStaticField != null); assertThrows(IllegalArgumentException.class, () -> FieldUtils.readStaticField(nonStaticField)); diff --git a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java index b0f490725..3bbf2a966 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java @@ -317,7 +317,7 @@ public class MethodUtilsTest { private final Map, Class[]> classCache = new HashMap<>(); @BeforeEach - public void setUp() throws Exception { + public void setUp() { testBean = new TestBean(); classCache.clear(); } @@ -328,7 +328,7 @@ public class MethodUtilsTest { } @Test - public void verifyJavaVarargsOverloadingResolution() throws Exception { + public void verifyJavaVarargsOverloadingResolution() { // This code is not a test of MethodUtils. // Rather it makes explicit the behavior of the Java specification for // various cases of overload resolution. @@ -564,8 +564,7 @@ public class MethodUtilsTest { } @Test - public void testGetAccessibleInterfaceMethodFromDescription() - throws Exception { + public void testGetAccessibleInterfaceMethodFromDescription() { final Class[][] p = {ArrayUtils.EMPTY_CLASS_ARRAY, null}; for (final Class[] element : p) { final Method accessibleMethod = MethodUtils.getAccessibleMethod( @@ -582,7 +581,7 @@ public class MethodUtilsTest { } @Test - public void testGetAccessiblePublicMethodFromDescription() throws Exception { + public void testGetAccessiblePublicMethodFromDescription() { assertSame(MutableObject.class, MethodUtils.getAccessibleMethod( MutableObject.class, "getValue", ArrayUtils.EMPTY_CLASS_ARRAY) .getDeclaringClass()); @@ -596,7 +595,7 @@ public class MethodUtilsTest { } @Test - public void testGetMatchingAccessibleMethod() throws Exception { + public void testGetMatchingAccessibleMethod() { expectMatchingAccessibleMethodParameterTypes(TestBean.class, "foo", ArrayUtils.EMPTY_CLASS_ARRAY, ArrayUtils.EMPTY_CLASS_ARRAY); expectMatchingAccessibleMethodParameterTypes(TestBean.class, "foo", @@ -710,7 +709,7 @@ public class MethodUtilsTest { } @Test - public void testGetMethodsWithAnnotationSearchSupersAndIgnoreAccess() throws NoSuchMethodException { + public void testGetMethodsWithAnnotationSearchSupersAndIgnoreAccess() { assertArrayEquals(new Method[0], MethodUtils.getMethodsWithAnnotation(Object.class, Annotated.class, true, true)); @@ -730,7 +729,7 @@ public class MethodUtilsTest { } @Test - public void testGetMethodsWithAnnotationNotSearchSupersButIgnoreAccess() throws NoSuchMethodException { + public void testGetMethodsWithAnnotationNotSearchSupersButIgnoreAccess() { assertArrayEquals(new Method[0], MethodUtils.getMethodsWithAnnotation(Object.class, Annotated.class, false, true)); @@ -744,7 +743,7 @@ public class MethodUtilsTest { } @Test - public void testGetMethodsWithAnnotationSearchSupersButNotIgnoreAccess() throws NoSuchMethodException { + public void testGetMethodsWithAnnotationSearchSupersButNotIgnoreAccess() { assertArrayEquals(new Method[0], MethodUtils.getMethodsWithAnnotation(Object.class, Annotated.class, true, false)); @@ -760,7 +759,7 @@ public class MethodUtilsTest { } @Test - public void testGetMethodsWithAnnotationNotSearchSupersAndNotIgnoreAccess() throws NoSuchMethodException { + public void testGetMethodsWithAnnotationNotSearchSupersAndNotIgnoreAccess() { assertArrayEquals(new Method[0], MethodUtils.getMethodsWithAnnotation(Object.class, Annotated.class, false, false)); diff --git a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java index 2b0d37846..66cf39d74 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java @@ -532,7 +532,7 @@ public class TypeUtilsTest { } @Test - public void testTypesSatisfyVariables() throws SecurityException, NoSuchFieldException, + public void testTypesSatisfyVariables() throws SecurityException, NoSuchMethodException { final Map, Type> typeVarAssigns = new HashMap<>(); final Integer max = TypeUtilsTest. stub(); @@ -548,7 +548,7 @@ public class TypeUtilsTest { @Test public void testDetermineTypeVariableAssignments() throws SecurityException, - NoSuchFieldException, NoSuchMethodException { + NoSuchFieldException { final ParameterizedType iterableType = (ParameterizedType) getClass().getField("iterable") .getGenericType(); final Map, Type> typeVarAssigns = TypeUtils.determineTypeArguments(TreeSet.class, @@ -634,7 +634,7 @@ public class TypeUtilsTest { } @Test - public void testGetPrimitiveArrayComponentType() throws Exception { + public void testGetPrimitiveArrayComponentType() { assertEquals(boolean.class, TypeUtils.getArrayComponentType(boolean[].class)); assertEquals(byte.class, TypeUtils.getArrayComponentType(byte[].class)); assertEquals(short.class, TypeUtils.getArrayComponentType(short[].class)); @@ -679,7 +679,7 @@ public class TypeUtilsTest { } @Test - public void testLang820() throws Exception { + public void testLang820() { final Type[] typeArray = {String.class, String.class}; final Type[] expectedArray = {String.class}; assertArrayEquals(expectedArray, TypeUtils.normalizeUpperBounds(typeArray)); diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java index 6185f3bde..efa59706f 100644 --- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java +++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java @@ -48,7 +48,7 @@ public class ExtendedMessageFormatTest { private final Map registry = new HashMap<>(); @BeforeEach - public void setUp() throws Exception { + public void setUp() { registry.put("lower", new LowerCaseFormatFactory()); registry.put("upper", new UpperCaseFormatFactory()); } diff --git a/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java b/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java index d65229065..b09065f17 100644 --- a/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java @@ -1560,7 +1560,7 @@ public class StrBuilderTest { //----------------------------------------------------------------------- @Test - public void testAsTokenizer() throws Exception { + public void testAsTokenizer() { // from Javadoc final StrBuilder b = new StrBuilder(); b.append("a b "); @@ -1740,7 +1740,7 @@ public class StrBuilderTest { } @Test - public void test_LANG_1131_EqualsWithNullStrBuilder() throws Exception { + public void test_LANG_1131_EqualsWithNullStrBuilder() { final StrBuilder sb = new StrBuilder(); final StrBuilder other = null; assertFalse(sb.equals(other)); diff --git a/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java b/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java index 3ed6719f6..ea8c271ea 100644 --- a/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java +++ b/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java @@ -42,14 +42,14 @@ public class StrSubstitutorTest { private Map values; @BeforeEach - public void setUp() throws Exception { + public void setUp() { values = new HashMap<>(); values.put("animal", "quick brown fox"); values.put("target", "lazy dog"); } @AfterEach - public void tearDown() throws Exception { + public void tearDown() { values = null; } diff --git a/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java b/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java index 6d1749252..201ddf354 100644 --- a/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java @@ -420,7 +420,7 @@ public class WordUtilsTest { } @Test - public void testLANG1292() throws Exception { + public void testLANG1292() { // Prior to fix, this was throwing StringIndexOutOfBoundsException WordUtils.wrap("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " @@ -428,7 +428,7 @@ public class WordUtilsTest { } @Test - public void testLANG1397() throws Exception { + public void testLANG1397() { // Prior to fix, this was throwing StringIndexOutOfBoundsException WordUtils.wrap("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java index f20c4c3dd..31679de72 100644 --- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java @@ -139,7 +139,7 @@ public class DateFormatUtilsTest { } @Test - public void testDateTimeISO() throws Exception { + public void testDateTimeISO() { testGmtMinus3("2002-02-23T09:11:12", DateFormatUtils.ISO_DATETIME_FORMAT.getPattern()); testGmtMinus3("2002-02-23T09:11:12-03:00", DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()); testUTC("2002-02-23T09:11:12Z", DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()); @@ -204,7 +204,7 @@ public class DateFormatUtilsTest { * This method test that the bug is fixed. */ @Test - public void testLang916() throws Exception { + public void testLang916() { final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris")); cal.clear(); diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java index 76154e691..5d238e7dc 100644 --- a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java +++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java @@ -518,13 +518,13 @@ testResult); } @Test - public void testDaysOfMonthWithCalendar() throws Exception { + public void testDaysOfMonthWithCalendar() { final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.MONTH); assertEquals(days, testResult); } @Test - public void testDaysOfMonthWithDate() throws Exception { + public void testDaysOfMonthWithDate() { final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.MONTH); final Calendar cal = Calendar.getInstance(); cal.setTime(aDate); @@ -532,13 +532,13 @@ testResult); } @Test - public void testDaysOfYearWithCalendar() throws Exception { + public void testDaysOfYearWithCalendar() { final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.YEAR); assertEquals(aCalendar.get(Calendar.DAY_OF_YEAR), testResult); } @Test - public void testDaysOfYearWithDate() throws Exception { + public void testDaysOfYearWithDate() { final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.YEAR); final Calendar cal = Calendar.getInstance(); cal.setTime(aDate); diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java index bf6ca55ca..2aba15982 100644 --- a/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java +++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java @@ -596,7 +596,7 @@ public class DateUtilsRoundingTest { * @since 3.0 */ @Test - public void testTruncateMilliSecond() throws Exception { + public void testTruncateMilliSecond() { final int calendarField = Calendar.MILLISECOND; baseTruncateTest(targetMilliSecondDate, targetMilliSecondDate, calendarField); } diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java index e90e84e86..993a130bf 100644 --- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java @@ -654,7 +654,7 @@ public class DateUtilsTest { } //----------------------------------------------------------------------- - private void assertDate(final Date date, final int year, final int month, final int day, final int hour, final int min, final int sec, final int mil) throws Exception { + private void assertDate(final Date date, final int year, final int month, final int day, final int hour, final int min, final int sec, final int mil) { final GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); assertEquals(year, cal.get(Calendar.YEAR)); @@ -1154,12 +1154,10 @@ public class DateUtilsTest { /** * Tests for LANG-59 * - * @throws java.lang.Exception so we don't have to catch it - * * see http://issues.apache.org/jira/browse/LANG-59 */ @Test - public void testTruncateLang59() throws Exception { + public void testTruncateLang59() { try { // Set TimeZone to Mountain Time final TimeZone denverZone = TimeZone.getTimeZone("America/Denver"); @@ -1472,11 +1470,9 @@ public class DateUtilsTest { /** * Tests the iterator exceptions - * - * @throws java.lang.Exception so we don't have to catch it */ @Test - public void testIteratorEx() throws Exception { + public void testIteratorEx() { assertThrows(IllegalArgumentException.class, () -> DateUtils.iterator(Calendar.getInstance(), -9999)); assertThrows (IllegalArgumentException.class, () -> DateUtils.iterator((Date) null, DateUtils.RANGE_WEEK_CENTER)); @@ -1489,11 +1485,9 @@ public class DateUtilsTest { /** * Tests the calendar iterator for week ranges - * - * @throws java.lang.Exception so we don't have to catch it */ @Test - public void testWeekIterator() throws Exception { + public void testWeekIterator() { final Calendar now = Calendar.getInstance(); for (int i = 0; i< 7; i++) { final Calendar today = DateUtils.truncate(now, Calendar.DATE); diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java index b64f2cb65..c6ee1fe4f 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java @@ -318,7 +318,7 @@ public class FastDateFormatTest { } @Test - public void testLANG_1267() throws Exception { + public void testLANG_1267() { FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); } } diff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java index 30ff696cb..8a05740ec 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java @@ -23,7 +23,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.text.FieldPosition; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; @@ -262,7 +261,7 @@ public class FastDatePrinterTest { @DefaultTimeZone("UTC") @Test - public void testTimeZoneAsZ() throws Exception { + public void testTimeZoneAsZ() { final Calendar c = Calendar.getInstance(FastTimeZone.getGmtTimeZone()); final FastDateFormat noColonFormat = FastDateFormat.getInstance("Z"); assertEquals("+0000", noColonFormat.format(c)); @@ -309,7 +308,7 @@ public class FastDatePrinterTest { } @Test - public void test1806() throws ParseException { + public void test1806() { for (final Expected1806 trial : Expected1806.values()) { final Calendar cal = initializeCalendar(trial.zone); @@ -325,7 +324,7 @@ public class FastDatePrinterTest { } @Test - public void testLang1103() throws ParseException { + public void testLang1103() { final Calendar cal = Calendar.getInstance(SWEDEN); cal.set(Calendar.DAY_OF_MONTH, 2); @@ -343,7 +342,7 @@ public class FastDatePrinterTest { * This method test that the bug is fixed. */ @Test - public void testLang916() throws Exception { + public void testLang916() { final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris")); cal.clear(); diff --git a/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java b/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java index 0e4517218..6728b0f8d 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java @@ -36,7 +36,7 @@ import org.junit.jupiter.api.Test; public class ImmutablePairTest { @Test - public void testBasic() throws Exception { + public void testBasic() { final ImmutablePair pair = new ImmutablePair<>(0, "foo"); assertEquals(0, pair.left.intValue()); assertEquals(0, pair.getLeft().intValue()); @@ -50,7 +50,7 @@ public class ImmutablePairTest { } @Test - public void testPairOf() throws Exception { + public void testPairOf() { final ImmutablePair pair = ImmutablePair.of(0, "foo"); assertEquals(0, pair.left.intValue()); assertEquals(0, pair.getLeft().intValue()); @@ -64,7 +64,7 @@ public class ImmutablePairTest { } @Test - public void testEquals() throws Exception { + public void testEquals() { assertEquals(ImmutablePair.of(null, "foo"), ImmutablePair.of(null, "foo")); assertFalse(ImmutablePair.of("foo", 0).equals(ImmutablePair.of("foo", null))); assertFalse(ImmutablePair.of("foo", "bar").equals(ImmutablePair.of("xyz", "bar"))); @@ -75,7 +75,7 @@ public class ImmutablePairTest { } @Test - public void testHashCode() throws Exception { + public void testHashCode() { assertEquals(ImmutablePair.of(null, "foo").hashCode(), ImmutablePair.of(null, "foo").hashCode()); } @@ -118,7 +118,7 @@ public class ImmutablePairTest { } @Test - public void testToString() throws Exception { + public void testToString() { assertEquals("(null,null)", ImmutablePair.of(null, null).toString()); assertEquals("(null,two)", ImmutablePair.of(null, "two").toString()); assertEquals("(one,null)", ImmutablePair.of("one", null).toString()); diff --git a/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java b/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java index 575687621..874300fc9 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java @@ -36,7 +36,7 @@ import org.junit.jupiter.api.Test; public class ImmutableTripleTest { @Test - public void testBasic() throws Exception { + public void testBasic() { final ImmutableTriple triple = new ImmutableTriple<>(0, "foo", Boolean.TRUE); assertEquals(0, triple.left.intValue()); assertEquals(0, triple.getLeft().intValue()); @@ -54,7 +54,7 @@ public class ImmutableTripleTest { } @Test - public void testTripleOf() throws Exception { + public void testTripleOf() { final ImmutableTriple triple = ImmutableTriple.of(0, "foo", Boolean.FALSE); assertEquals(0, triple.left.intValue()); assertEquals(0, triple.getLeft().intValue()); @@ -72,7 +72,7 @@ public class ImmutableTripleTest { } @Test - public void testEquals() throws Exception { + public void testEquals() { assertEquals(ImmutableTriple.of(null, "foo", 42), ImmutableTriple.of(null, "foo", 42)); assertFalse(ImmutableTriple.of("foo", 0, Boolean.TRUE).equals(ImmutableTriple.of("foo", null, null))); assertFalse(ImmutableTriple.of("foo", "bar", "baz").equals(ImmutableTriple.of("xyz", "bar", "blo"))); @@ -83,7 +83,7 @@ public class ImmutableTripleTest { } @Test - public void testHashCode() throws Exception { + public void testHashCode() { assertEquals(ImmutableTriple.of(null, "foo", Boolean.TRUE).hashCode(), ImmutableTriple.of(null, "foo", Boolean.TRUE).hashCode()); } @@ -121,7 +121,7 @@ public class ImmutableTripleTest { } @Test - public void testToString() throws Exception { + public void testToString() { assertEquals("(null,null,null)", ImmutableTriple.of(null, null, null).toString()); assertEquals("(null,two,null)", ImmutableTriple.of(null, "two", null).toString()); assertEquals("(one,null,null)", ImmutableTriple.of("one", null, null).toString()); diff --git a/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java b/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java index 6dcdeee0e..a3e3965ee 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; public class MutablePairTest { @Test - public void testBasic() throws Exception { + public void testBasic() { final MutablePair pair = new MutablePair<>(0, "foo"); assertEquals(0, pair.getLeft().intValue()); assertEquals("foo", pair.getRight()); @@ -44,14 +44,14 @@ public class MutablePairTest { } @Test - public void testDefault() throws Exception { + public void testDefault() { final MutablePair pair = new MutablePair<>(); assertNull(pair.getLeft()); assertNull(pair.getRight()); } @Test - public void testMutate() throws Exception { + public void testMutate() { final MutablePair pair = new MutablePair<>(0, "foo"); pair.setLeft(42); pair.setRight("bar"); @@ -60,7 +60,7 @@ public class MutablePairTest { } @Test - public void testPairOf() throws Exception { + public void testPairOf() { final MutablePair pair = MutablePair.of(0, "foo"); assertEquals(0, pair.getLeft().intValue()); assertEquals("foo", pair.getRight()); @@ -70,7 +70,7 @@ public class MutablePairTest { } @Test - public void testEquals() throws Exception { + public void testEquals() { assertEquals(MutablePair.of(null, "foo"), MutablePair.of(null, "foo")); assertFalse(MutablePair.of("foo", 0).equals(MutablePair.of("foo", null))); assertFalse(MutablePair.of("foo", "bar").equals(MutablePair.of("xyz", "bar"))); @@ -81,12 +81,12 @@ public class MutablePairTest { } @Test - public void testHashCode() throws Exception { + public void testHashCode() { assertEquals(MutablePair.of(null, "foo").hashCode(), MutablePair.of(null, "foo").hashCode()); } @Test - public void testToString() throws Exception { + public void testToString() { assertEquals("(null,null)", MutablePair.of(null, null).toString()); assertEquals("(null,two)", MutablePair.of(null, "two").toString()); assertEquals("(one,null)", MutablePair.of("one", null).toString()); diff --git a/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java b/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java index e8b9c46dc..01c2ae0cf 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; public class MutableTripleTest { @Test - public void testBasic() throws Exception { + public void testBasic() { final MutableTriple triple = new MutableTriple<>(0, "foo", Boolean.FALSE); assertEquals(0, triple.getLeft().intValue()); assertEquals("foo", triple.getMiddle()); @@ -46,7 +46,7 @@ public class MutableTripleTest { } @Test - public void testDefault() throws Exception { + public void testDefault() { final MutableTriple triple = new MutableTriple<>(); assertNull(triple.getLeft()); assertNull(triple.getMiddle()); @@ -54,7 +54,7 @@ public class MutableTripleTest { } @Test - public void testMutate() throws Exception { + public void testMutate() { final MutableTriple triple = new MutableTriple<>(0, "foo", Boolean.TRUE); triple.setLeft(42); triple.setMiddle("bar"); @@ -65,7 +65,7 @@ public class MutableTripleTest { } @Test - public void testTripleOf() throws Exception { + public void testTripleOf() { final MutableTriple triple = MutableTriple.of(0, "foo", Boolean.TRUE); assertEquals(0, triple.getLeft().intValue()); assertEquals("foo", triple.getMiddle()); @@ -77,7 +77,7 @@ public class MutableTripleTest { } @Test - public void testEquals() throws Exception { + public void testEquals() { assertEquals(MutableTriple.of(null, "foo", "baz"), MutableTriple.of(null, "foo", "baz")); assertFalse(MutableTriple.of("foo", 0, Boolean.TRUE).equals(MutableTriple.of("foo", null, Boolean.TRUE))); assertFalse(MutableTriple.of("foo", "bar", "baz").equals(MutableTriple.of("xyz", "bar", "baz"))); @@ -89,12 +89,12 @@ public class MutableTripleTest { } @Test - public void testHashCode() throws Exception { + public void testHashCode() { assertEquals(MutableTriple.of(null, "foo", "baz").hashCode(), MutableTriple.of(null, "foo", "baz").hashCode()); } @Test - public void testToString() throws Exception { + public void testToString() { assertEquals("(null,null,null)", MutableTriple.of(null, null, null).toString()); assertEquals("(null,two,null)", MutableTriple.of(null, "two", null).toString()); assertEquals("(one,null,null)", MutableTriple.of("one", null, null).toString()); diff --git a/src/test/java/org/apache/commons/lang3/tuple/PairTest.java b/src/test/java/org/apache/commons/lang3/tuple/PairTest.java index 1c6e74ba7..2dc548357 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/PairTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/PairTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; public class PairTest { @Test - public void testPairOf() throws Exception { + public void testPairOf() { final Pair pair = Pair.of(0, "foo"); assertTrue(pair instanceof ImmutablePair); assertEquals(0, ((ImmutablePair) pair).left.intValue()); @@ -46,7 +46,7 @@ public class PairTest { } @Test - public void testCompatibilityBetweenPairs() throws Exception { + public void testCompatibilityBetweenPairs() { final Pair pair = ImmutablePair.of(0, "foo"); final Pair pair2 = MutablePair.of(0, "foo"); assertEquals(pair, pair2); @@ -61,7 +61,7 @@ public class PairTest { } @Test - public void testMapEntry() throws Exception { + public void testMapEntry() { final Pair pair = ImmutablePair.of(0, "foo"); final HashMap map = new HashMap<>(); map.put(0, "foo"); @@ -71,7 +71,7 @@ public class PairTest { } @Test - public void testComparable1() throws Exception { + public void testComparable1() { final Pair pair1 = Pair.of("A", "D"); final Pair pair2 = Pair.of("B", "C"); assertTrue(pair1.compareTo(pair1) == 0); @@ -81,7 +81,7 @@ public class PairTest { } @Test - public void testComparable2() throws Exception { + public void testComparable2() { final Pair pair1 = Pair.of("A", "C"); final Pair pair2 = Pair.of("A", "D"); assertTrue(pair1.compareTo(pair1) == 0); @@ -91,13 +91,13 @@ public class PairTest { } @Test - public void testToString() throws Exception { + public void testToString() { final Pair pair = Pair.of("Key", "Value"); assertEquals("(Key,Value)", pair.toString()); } @Test - public void testToStringCustom() throws Exception { + public void testToStringCustom() { final Calendar date = Calendar.getInstance(); date.set(2011, Calendar.APRIL, 25); final Pair pair = Pair.of("DOB", date); @@ -105,13 +105,13 @@ public class PairTest { } @Test - public void testFormattable_simple() throws Exception { + public void testFormattable_simple() { final Pair pair = Pair.of("Key", "Value"); assertEquals("(Key,Value)", String.format("%1$s", pair)); } @Test - public void testFormattable_padded() throws Exception { + public void testFormattable_padded() { final Pair pair = Pair.of("Key", "Value"); assertEquals(" (Key,Value)", String.format("%1$20s", pair)); } diff --git a/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java b/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java index 89f69af12..efa0ee74f 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java @@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test; public class TripleTest { @Test - public void testTripleOf() throws Exception { + public void testTripleOf() { final Triple triple = Triple.of(0, "foo", Boolean.TRUE); assertTrue(triple instanceof ImmutableTriple); assertEquals(0, ((ImmutableTriple) triple).left.intValue()); @@ -45,7 +45,7 @@ public class TripleTest { } @Test - public void testCompatibilityBetweenTriples() throws Exception { + public void testCompatibilityBetweenTriples() { final Triple triple = ImmutableTriple.of(0, "foo", Boolean.TRUE); final Triple triple2 = MutableTriple.of(0, "foo", Boolean.TRUE); assertEquals(triple, triple2); @@ -56,7 +56,7 @@ public class TripleTest { } @Test - public void testComparable1() throws Exception { + public void testComparable1() { final Triple triple1 = Triple.of("A", "D", "A"); final Triple triple2 = Triple.of("B", "C", "A"); assertTrue(triple1.compareTo(triple1) == 0); @@ -66,7 +66,7 @@ public class TripleTest { } @Test - public void testComparable2() throws Exception { + public void testComparable2() { final Triple triple1 = Triple.of("A", "C", "B"); final Triple triple2 = Triple.of("A", "D", "B"); assertTrue(triple1.compareTo(triple1) == 0); @@ -76,7 +76,7 @@ public class TripleTest { } @Test - public void testComparable3() throws Exception { + public void testComparable3() { final Triple triple1 = Triple.of("A", "A", "D"); final Triple triple2 = Triple.of("A", "B", "C"); assertTrue(triple1.compareTo(triple1) == 0); @@ -86,7 +86,7 @@ public class TripleTest { } @Test - public void testComparable4() throws Exception { + public void testComparable4() { final Triple triple1 = Triple.of("B", "A", "C"); final Triple triple2 = Triple.of("B", "A", "D"); assertTrue(triple1.compareTo(triple1) == 0); @@ -96,13 +96,13 @@ public class TripleTest { } @Test - public void testToString() throws Exception { + public void testToString() { final Triple triple = Triple.of("Key", "Something", "Value"); assertEquals("(Key,Something,Value)", triple.toString()); } @Test - public void testToStringCustom() throws Exception { + public void testToStringCustom() { final Calendar date = Calendar.getInstance(); date.set(2011, Calendar.APRIL, 25); final Triple triple = Triple.of("DOB", "string", date); @@ -110,13 +110,13 @@ public class TripleTest { } @Test - public void testFormattable_simple() throws Exception { + public void testFormattable_simple() { final Triple triple = Triple.of("Key", "Something", "Value"); assertEquals("(Key,Something,Value)", String.format("%1$s", triple)); } @Test - public void testFormattable_padded() throws Exception { + public void testFormattable_padded() { final Triple triple = Triple.of("Key", "Something", "Value"); assertEquals(" (Key,Something,Value)", String.format("%1$30s", triple)); }