Clean up redundant throws clauses
This commit is contained in:
parent
e00e871d1d
commit
b3d86ca08a
|
@ -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"};
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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("a<b>c\"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("a<b>c\"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\""));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"));
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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})
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -29,7 +29,7 @@ public class AtomicInitializerTest extends AbstractConcurrentInitializerTest {
|
|||
protected ConcurrentInitializer<Object> createInitializer() {
|
||||
return new AtomicInitializer<Object>() {
|
||||
@Override
|
||||
protected Object initialize() throws ConcurrentException {
|
||||
protected Object initialize() {
|
||||
return new Object();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class BasicThreadFactoryTest {
|
|||
private BasicThreadFactory.Builder builder;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
builder = new BasicThreadFactory.Builder();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -35,7 +35,7 @@ public class ConstantInitializerTest {
|
|||
private ConstantInitializer<Integer> init;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
init = new ConstantInitializer<>(VALUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class LazyInitializerTest extends AbstractConcurrentInitializerTest {
|
|||
private LazyInitializerTestImpl initializer;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
initializer = new LazyInitializerTestImpl();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class MultiBackgroundInitializerTest {
|
|||
private MultiBackgroundInitializer initializer;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
initializer = new MultiBackgroundInitializer();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -317,7 +317,7 @@ public class MethodUtilsTest {
|
|||
private final Map<Class<?>, 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));
|
||||
|
||||
|
|
|
@ -532,7 +532,7 @@ public class TypeUtilsTest<B> {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testTypesSatisfyVariables() throws SecurityException, NoSuchFieldException,
|
||||
public void testTypesSatisfyVariables() throws SecurityException,
|
||||
NoSuchMethodException {
|
||||
final Map<TypeVariable<?>, Type> typeVarAssigns = new HashMap<>();
|
||||
final Integer max = TypeUtilsTest.<Integer> stub();
|
||||
|
@ -548,7 +548,7 @@ public class TypeUtilsTest<B> {
|
|||
|
||||
@Test
|
||||
public void testDetermineTypeVariableAssignments() throws SecurityException,
|
||||
NoSuchFieldException, NoSuchMethodException {
|
||||
NoSuchFieldException {
|
||||
final ParameterizedType iterableType = (ParameterizedType) getClass().getField("iterable")
|
||||
.getGenericType();
|
||||
final Map<TypeVariable<?>, Type> typeVarAssigns = TypeUtils.determineTypeArguments(TreeSet.class,
|
||||
|
@ -634,7 +634,7 @@ public class TypeUtilsTest<B> {
|
|||
}
|
||||
|
||||
@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<B> {
|
|||
}
|
||||
|
||||
@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));
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ExtendedMessageFormatTest {
|
|||
private final Map<String, FormatFactory> registry = new HashMap<>();
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
registry.put("lower", new LowerCaseFormatFactory());
|
||||
registry.put("upper", new UpperCaseFormatFactory());
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -42,14 +42,14 @@ public class StrSubstitutorTest {
|
|||
private Map<String, String> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 "
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.junit.jupiter.api.Test;
|
|||
public class ImmutablePairTest {
|
||||
|
||||
@Test
|
||||
public void testBasic() throws Exception {
|
||||
public void testBasic() {
|
||||
final ImmutablePair<Integer, String> 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<Integer, String> 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());
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.junit.jupiter.api.Test;
|
|||
public class ImmutableTripleTest {
|
||||
|
||||
@Test
|
||||
public void testBasic() throws Exception {
|
||||
public void testBasic() {
|
||||
final ImmutableTriple<Integer, String, Boolean> 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<Integer, String, Boolean> 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());
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test;
|
|||
public class MutablePairTest {
|
||||
|
||||
@Test
|
||||
public void testBasic() throws Exception {
|
||||
public void testBasic() {
|
||||
final MutablePair<Integer, String> 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<Integer, String> pair = new MutablePair<>();
|
||||
assertNull(pair.getLeft());
|
||||
assertNull(pair.getRight());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMutate() throws Exception {
|
||||
public void testMutate() {
|
||||
final MutablePair<Integer, String> 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<Integer, String> 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());
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test;
|
|||
public class MutableTripleTest {
|
||||
|
||||
@Test
|
||||
public void testBasic() throws Exception {
|
||||
public void testBasic() {
|
||||
final MutableTriple<Integer, String, Boolean> 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<Integer, String, Boolean> 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<Integer, String, Boolean> 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<Integer, String, Boolean> 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());
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test;
|
|||
public class PairTest {
|
||||
|
||||
@Test
|
||||
public void testPairOf() throws Exception {
|
||||
public void testPairOf() {
|
||||
final Pair<Integer, String> pair = Pair.of(0, "foo");
|
||||
assertTrue(pair instanceof ImmutablePair<?, ?>);
|
||||
assertEquals(0, ((ImmutablePair<Integer, String>) pair).left.intValue());
|
||||
|
@ -46,7 +46,7 @@ public class PairTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityBetweenPairs() throws Exception {
|
||||
public void testCompatibilityBetweenPairs() {
|
||||
final Pair<Integer, String> pair = ImmutablePair.of(0, "foo");
|
||||
final Pair<Integer, String> 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<Integer, String> pair = ImmutablePair.of(0, "foo");
|
||||
final HashMap<Integer, String> 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<String, String> pair1 = Pair.of("A", "D");
|
||||
final Pair<String, String> 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<String, String> pair1 = Pair.of("A", "C");
|
||||
final Pair<String, String> 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<String, String> 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<String, Calendar> 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<String, String> 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<String, String> pair = Pair.of("Key", "Value");
|
||||
assertEquals(" (Key,Value)", String.format("%1$20s", pair));
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
|
|||
public class TripleTest {
|
||||
|
||||
@Test
|
||||
public void testTripleOf() throws Exception {
|
||||
public void testTripleOf() {
|
||||
final Triple<Integer, String, Boolean> triple = Triple.of(0, "foo", Boolean.TRUE);
|
||||
assertTrue(triple instanceof ImmutableTriple<?, ?, ?>);
|
||||
assertEquals(0, ((ImmutableTriple<Integer, String, Boolean>) triple).left.intValue());
|
||||
|
@ -45,7 +45,7 @@ public class TripleTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityBetweenTriples() throws Exception {
|
||||
public void testCompatibilityBetweenTriples() {
|
||||
final Triple<Integer, String, Boolean> triple = ImmutableTriple.of(0, "foo", Boolean.TRUE);
|
||||
final Triple<Integer, String, Boolean> 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<String, String, String> triple1 = Triple.of("A", "D", "A");
|
||||
final Triple<String, String, String> 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<String, String, String> triple1 = Triple.of("A", "C", "B");
|
||||
final Triple<String, String, String> 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<String, String, String> triple1 = Triple.of("A", "A", "D");
|
||||
final Triple<String, String, String> 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<String, String, String> triple1 = Triple.of("B", "A", "C");
|
||||
final Triple<String, String, String> 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<String, String, String> 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<String, String, Calendar> 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<String, String, String> 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<String, String, String> triple = Triple.of("Key", "Something", "Value");
|
||||
assertEquals(" (Key,Something,Value)", String.format("%1$30s", triple));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue