Use final.

This commit is contained in:
Gary Gregory 2020-02-14 09:36:04 -05:00
parent 4ebd3e3988
commit 485876f9c2
38 changed files with 230 additions and 230 deletions

View File

@ -1727,7 +1727,7 @@ public class ArrayUtils {
* @since 3.10
*/
public static BitSet indexesOf(final boolean[] array, final boolean valueToFind, int startIndex) {
BitSet bitSet = new BitSet();
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
@ -1778,7 +1778,7 @@ public class ArrayUtils {
* @since 3.10
*/
public static BitSet indexesOf(final byte[] array, final byte valueToFind, int startIndex) {
BitSet bitSet = new BitSet();
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
@ -1829,7 +1829,7 @@ public class ArrayUtils {
* @since 3.10
*/
public static BitSet indexesOf(final char[] array, final char valueToFind, int startIndex) {
BitSet bitSet = new BitSet();
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
@ -1901,7 +1901,7 @@ public class ArrayUtils {
* @since 3.10
*/
public static BitSet indexesOf(final double[] array, final double valueToFind, int startIndex) {
BitSet bitSet = new BitSet();
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
@ -1943,7 +1943,7 @@ public class ArrayUtils {
* @since 3.10
*/
public static BitSet indexesOf(final double[] array, final double valueToFind, int startIndex, final double tolerance) {
BitSet bitSet = new BitSet();
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
@ -1994,7 +1994,7 @@ public class ArrayUtils {
* @since 3.10
*/
public static BitSet indexesOf(final float[] array, final float valueToFind, int startIndex) {
BitSet bitSet = new BitSet();
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
@ -2045,7 +2045,7 @@ public class ArrayUtils {
* @since 3.10
*/
public static BitSet indexesOf(final int[] array, final int valueToFind, int startIndex) {
BitSet bitSet = new BitSet();
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
@ -2096,7 +2096,7 @@ public class ArrayUtils {
* @since 3.10
*/
public static BitSet indexesOf(final long[] array, final long valueToFind, int startIndex) {
BitSet bitSet = new BitSet();
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
@ -2147,7 +2147,7 @@ public class ArrayUtils {
* @since 3.10
*/
public static BitSet indexesOf(final Object[] array, final Object objectToFind, int startIndex) {
BitSet bitSet = new BitSet();
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
@ -2198,7 +2198,7 @@ public class ArrayUtils {
* @since 3.10
*/
public static BitSet indexesOf(final short[] array, final short valueToFind, int startIndex) {
BitSet bitSet = new BitSet();
final BitSet bitSet = new BitSet();
if (array == null) {
return bitSet;
@ -3084,7 +3084,7 @@ public static int indexOf(final int[] array, final int valueToFind) {
* @return Whether the given index is safely-accessible in the given array
* @since 3.8
*/
public static <T> boolean isArrayIndexValid(T[] array, int index) {
public static <T> boolean isArrayIndexValid(final T[] array, final int index) {
if (getLength(array) == 0 || array.length <= index) {
return false;
}

View File

@ -282,7 +282,7 @@ public class ClassUtils {
* @since 3.0
* @see Class#getSimpleName()
*/
public static String getSimpleName(final Class<?> cls, String valueIfNull) {
public static String getSimpleName(final Class<?> cls, final String valueIfNull) {
return cls == null ? valueIfNull : cls.getSimpleName();
}

View File

@ -162,7 +162,7 @@ public class Functions {
* @param pRunnable a {@code FailableRunnable}
* @return a standard {@code Runnable}
*/
public static Runnable asRunnable(FailableRunnable<?> pRunnable) {
public static Runnable asRunnable(final FailableRunnable<?> pRunnable) {
return () -> run(pRunnable);
}
@ -173,7 +173,7 @@ public class Functions {
* @param pConsumer a {@code FailableConsumer}
* @return a standard {@code Consumer}
*/
public static <I> Consumer<I> asConsumer(FailableConsumer<I, ?> pConsumer) {
public static <I> Consumer<I> asConsumer(final FailableConsumer<I, ?> pConsumer) {
return (pInput) -> accept(pConsumer, pInput);
}
@ -184,7 +184,7 @@ public class Functions {
* @param pCallable a {@code FailableCallable}
* @return a standard {@code Callable}
*/
public static <O> Callable<O> asCallable(FailableCallable<O, ?> pCallable) {
public static <O> Callable<O> asCallable(final FailableCallable<O, ?> pCallable) {
return () -> call(pCallable);
}
@ -196,7 +196,7 @@ public class Functions {
* @param pConsumer a failable {@code BiConsumer}
* @return a standard {@code BiConsumer}
*/
public static <I1, I2> BiConsumer<I1, I2> asBiConsumer(FailableBiConsumer<I1, I2, ?> pConsumer) {
public static <I1, I2> BiConsumer<I1, I2> asBiConsumer(final FailableBiConsumer<I1, I2, ?> pConsumer) {
return (pInput1, pInput2) -> accept(pConsumer, pInput1, pInput2);
}
@ -208,7 +208,7 @@ public class Functions {
* @param pFunction a {code FailableFunction}
* @return a standard {@code Function}
*/
public static <I, O> Function<I, O> asFunction(FailableFunction<I, O, ?> pFunction) {
public static <I, O> Function<I, O> asFunction(final FailableFunction<I, O, ?> pFunction) {
return (pInput) -> apply(pFunction, pInput);
}
@ -221,7 +221,7 @@ public class Functions {
* @param pFunction a {@code FailableBiFunction}
* @return a standard {@code BiFunction}
*/
public static <I1, I2, O> BiFunction<I1, I2, O> asBiFunction(FailableBiFunction<I1, I2, O, ?> pFunction) {
public static <I1, I2, O> BiFunction<I1, I2, O> asBiFunction(final FailableBiFunction<I1, I2, O, ?> pFunction) {
return (pInput1, pInput2) -> apply(pFunction, pInput1, pInput2);
}
@ -232,7 +232,7 @@ public class Functions {
* @param pPredicate a {@code FailablePredicate}
* @return a standard {@code Predicate}
*/
public static <I> Predicate<I> asPredicate(FailablePredicate<I, ?> pPredicate) {
public static <I> Predicate<I> asPredicate(final FailablePredicate<I, ?> pPredicate) {
return (pInput) -> test(pPredicate, pInput);
}
@ -244,7 +244,7 @@ public class Functions {
* @param pPredicate a {@code FailableBiPredicate}
* @return a standard {@code BiPredicate}
*/
public static <I1, I2> BiPredicate<I1, I2> asBiPredicate(FailableBiPredicate<I1, I2, ?> pPredicate) {
public static <I1, I2> BiPredicate<I1, I2> asBiPredicate(final FailableBiPredicate<I1, I2, ?> pPredicate) {
return (pInput1, pInput2) -> test(pPredicate, pInput1, pInput2);
}
@ -255,7 +255,7 @@ public class Functions {
* @param pSupplier a {@code FailableSupplier}
* @return a standard {@code Supplier}
*/
public static <O> Supplier<O> asSupplier(FailableSupplier<O, ?> pSupplier) {
public static <O> Supplier<O> asSupplier(final FailableSupplier<O, ?> pSupplier) {
return () -> get(pSupplier);
}
@ -264,10 +264,10 @@ public class Functions {
* @param pRunnable The runnable to run
* @param <T> the type of checked exception the runnable may throw
*/
public static <T extends Throwable> void run(FailableRunnable<T> pRunnable) {
public static <T extends Throwable> void run(final FailableRunnable<T> pRunnable) {
try {
pRunnable.run();
} catch (Throwable t) {
} catch (final Throwable t) {
throw rethrow(t);
}
}
@ -279,10 +279,10 @@ public class Functions {
* @param <T> the type of checked exception the callable may throw
* @return the value returned from the callable
*/
public static <O, T extends Throwable> O call(FailableCallable<O, T> pCallable) {
public static <O, T extends Throwable> O call(final FailableCallable<O, T> pCallable) {
try {
return pCallable.call();
} catch (Throwable t) {
} catch (final Throwable t) {
throw rethrow(t);
}
}
@ -294,10 +294,10 @@ public class Functions {
* @param <O> the type the consumer accepts
* @param <T> the type of checked exception the consumer may throw
*/
public static <O, T extends Throwable> void accept(FailableConsumer<O, T> pConsumer, O pObject) {
public static <O, T extends Throwable> void accept(final FailableConsumer<O, T> pConsumer, final O pObject) {
try {
pConsumer.accept(pObject);
} catch (Throwable t) {
} catch (final Throwable t) {
throw rethrow(t);
}
}
@ -311,10 +311,10 @@ public class Functions {
* @param <O2> the type of the second argument the consumer accepts
* @param <T> the type of checked exception the consumer may throw
*/
public static <O1, O2, T extends Throwable> void accept(FailableBiConsumer<O1, O2, T> pConsumer, O1 pObject1, O2 pObject2) {
public static <O1, O2, T extends Throwable> void accept(final FailableBiConsumer<O1, O2, T> pConsumer, final O1 pObject1, final O2 pObject2) {
try {
pConsumer.accept(pObject1, pObject2);
} catch (Throwable t) {
} catch (final Throwable t) {
throw rethrow(t);
}
}
@ -328,10 +328,10 @@ public class Functions {
* @param <T> the type of checked exception the function may throw
* @return the value returned from the function
*/
public static <I, O, T extends Throwable> O apply(FailableFunction<I, O, T> pFunction, I pInput) {
public static <I, O, T extends Throwable> O apply(final FailableFunction<I, O, T> pFunction, final I pInput) {
try {
return pFunction.apply(pInput);
} catch (Throwable t) {
} catch (final Throwable t) {
throw rethrow(t);
}
}
@ -347,10 +347,10 @@ public class Functions {
* @param <T> the type of checked exception the function may throw
* @return the value returned from the function
*/
public static <I1, I2, O, T extends Throwable> O apply(FailableBiFunction<I1, I2, O, T> pFunction, I1 pInput1, I2 pInput2) {
public static <I1, I2, O, T extends Throwable> O apply(final FailableBiFunction<I1, I2, O, T> pFunction, final I1 pInput1, final I2 pInput2) {
try {
return pFunction.apply(pInput1, pInput2);
} catch (Throwable t) {
} catch (final Throwable t) {
throw rethrow(t);
}
}
@ -363,10 +363,10 @@ public class Functions {
* @param <T> the type of checked exception the predicate may throw
* @return the boolean value returned by the predicate
*/
public static <O, T extends Throwable> boolean test(FailablePredicate<O, T> pPredicate, O pObject) {
public static <O, T extends Throwable> boolean test(final FailablePredicate<O, T> pPredicate, final O pObject) {
try {
return pPredicate.test(pObject);
} catch (Throwable t) {
} catch (final Throwable t) {
throw rethrow(t);
}
}
@ -381,10 +381,10 @@ public class Functions {
* @param <T> the type of checked exception the predicate may throw
* @return the boolean value returned by the predicate
*/
public static <O1, O2, T extends Throwable> boolean test(FailableBiPredicate<O1, O2, T> pPredicate, O1 pObject1, O2 pObject2) {
public static <O1, O2, T extends Throwable> boolean test(final FailableBiPredicate<O1, O2, T> pPredicate, final O1 pObject1, final O2 pObject2) {
try {
return pPredicate.test(pObject1, pObject2);
} catch (Throwable t) {
} catch (final Throwable t) {
throw rethrow(t);
}
}
@ -396,10 +396,10 @@ public class Functions {
* @param <T> The type of checked exception, which the supplier can throw.
* @return The object, which has been created by the supplier
*/
public static <O, T extends Throwable> O get(FailableSupplier<O, T> pSupplier) {
public static <O, T extends Throwable> O get(final FailableSupplier<O, T> pSupplier) {
try {
return pSupplier.get();
} catch (Throwable t) {
} catch (final Throwable t) {
throw rethrow(t);
}
}
@ -416,7 +416,7 @@ public class Functions {
* @param <O> The streams element type.
* @return The created {@link FailableStream}.
*/
public static <O> FailableStream<O> stream(Stream<O> pStream) {
public static <O> FailableStream<O> stream(final Stream<O> pStream) {
return new FailableStream<O>(pStream);
}
@ -433,7 +433,7 @@ public class Functions {
* streams element type.)
* @return The created {@link FailableStream}.
*/
public static <O> FailableStream<O> stream(Collection<O> pCollection) {
public static <O> FailableStream<O> stream(final Collection<O> pCollection) {
return new FailableStream<O>(pCollection.stream());
}
@ -461,9 +461,9 @@ public class Functions {
* @see #tryWithResources(FailableRunnable, FailableRunnable...)
*/
@SafeVarargs
public static void tryWithResources(FailableRunnable<? extends Throwable> pAction,
FailableConsumer<Throwable, ? extends Throwable> pErrorHandler,
FailableRunnable<? extends Throwable>... pResources) {
public static void tryWithResources(final FailableRunnable<? extends Throwable> pAction,
final FailableConsumer<Throwable, ? extends Throwable> pErrorHandler,
final FailableRunnable<? extends Throwable>... pResources) {
final FailableConsumer<Throwable, ? extends Throwable> errorHandler;
if (pErrorHandler == null) {
errorHandler = (t) -> rethrow(t);
@ -471,21 +471,21 @@ public class Functions {
errorHandler = pErrorHandler;
}
if (pResources != null) {
for (FailableRunnable<? extends Throwable> failableRunnable : pResources) {
for (final FailableRunnable<? extends Throwable> failableRunnable : pResources) {
Objects.requireNonNull(failableRunnable, "runnable");
}
}
Throwable th = null;
try {
pAction.run();
} catch (Throwable t) {
} catch (final Throwable t) {
th = t;
}
if (pResources != null) {
for (FailableRunnable<? extends Object> runnable : pResources) {
for (final FailableRunnable<? extends Object> runnable : pResources) {
try {
runnable.run();
} catch (Throwable t) {
} catch (final Throwable t) {
if (th == null) {
th = t;
}
@ -495,7 +495,7 @@ public class Functions {
if (th != null) {
try {
errorHandler.accept(th);
} catch (Throwable t) {
} catch (final Throwable t) {
throw rethrow(t);
}
}
@ -521,8 +521,8 @@ public class Functions {
* @see #tryWithResources(FailableRunnable, FailableConsumer, FailableRunnable...)
*/
@SafeVarargs
public static void tryWithResources(FailableRunnable<? extends Throwable> pAction,
FailableRunnable<? extends Throwable>... pResources) {
public static void tryWithResources(final FailableRunnable<? extends Throwable> pAction,
final FailableRunnable<? extends Throwable>... pResources) {
tryWithResources(pAction, null, pResources);
}
@ -549,7 +549,7 @@ public class Functions {
* @param pThrowable The throwable to rethrow possibly wrapped into an unchecked exception
* @return Never returns anything, this method never terminates normally.
*/
public static RuntimeException rethrow(Throwable pThrowable) {
public static RuntimeException rethrow(final Throwable pThrowable) {
Objects.requireNonNull(pThrowable, "pThrowable");
if (pThrowable instanceof RuntimeException) {
throw (RuntimeException) pThrowable;

View File

@ -238,7 +238,7 @@ public class ObjectUtils {
if (suppliers != null) {
for (final Supplier<T> supplier : suppliers) {
if (supplier != null) {
T value = supplier.get();
final T value = supplier.get();
if (value != null) {
return value;
}

View File

@ -65,7 +65,7 @@ public class Streams {
private Stream<O> stream;
private boolean terminated;
public FailableStream(Stream<O> pStream) {
public FailableStream(final Stream<O> pStream) {
stream = pStream;
}
@ -90,7 +90,7 @@ public class Streams {
* element to determine if it should be included.
* @return the new stream
*/
public FailableStream<O> filter(FailablePredicate<O, ?> pPredicate){
public FailableStream<O> filter(final FailablePredicate<O, ?> pPredicate){
assertNotTerminated();
stream = stream.filter(Functions.asPredicate(pPredicate));
return this;
@ -111,7 +111,7 @@ public class Streams {
*
* @param pAction a non-interfering action to perform on the elements
*/
public void forEach(FailableConsumer<O, ?> pAction) {
public void forEach(final FailableConsumer<O, ?> pAction) {
makeTerminated();
stream().forEach(Functions.asConsumer(pAction));
}
@ -164,7 +164,7 @@ public class Streams {
* @see #collect(Supplier, BiConsumer, BiConsumer)
* @see Collectors
*/
public <A, R> R collect(Collector<? super O, A, R> pCollector) {
public <A, R> R collect(final Collector<? super O, A, R> pCollector) {
makeTerminated();
return stream().collect(pCollector);
}
@ -214,7 +214,7 @@ public class Streams {
* accumulator function
* @return The result of the reduction
*/
public <A, R> R collect(Supplier<R> pSupplier, BiConsumer<R, ? super O> pAccumulator, BiConsumer<R, R> pCombiner) {
public <A, R> R collect(final Supplier<R> pSupplier, final BiConsumer<R, ? super O> pAccumulator, final BiConsumer<R, R> pCombiner) {
makeTerminated();
return stream().collect(pSupplier, pAccumulator, pCombiner);
}
@ -262,7 +262,7 @@ public class Streams {
* function for combining two values
* @return the result of the reduction
*/
public O reduce(O pIdentity, BinaryOperator<O> pAccumulator) {
public O reduce(final O pIdentity, final BinaryOperator<O> pAccumulator) {
makeTerminated();
return stream().reduce(pIdentity, pAccumulator);
}
@ -277,7 +277,7 @@ public class Streams {
* @param pMapper A non-interfering, stateless function to apply to each element
* @return the new stream
*/
public <R> FailableStream<R> map(FailableFunction<O, R, ?> pMapper) {
public <R> FailableStream<R> map(final FailableFunction<O, R, ?> pMapper) {
assertNotTerminated();
return new FailableStream<R>(stream.map(Functions.asFunction(pMapper)));
}
@ -309,7 +309,7 @@ public class Streams {
* @return {@code true} If either all elements of the stream match the
* provided predicate or the stream is empty, otherwise {@code false}.
*/
public boolean allMatch(FailablePredicate<O, ?> pPredicate) {
public boolean allMatch(final FailablePredicate<O, ?> pPredicate) {
assertNotTerminated();
return stream().allMatch(Functions.asPredicate(pPredicate));
}
@ -331,7 +331,7 @@ public class Streams {
* @return {@code true} if any elements of the stream match the provided
* predicate, otherwise {@code false}
*/
public boolean anyMatch(FailablePredicate<O, ?> pPredicate) {
public boolean anyMatch(final FailablePredicate<O, ?> pPredicate) {
assertNotTerminated();
return stream().anyMatch(Functions.asPredicate(pPredicate));
}
@ -375,7 +375,7 @@ public class Streams {
* @return The {@link FailableStream}, which has been created by
* converting the stream.
*/
public static <O> FailableStream<O> stream(Stream<O> pStream) {
public static <O> FailableStream<O> stream(final Stream<O> pStream) {
return new FailableStream<O>(pStream);
}
@ -417,7 +417,7 @@ public class Streams {
* @return The {@link FailableStream}, which has been created by
* converting the stream.
*/
public static <O> FailableStream<O> stream(Collection<O> pStream) {
public static <O> FailableStream<O> stream(final Collection<O> pStream) {
return stream(pStream.stream());
}
}

View File

@ -535,7 +535,7 @@ public class StringUtils {
* @since 2.0
*/
public static String capitalize(final String str) {
int strLen = length(str);
final int strLen = length(str);
if (strLen == 0) {
return str;
}
@ -3546,7 +3546,7 @@ public class StringUtils {
* @since 3.0 Changed signature from isBlank(String) to isBlank(CharSequence)
*/
public static boolean isBlank(final CharSequence cs) {
int strLen = length(cs);
final int strLen = length(cs);
if (strLen == 0) {
return true;
}
@ -8355,7 +8355,7 @@ public class StringUtils {
* @return the stripped String, {@code null} if null String input
*/
public static String stripStart(final String str, final String stripChars) {
int strLen = length(str);
final int strLen = length(str);
if (strLen == 0) {
return str;
}
@ -9203,7 +9203,7 @@ public class StringUtils {
* @since 2.0
*/
public static String uncapitalize(final String str) {
int strLen = length(str);
final int strLen = length(str);
if (strLen == 0) {
return str;
}

View File

@ -267,7 +267,7 @@ public class EqualsBuilder implements Builder<Boolean> {
* @return EqualsBuilder - used to chain calls.
* @since 3.8
*/
public EqualsBuilder setBypassReflectionClasses(List<Class<?>> bypassReflectionClasses) {
public EqualsBuilder setBypassReflectionClasses(final List<Class<?>> bypassReflectionClasses) {
this.bypassReflectionClasses = bypassReflectionClasses;
return this;
}

View File

@ -55,7 +55,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
}
@Override
public R setValue(R value) {
public R setValue(final R value) {
return null;
}

View File

@ -98,7 +98,7 @@ public class ArchUtilsTest {
@Test
public void testArchLabels() {
for (Arch arch : Arch.values()) {
for (final Arch arch : Arch.values()) {
// Only test label presence.
assertFalse(arch.getLabel().isEmpty());
}

View File

@ -3146,8 +3146,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOf() {
final Object[] array = new Object[]{"0", "1", "2", "3", null, "0"};
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf((Object[]) null, null));
assertEquals(emptySet, ArrayUtils.indexesOf(new Object[0], "0"));
testSet.set(5);
@ -3168,8 +3168,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfWithStartIndex() {
final Object[] array = new Object[]{"0", "1", "2", "3", "2", "3", "1", null, "0"};
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(null, null, 2));
assertEquals(emptySet, ArrayUtils.indexesOf(new Object[0], "0", 0));
assertEquals(emptySet, ArrayUtils.indexesOf(null, "0", 2));
@ -3288,8 +3288,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfLong() {
final long[] array = new long[]{0, 1, 2, 3};
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf((long[]) null, 0));
assertEquals(emptySet, ArrayUtils.indexesOf(array, 4));
testSet.set(0);
@ -3308,8 +3308,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfLongWithStartIndex() {
final long[] array = new long[]{0, 1, 2, 3, 2, 1, 0, 1};
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf((long[]) null, 0, 0));
assertEquals(emptySet, ArrayUtils.indexesOf(array, 4, 0));
testSet.set(6);
@ -3399,8 +3399,8 @@ public class ArrayUtilsTest {
@Test
public void textIndexesOfInt() {
int[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, 0));
array = new int[]{0, 1, 2, 3, 0};
testSet.set(0);
@ -3421,8 +3421,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfIntWithStartIndex() {
int[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, 0, 2));
array = new int[]{0, 1, 2, 3, 0};
testSet.set(4);
@ -3510,8 +3510,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfShort() {
short[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, (short) 0));
array = new short[]{0, 1, 2, 3, 0};
testSet.set(0);
@ -3532,8 +3532,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfShortWithStartIndex() {
short[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, (short) 0, 2));
array = new short[]{0, 1, 2, 3, 0};
testSet.set(4);
@ -3621,8 +3621,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfChar() {
char[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, 'a'));
array = new char[]{'a', 'b', 'c', 'd', 'a'};
testSet.set(0);
@ -3643,8 +3643,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfCharWithStartIndex() {
char[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, 'a', 0));
array = new char[]{'a', 'b', 'c', 'd', 'a'};
testSet.set(4);
@ -3733,8 +3733,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfByte() {
byte[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, (byte) 0));
array = new byte[]{0, 1, 2, 3, 0};
testSet.set(0);
@ -3755,8 +3755,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfByteWithStartIndex() {
byte[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, (byte) 0, 2));
array = new byte[]{0, 1, 2, 3, 0};
testSet.set(4);
@ -3883,8 +3883,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfDouble() {
double[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, 0));
array = new double[]{0, 1, 2, 3, 0};
testSet.set(0);
@ -3906,8 +3906,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfDoubleWithStartIndex() {
double[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, 0, 2));
array = new double[]{0, 1, 2, 3, 0};
testSet.set(4);
@ -3931,8 +3931,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfDoubleTolerance() {
double[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, (double) 0, (double) 0));
array = new double[0];
assertEquals(emptySet, ArrayUtils.indexesOf(array, (double) 0, (double) 0));
@ -3952,8 +3952,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfDoubleWithStartIndexTolerance() {
double[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, (double) 0, 0, (double) 0));
array = new double[0];
assertEquals(emptySet, ArrayUtils.indexesOf(array, (double) 0, 0, (double) 0));
@ -4102,8 +4102,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfFloat() {
float[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, 0));
array = new float[]{0, 1, 2, 3, 0};
testSet.set(0);
@ -4125,8 +4125,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfFloatWithStartIndex() {
float[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, 0, 2));
array = new float[]{0, 1, 2, 3, 0};
testSet.set(4);
@ -4224,8 +4224,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfBoolean() {
boolean[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, true));
array = new boolean[0];
assertEquals(emptySet, ArrayUtils.indexesOf(array, true));
@ -4243,8 +4243,8 @@ public class ArrayUtilsTest {
@Test
public void testIndexesOfBooleanWithStartIndex() {
boolean[] array = null;
BitSet emptySet = new BitSet();
BitSet testSet = new BitSet();
final BitSet emptySet = new BitSet();
final BitSet testSet = new BitSet();
assertEquals(emptySet, ArrayUtils.indexesOf(array, true, 0));
array = new boolean[0];
assertEquals(emptySet, ArrayUtils.indexesOf(array, true, 0));
@ -5160,7 +5160,7 @@ public class ArrayUtilsTest {
@Test
public void testIsArrayIndexValid() {
assertFalse(ArrayUtils.isArrayIndexValid(null, 0));
String[] array = new String[1];
final String[] array = new String[1];
//too big
assertFalse(ArrayUtils.isArrayIndexValid(array, 1));

View File

@ -311,7 +311,7 @@ public class CharRangeTest {
@Test
public void testContainsNullArg() {
final CharRange range = CharRange.is('a');
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> range.contains(null));
final IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> range.contains(null));
assertEquals("The Range must not be null", e.getMessage());
}

View File

@ -49,11 +49,11 @@ class FunctionsTest {
private Throwable t;
SomeException(String pMsg) {
SomeException(final String pMsg) {
super(pMsg);
}
public void setThrowable(Throwable pThrowable) {
public void setThrowable(final Throwable pThrowable) {
t = pThrowable;
}
@ -66,11 +66,11 @@ class FunctionsTest {
public static class Testable {
private Throwable t;
Testable(Throwable pTh) {
Testable(final Throwable pTh) {
t = pTh;
}
public void setThrowable(Throwable pThrowable) {
public void setThrowable(final Throwable pThrowable) {
t = pThrowable;
}
@ -78,7 +78,7 @@ class FunctionsTest {
test(t);
}
public void test(Throwable pThrowable) throws Throwable {
public void test(final Throwable pThrowable) throws Throwable {
if (pThrowable != null) {
throw pThrowable;
}
@ -88,7 +88,7 @@ class FunctionsTest {
return testInt(t);
}
public Integer testInt(Throwable pThrowable) throws Throwable {
public Integer testInt(final Throwable pThrowable) throws Throwable {
if (pThrowable != null) {
throw pThrowable;
}
@ -117,7 +117,7 @@ class FunctionsTest {
public static class CloseableObject {
private boolean closed;
public void run(Throwable pTh) throws Throwable {
public void run(final Throwable pTh) throws Throwable {
if (pTh != null) {
throw pTh;
}
@ -139,7 +139,7 @@ class FunctionsTest {
@Test
void testRunnable() {
FailureOnOddInvocations.invocation = 0;
UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> Functions.run(FailureOnOddInvocations::new));
final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> Functions.run(FailureOnOddInvocations::new));
final Throwable cause = e.getCause();
assertNotNull(cause);
assertTrue(cause instanceof SomeException);
@ -152,8 +152,8 @@ class FunctionsTest {
@Test
void testAsRunnable() {
FailureOnOddInvocations.invocation = 0;
Runnable runnable = Functions.asRunnable(() -> new FailureOnOddInvocations());
UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> runnable.run());
final Runnable runnable = Functions.asRunnable(() -> new FailureOnOddInvocations());
final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> runnable.run());
final Throwable cause = e.getCause();
assertNotNull(cause);
assertTrue(cause instanceof SomeException);
@ -166,7 +166,7 @@ class FunctionsTest {
@Test
void testCallable() {
FailureOnOddInvocations.invocation = 0;
UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> Functions.run(FailureOnOddInvocations::new));
final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> Functions.run(FailureOnOddInvocations::new));
final Throwable cause = e.getCause();
assertNotNull(cause);
assertTrue(cause instanceof SomeException);
@ -182,7 +182,7 @@ class FunctionsTest {
return new FailureOnOddInvocations();
};
final Callable<FailureOnOddInvocations> callable = Functions.asCallable(failableCallable);
UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> callable.call());
final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> callable.call());
final Throwable cause = e.getCause();
assertNotNull(cause);
assertTrue(cause instanceof SomeException);
@ -190,7 +190,7 @@ class FunctionsTest {
final FailureOnOddInvocations instance;
try {
instance = callable.call();
} catch (Exception ex) {
} catch (final Exception ex) {
throw Functions.rethrow(ex);
}
assertNotNull(instance);
@ -394,7 +394,7 @@ class FunctionsTest {
@Test
public void testGetFromSupplier() {
FailureOnOddInvocations.invocation = 0;
UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> Functions.run(FailureOnOddInvocations::new));
final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> Functions.run(FailureOnOddInvocations::new));
final Throwable cause = e.getCause();
assertNotNull(cause);
assertTrue(cause instanceof SomeException);
@ -409,7 +409,7 @@ class FunctionsTest {
FailureOnOddInvocations.invocation = 0;
final Functions.FailablePredicate<Object, Throwable> failablePredicate = (t) -> FailureOnOddInvocations.failingBool();
final Predicate<?> predicate = Functions.asPredicate(failablePredicate);
UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> predicate.test(null));
final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> predicate.test(null));
final Throwable cause = e.getCause();
assertNotNull(cause);
assertTrue(cause instanceof SomeException);
@ -424,7 +424,7 @@ class FunctionsTest {
FailureOnOddInvocations.invocation = 0;
final Functions.FailableBiPredicate<Object, Object, Throwable> failableBiPredicate = (t1, t2) -> FailureOnOddInvocations.failingBool();
final BiPredicate<?, ?> predicate = Functions.asBiPredicate(failableBiPredicate);
UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> predicate.test(null, null));
final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> predicate.test(null, null));
final Throwable cause = e.getCause();
assertNotNull(cause);
assertTrue(cause instanceof SomeException);
@ -438,7 +438,7 @@ class FunctionsTest {
FailureOnOddInvocations.invocation = 0;
final FailableSupplier<FailureOnOddInvocations, Throwable> failableSupplier = () -> new FailureOnOddInvocations();
final Supplier<FailureOnOddInvocations> supplier = Functions.asSupplier(failableSupplier);
UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> supplier.get());
final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> supplier.get());
final Throwable cause = e.getCause();
assertNotNull(cause);
assertTrue(cause instanceof SomeException);
@ -464,7 +464,7 @@ class FunctionsTest {
assertTrue(co.isClosed());
co.reset();
final IOException ioe = new IOException("Unknown I/O error");
UncheckedIOException uioe = assertThrows(UncheckedIOException.class, () -> Functions.tryWithResources(() -> consumer.accept(ioe), co::close));
final UncheckedIOException uioe = assertThrows(UncheckedIOException.class, () -> Functions.tryWithResources(() -> consumer.accept(ioe), co::close));
final IOException cause = uioe.getCause();
assertSame(ioe, cause);

View File

@ -524,7 +524,7 @@ public class LocaleUtilsTest {
@ParameterizedTest
@MethodSource("java.util.Locale#getAvailableLocales")
public void testParseAllLocales(Locale l) {
public void testParseAllLocales(final Locale l) {
// Check if it's possible to recreate the Locale using just the standard constructor
final Locale locale = new Locale(l.getLanguage(), l.getCountry(), l.getVariant());
if (l.equals(locale)) { // it is possible for LocaleUtils.toLocale to handle these Locales

View File

@ -121,8 +121,8 @@ public class ObjectUtilsTest {
assertSame(o, ObjectUtils.getIfNull(o, () -> dflt), "dflt was returned when o was not null");
assertSame(o, ObjectUtils.getIfNull(FOO, () -> dflt), "dflt was returned when o was not null");
assertSame(o, ObjectUtils.getIfNull("foo", () -> dflt), "dflt was returned when o was not null");
MutableInt callsCounter = new MutableInt(0);
Supplier<Object> countingDefaultSupplier = () -> {
final MutableInt callsCounter = new MutableInt(0);
final Supplier<Object> countingDefaultSupplier = () -> {
callsCounter.increment();
return dflt;
};
@ -539,7 +539,7 @@ public class ObjectUtilsTest {
@Test
public void testCloneOfUncloneable() {
final UncloneableString string = new UncloneableString("apache");
CloneFailedException e = assertThrows(CloneFailedException.class, () -> ObjectUtils.clone(string));
final CloneFailedException e = assertThrows(CloneFailedException.class, () -> ObjectUtils.clone(string));
assertEquals(NoSuchMethodException.class, e.getCause().getClass());
}
@ -585,7 +585,7 @@ public class ObjectUtilsTest {
@Test
public void testPossibleCloneOfUncloneable() {
final UncloneableString string = new UncloneableString("apache");
CloneFailedException e = assertThrows(CloneFailedException.class, () -> ObjectUtils.cloneIfPossible(string));
final CloneFailedException e = assertThrows(CloneFailedException.class, () -> ObjectUtils.cloneIfPossible(string));
assertEquals(NoSuchMethodException.class, e.getCause().getClass());
}

View File

@ -158,7 +158,7 @@ public class RandomStringUtilsTest {
@Test
public void testLANG807() {
IllegalArgumentException ex =
final IllegalArgumentException ex =
assertThrows(IllegalArgumentException.class, () -> RandomStringUtils.random(3, 5, 5, false, false));
final String msg = ex.getMessage();
assertTrue(msg.contains("start"), "Message (" + msg + ") must contain 'start'");

View File

@ -159,7 +159,7 @@ public class SerializationUtilsTest {
throw new IOException(SERIALIZE_IO_EXCEPTION_MESSAGE);
}
};
SerializationException e =
final SerializationException e =
assertThrows(SerializationException.class, () -> SerializationUtils.serialize(iMap, streamTest));
assertEquals("java.io.IOException: " + SERIALIZE_IO_EXCEPTION_MESSAGE, e.getMessage());
}
@ -232,7 +232,7 @@ public class SerializationUtilsTest {
oos.close();
final ByteArrayInputStream inTest = new ByteArrayInputStream(streamReal.toByteArray());
SerializationException se =
final SerializationException se =
assertThrows(SerializationException.class, () -> SerializationUtils.deserialize(inTest));
assertEquals("java.lang.ClassNotFoundException: " + CLASS_NOT_FOUND_MESSAGE, se.getMessage());
}

View File

@ -48,7 +48,7 @@ class StreamsTest {
try {
Functions.stream(input).map((s) -> Integer.valueOf(s)).collect(Collectors.toList());
fail("Expected Exception");
} catch (NumberFormatException nfe) {
} catch (final NumberFormatException nfe) {
assertEquals("For input string: \"4 \"", nfe.getMessage());
}
}
@ -64,7 +64,7 @@ class StreamsTest {
}
}
protected <T extends Throwable> FailableConsumer<String, T> asIntConsumer(T pThrowable) {
protected <T extends Throwable> FailableConsumer<String, T> asIntConsumer(final T pThrowable) {
return (s) -> {
final Integer i = Integer.valueOf(s);
if (i.intValue() == 4) {
@ -81,7 +81,7 @@ class StreamsTest {
try {
Functions.stream(input).forEach(asIntConsumer(ise));
fail("Expected Exception");
} catch (IllegalArgumentException e) {
} catch (final IllegalArgumentException e) {
assertSame(ise, e);
}
output.clear();
@ -89,7 +89,7 @@ class StreamsTest {
try {
Functions.stream(input).forEach(asIntConsumer(oome));
fail("Expected Exception");
} catch (Throwable t) {
} catch (final Throwable t) {
assertSame(oome, t);
}
output.clear();
@ -97,7 +97,7 @@ class StreamsTest {
try {
Functions.stream(input).forEach(asIntConsumer(se));
fail("Expected Exception");
} catch (UndeclaredThrowableException ute) {
} catch (final UndeclaredThrowableException ute) {
assertSame(se, ute.getCause());
}
}
@ -121,7 +121,7 @@ class StreamsTest {
}
}
protected <T extends Throwable> FailablePredicate<Integer, T> asIntPredicate(T pThrowable) {
protected <T extends Throwable> FailablePredicate<Integer, T> asIntPredicate(final T pThrowable) {
return (i) -> {
if (i.intValue() == 5) {
if (pThrowable != null) {
@ -149,7 +149,7 @@ class StreamsTest {
.filter(asIntPredicate(iae))
.collect(Collectors.toList());
fail("Expected Exception");
} catch (IllegalArgumentException e) {
} catch (final IllegalArgumentException e) {
assertSame(iae, e);
}
@ -161,7 +161,7 @@ class StreamsTest {
.filter(asIntPredicate(oome))
.collect(Collectors.toList());
fail("Expected Exception");
} catch (Throwable t) {
} catch (final Throwable t) {
assertSame(oome, t);
}
@ -173,7 +173,7 @@ class StreamsTest {
.filter(asIntPredicate(se))
.collect(Collectors.toList());
fail("Expected Exception");
} catch (UndeclaredThrowableException t) {
} catch (final UndeclaredThrowableException t) {
assertSame(se, t.getCause());
}
}

View File

@ -239,7 +239,7 @@ public class StringUtilsTest {
//Fixed LANG-1463
@Test
public void testAbbreviateMarkerWithEmptyString() {
String greaterThanMaxTest = "much too long text";
final String greaterThanMaxTest = "much too long text";
assertEquals("much too long", StringUtils.abbreviate(greaterThanMaxTest, "", 13));
}
@ -684,8 +684,8 @@ public class StringUtilsTest {
final String s = StringUtils.getIfBlank("abc", () -> "NULL");
assertEquals("abc", s);
//Checking that default value supplied only on demand
MutableInt numberOfCalls = new MutableInt(0);
Supplier<String> countingDefaultSupplier = () -> {
final MutableInt numberOfCalls = new MutableInt(0);
final Supplier<String> countingDefaultSupplier = () -> {
numberOfCalls.increment();
return "NULL";
};
@ -752,8 +752,8 @@ public class StringUtilsTest {
final String s = StringUtils.getIfEmpty("abc", () -> "NULL");
assertEquals("abc", s);
//Checking that default value supplied only on demand
MutableInt numberOfCalls = new MutableInt(0);
Supplier<String> countingDefaultSupplier = () -> {
final MutableInt numberOfCalls = new MutableInt(0);
final Supplier<String> countingDefaultSupplier = () -> {
numberOfCalls.increment();
return "NULL";
};
@ -3273,7 +3273,7 @@ public class StringUtilsTest {
assertEquals("title", "TITLE".toLowerCase(Locale.ROOT));
assertEquals("title", StringUtils.toRootLowerCase("TITLE"));
// Make sure we are not using the default Locale:
Locale defaultLocales = Locale.getDefault();
final Locale defaultLocales = Locale.getDefault();
try {
Locale.setDefault(TURKISH);
assertEquals("title", StringUtils.toRootLowerCase("TITLE"));
@ -3293,7 +3293,7 @@ public class StringUtilsTest {
assertEquals("TITLE", "title".toUpperCase(Locale.ROOT));
assertEquals("TITLE", StringUtils.toRootUpperCase("title"));
// Make sure we are not using the default Locale:
Locale defaultLocales = Locale.getDefault();
final Locale defaultLocales = Locale.getDefault();
try {
Locale.setDefault(TURKISH);
assertEquals("TITLE", StringUtils.toRootUpperCase("title"));

View File

@ -712,7 +712,7 @@ class ValidateTest {
@Test
void shouldReturnSameInstance() {
Set<String> col = Collections.singleton("a");
final Set<String> col = Collections.singleton("a");
final Set<String> result = Validate.noNullElements(col);
assertSame(col, result);
@ -747,7 +747,7 @@ class ValidateTest {
@Test
void shouldReturnSameInstance() {
Set<String> col = Collections.singleton("a");
final Set<String> col = Collections.singleton("a");
final Set<String> result = Validate.noNullElements(col, "MSG");
assertSame(col, result);

View File

@ -447,7 +447,7 @@ public class EqualsBuilderTest {
@Test
public void testObjectRecursiveGenericString() {
// Note: Do not use literals, because string literals are always mapped by same object (internal() of String))!
String s1_a = String.valueOf(1);
final String s1_a = String.valueOf(1);
final TestRecursiveGenericObject<String> o1_a = new TestRecursiveGenericObject<>(s1_a);
final TestRecursiveGenericObject<String> o1_b = new TestRecursiveGenericObject<>(String.valueOf(1));
final TestRecursiveGenericObject<String> o2 = new TestRecursiveGenericObject<>(String.valueOf(2));

View File

@ -23,10 +23,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class ReflectionToStringBuilderSummaryTest {
@SuppressWarnings("unused")
private String stringField = "string";
private final String stringField = "string";
@ToStringSummary
private String summaryString = "summary";
private final String summaryString = "summary";
@Test
public void testSummary() {

View File

@ -179,7 +179,7 @@ public class BackgroundInitializerTest {
final RuntimeException rex = new RuntimeException();
init.ex = rex;
init.start();
Exception ex = assertThrows(Exception.class, init::get);
final Exception ex = assertThrows(Exception.class, init::get);
assertEquals(rex, ex, "Runtime exception not thrown");
}
@ -193,7 +193,7 @@ public class BackgroundInitializerTest {
final Exception ex = new Exception();
init.ex = ex;
init.start();
ConcurrentException cex = assertThrows(ConcurrentException.class, init::get);
final ConcurrentException cex = assertThrows(ConcurrentException.class, init::get);
assertEquals(ex, cex.getCause(), "Exception not thrown");
}

View File

@ -107,7 +107,7 @@ public class ConcurrentUtilsTest {
@Test
public void testExtractCauseError() {
final Error err = new AssertionError("Test");
AssertionError e =
final AssertionError e =
assertThrows(AssertionError.class, () -> ConcurrentUtils.extractCause(new ExecutionException(err)));
assertEquals(err, e, "Wrong error");
}
@ -154,7 +154,7 @@ public class ConcurrentUtilsTest {
@Test
public void testExtractCauseUncheckedError() {
final Error err = new AssertionError("Test");
Error e = assertThrows(Error.class, () -> ConcurrentUtils.extractCauseUnchecked(new ExecutionException(err)));
final Error e = assertThrows(Error.class, () -> ConcurrentUtils.extractCauseUnchecked(new ExecutionException(err)));
assertEquals(err, e, "Wrong error");
}
@ -164,7 +164,7 @@ public class ConcurrentUtilsTest {
@Test
public void testExtractCauseUncheckedUncheckedException() {
final RuntimeException rex = new RuntimeException("Test");
RuntimeException r =
final RuntimeException r =
assertThrows(RuntimeException.class, () -> ConcurrentUtils.extractCauseUnchecked(new ExecutionException(rex)));
assertEquals(rex, r, "Wrong exception");
}
@ -186,7 +186,7 @@ public class ConcurrentUtilsTest {
@Test
public void testHandleCauseError() {
final Error err = new AssertionError("Test");
Error e = assertThrows(Error.class, () -> ConcurrentUtils.handleCause(new ExecutionException(err)));
final Error e = assertThrows(Error.class, () -> ConcurrentUtils.handleCause(new ExecutionException(err)));
assertEquals(err, e, "Wrong error");
}
@ -196,7 +196,7 @@ public class ConcurrentUtilsTest {
@Test
public void testHandleCauseUncheckedException() {
final RuntimeException rex = new RuntimeException("Test");
RuntimeException r =
final RuntimeException r =
assertThrows(RuntimeException.class, () -> ConcurrentUtils.handleCause(new ExecutionException(rex)));
assertEquals(rex, r, "Wrong exception");
}
@ -207,7 +207,7 @@ public class ConcurrentUtilsTest {
@Test
public void testHandleCauseChecked() {
final Exception ex = new Exception("Test");
ConcurrentException cex =
final ConcurrentException cex =
assertThrows(ConcurrentException.class, () -> ConcurrentUtils.handleCause(new ExecutionException(ex)));
assertEquals(ex, cex.getCause(), "Wrong cause");
}
@ -231,7 +231,7 @@ public class ConcurrentUtilsTest {
@Test
public void testHandleCauseUncheckedError() {
final Error err = new AssertionError("Test");
Error e = assertThrows(Error.class, () -> ConcurrentUtils.handleCauseUnchecked(new ExecutionException(err)));
final Error e = assertThrows(Error.class, () -> ConcurrentUtils.handleCauseUnchecked(new ExecutionException(err)));
assertEquals(err, e, "Wrong error");
}
@ -241,7 +241,7 @@ public class ConcurrentUtilsTest {
@Test
public void testHandleCauseUncheckedUncheckedException() {
final RuntimeException rex = new RuntimeException("Test");
RuntimeException r =
final RuntimeException r =
assertThrows(RuntimeException.class, () -> ConcurrentUtils.handleCauseUnchecked(new ExecutionException(rex)));
assertEquals(rex, r, "Wrong exception");
}
@ -252,7 +252,7 @@ public class ConcurrentUtilsTest {
@Test
public void testHandleCauseUncheckedChecked() {
final Exception ex = new Exception("Test");
ConcurrentRuntimeException crex =
final ConcurrentRuntimeException crex =
assertThrows(ConcurrentRuntimeException.class, () -> ConcurrentUtils.handleCauseUnchecked(new ExecutionException(ex)));
assertEquals(ex, crex.getCause(), "Wrong cause");
}
@ -346,7 +346,7 @@ public class ConcurrentUtilsTest {
final Exception cause = new Exception();
EasyMock.expect(init.get()).andThrow(new ConcurrentException(cause));
EasyMock.replay(init);
ConcurrentRuntimeException crex =
final ConcurrentRuntimeException crex =
assertThrows(ConcurrentRuntimeException.class, () -> ConcurrentUtils.initializeUnchecked(init));
assertSame(cause, crex.getCause(), "Wrong cause");
EasyMock.verify(init);
@ -524,7 +524,7 @@ public class ConcurrentUtilsTest {
final Exception ex = new Exception();
EasyMock.expect(init.get()).andThrow(new ConcurrentException(ex));
EasyMock.replay(init);
ConcurrentRuntimeException crex =
final ConcurrentRuntimeException crex =
assertThrows(
ConcurrentRuntimeException.class,
() -> ConcurrentUtils.createIfAbsentUnchecked(new ConcurrentHashMap<>(), "test", init));

View File

@ -161,8 +161,8 @@ public class EventCountCircuitBreakerTest {
final long timeIncrement = NANO_FACTOR / OPENING_THRESHOLD - 1;
final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
long startTime = timeIncrement * (OPENING_THRESHOLD + 1);
boolean open = !breaker.at(startTime).incrementAndCheckState(OPENING_THRESHOLD + 1);
final long startTime = timeIncrement * (OPENING_THRESHOLD + 1);
final boolean open = !breaker.at(startTime).incrementAndCheckState(OPENING_THRESHOLD + 1);
assertTrue(open, "Not open");
assertFalse(breaker.isClosed(), "Closed");
}

View File

@ -273,7 +273,7 @@ public class MultiBackgroundInitializerTest {
child.ex = new RuntimeException();
initializer.addInitializer(CHILD_INIT, child);
initializer.start();
Exception ex = assertThrows(Exception.class, initializer::get);
final Exception ex = assertThrows(Exception.class, initializer::get);
assertEquals(child.ex, ex, "Wrong exception");
}

View File

@ -69,7 +69,7 @@ public class EventUtilsTest {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
final ObjectChangeListener listener = handler.createListener(ObjectChangeListener.class);
IllegalArgumentException e =
final IllegalArgumentException e =
assertThrows(IllegalArgumentException.class, () -> EventUtils.addEventListener(src, ObjectChangeListener.class, listener));
assertEquals("Class " + src.getClass().getName() + " does not have a public add" + ObjectChangeListener.class.getSimpleName() + " method which takes a parameter of type " + ObjectChangeListener.class.getName() + ".",
e.getMessage());
@ -90,7 +90,7 @@ public class EventUtilsTest {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
final VetoableChangeListener listener = handler.createListener(VetoableChangeListener.class);
IllegalArgumentException e =
final IllegalArgumentException e =
assertThrows(IllegalArgumentException.class, () -> EventUtils.addEventListener(src, VetoableChangeListener.class, listener));
assertEquals("Class " + src.getClass().getName() + " does not have a public add" + VetoableChangeListener.class.getSimpleName() + " method which takes a parameter of type " + VetoableChangeListener.class.getName() + ".",
e.getMessage());

View File

@ -566,7 +566,7 @@ public class ExceptionUtilsTest {
@Test
public void testThrow() {
final Exception expected = new InterruptedException();
Exception actual = assertThrows(Exception.class, () -> ExceptionUtils.rethrow(expected));
final Exception actual = assertThrows(Exception.class, () -> ExceptionUtils.rethrow(expected));
assertSame(expected, actual);
}
@ -678,25 +678,25 @@ public class ExceptionUtilsTest {
@Test
public void testWrapAndUnwrapCheckedException() {
Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new IOException()));
final Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new IOException()));
assertTrue(ExceptionUtils.hasCause(t, IOException.class));
}
@Test
public void testWrapAndUnwrapError() {
Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new OutOfMemoryError()));
final Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new OutOfMemoryError()));
assertTrue(ExceptionUtils.hasCause(t, Error.class));
}
@Test
public void testWrapAndUnwrapRuntimeException() {
Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new IllegalArgumentException()));
final Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new IllegalArgumentException()));
assertTrue(ExceptionUtils.hasCause(t, RuntimeException.class));
}
@Test
public void testWrapAndUnwrapThrowable() {
Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new TestThrowable()));
final Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new TestThrowable()));
assertTrue(ExceptionUtils.hasCause(t, TestThrowable.class));
}
}

View File

@ -173,7 +173,7 @@ public class FieldUtilsTest {
final Field[] allFields = FieldUtils.getAllFields(PublicChild.class);
// Under Jacoco,0.8.1 and Java 10, the field count is 7.
int expected = 5;
for (Field field : allFields) {
for (final Field field : allFields) {
if (field.getName().equals(JACOCO_DATA_FIELD_NAME)) {
expected++;
}
@ -193,7 +193,7 @@ public class FieldUtilsTest {
final List<Field> allFields = FieldUtils.getAllFieldsList(PublicChild.class);
// Under Jacoco,0.8.1 and Java 10, the field count is 7.
int expected = 5;
for (Field field : allFields) {
for (final Field field : allFields) {
if (field.getName().equals(JACOCO_DATA_FIELD_NAME)) {
expected++;
}
@ -672,7 +672,7 @@ public class FieldUtilsTest {
@Test
public void testWriteStaticField() throws Exception {
Field field = StaticContainer.class.getDeclaredField("mutablePublic");
final Field field = StaticContainer.class.getDeclaredField("mutablePublic");
FieldUtils.writeStaticField(field, "new");
assertEquals("new", StaticContainer.mutablePublic);
assertThrows(
@ -830,7 +830,7 @@ public class FieldUtilsTest {
@Test
public void testWriteField() throws Exception {
Field field = parentClass.getDeclaredField("s");
final Field field = parentClass.getDeclaredField("s");
FieldUtils.writeField(field, publicChild, "S");
assertEquals("S", field.get(publicChild));
assertThrows(
@ -1049,10 +1049,10 @@ public class FieldUtilsTest {
* @param forceAccess {@link Boolean} to be curried into
* {@link FieldUtils#removeFinalModifier(Field, boolean)}.
*/
private void callRemoveFinalModifierCheckForException(Field field, Boolean forceAccess) {
private void callRemoveFinalModifierCheckForException(final Field field, final Boolean forceAccess) {
try {
FieldUtils.removeFinalModifier(field, forceAccess);
} catch (UnsupportedOperationException exception) {
} catch (final UnsupportedOperationException exception) {
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_12)) {
assertTrue(exception.getCause() instanceof NoSuchFieldException);
} else {

View File

@ -521,7 +521,7 @@ public class StrBuilderTest {
final StrBuilder sb = new StrBuilder();
sb.append("junit");
char[] a = new char[5];
final char[] a = new char[5];
sb.getChars(0, 5, a, 0);
assertArrayEquals(new char[]{'j', 'u', 'n', 'i', 't'}, a);
@ -538,7 +538,7 @@ public class StrBuilderTest {
//-----------------------------------------------------------------------
@Test
public void testDeleteIntInt() {
StrBuilder sb = new StrBuilder("abc");
final StrBuilder sb = new StrBuilder("abc");
sb.delete(0, 1);
assertEquals("bc", sb.toString());
sb.delete(1, 2);
@ -679,7 +679,7 @@ public class StrBuilderTest {
// -----------------------------------------------------------------------
@Test
public void testReplace_int_int_String() {
StrBuilder sb = new StrBuilder("abc");
final StrBuilder sb = new StrBuilder("abc");
sb.replace(0, 1, "d");
assertEquals("dbc", sb.toString());
sb.replace(0, 1, "aaa");
@ -693,12 +693,12 @@ public class StrBuilderTest {
sb.replace(0, 1000, "text");
assertEquals("text", sb.toString());
StrBuilder sb1 = new StrBuilder("atext");
final StrBuilder sb1 = new StrBuilder("atext");
sb1.replace(1, 1, "ny");
assertEquals("anytext", sb1.toString());
assertThrows(IndexOutOfBoundsException.class, () -> sb1.replace(2, 1, "anything"));
StrBuilder sb2 = new StrBuilder();
final StrBuilder sb2 = new StrBuilder();
assertThrows(IndexOutOfBoundsException.class, () -> sb2.replace(1, 2, "anything"));
assertThrows(IndexOutOfBoundsException.class, () -> sb2.replace(-1, 1, "anything"));
}
@ -960,13 +960,13 @@ public class StrBuilderTest {
sb.replace(StrMatcher.stringMatcher("aa"), "-", 10, sb.length(), -1);
assertEquals("aaxaaaayaa", sb.toString());
StrBuilder sb1 = new StrBuilder("aaxaaaayaa");
final StrBuilder sb1 = new StrBuilder("aaxaaaayaa");
assertThrows(
IndexOutOfBoundsException.class,
() -> sb1.replace(StrMatcher.stringMatcher("aa"), "-", 11, sb1.length(), -1));
assertEquals("aaxaaaayaa", sb1.toString());
StrBuilder sb2 = new StrBuilder("aaxaaaayaa");
final StrBuilder sb2 = new StrBuilder("aaxaaaayaa");
assertThrows(
IndexOutOfBoundsException.class,
() -> sb2.replace(StrMatcher.stringMatcher("aa"), "-", -1, sb2.length(), -1));
@ -1019,7 +1019,7 @@ public class StrBuilderTest {
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 1000, -1);
assertEquals("-x--y-", sb.toString());
StrBuilder sb1 = new StrBuilder("aaxaaaayaa");
final StrBuilder sb1 = new StrBuilder("aaxaaaayaa");
assertThrows(
IndexOutOfBoundsException.class,
() -> sb1.replace(StrMatcher.stringMatcher("aa"), "-", 2, 1, -1));

View File

@ -245,7 +245,7 @@ public class StrSubstitutorTest {
map.put("critterSpeed", "quick");
map.put("critterColor", "brown");
map.put("critterType", "${animal}");
StrSubstitutor sub = new StrSubstitutor(map);
final StrSubstitutor sub = new StrSubstitutor(map);
assertThrows(
IllegalStateException.class,
() -> sub.replace("The ${animal} jumps over the ${target}."),
@ -253,7 +253,7 @@ public class StrSubstitutorTest {
// also check even when default value is set.
map.put("critterType", "${animal:-fox}");
StrSubstitutor sub2 = new StrSubstitutor(map);
final StrSubstitutor sub2 = new StrSubstitutor(map);
assertThrows(
IllegalStateException.class,
() -> sub2.replace("The ${animal} jumps over the ${target}."),

View File

@ -1514,10 +1514,10 @@ public class DateUtilsTest {
it = DateUtils.iterator((Object) now, DateUtils.RANGE_WEEK_CENTER);
assertWeekIterator(it, centered);
Iterator<?> it2 = DateUtils.iterator((Object) now.getTime(), DateUtils.RANGE_WEEK_CENTER);
final Iterator<?> it2 = DateUtils.iterator((Object) now.getTime(), DateUtils.RANGE_WEEK_CENTER);
assertWeekIterator(it2, centered);
assertThrows(NoSuchElementException.class, it2::next);
Iterator<?> it3 = DateUtils.iterator(now, DateUtils.RANGE_WEEK_CENTER);
final Iterator<?> it3 = DateUtils.iterator(now, DateUtils.RANGE_WEEK_CENTER);
it3.next();
assertThrows(UnsupportedOperationException.class, it3::remove);

View File

@ -140,7 +140,7 @@ public class FastDateParserSDFTest {
checkParsePosition(input.toLowerCase(locale), format, locale, valid);
}
private void checkParse(final String formattedDate, String format, Locale locale, boolean valid) {
private void checkParse(final String formattedDate, final String format, final Locale locale, final boolean valid) {
final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
sdf.setTimeZone(timeZone);
final DateParser fdf = new FastDateParser(format, timeZone, locale);
@ -176,7 +176,7 @@ public class FastDateParserSDFTest {
assertEquals(sdfE, fdfE, locale.toString()+" "+formattedDate + " expected same Exception ");
}
}
private void checkParsePosition(final String formattedDate, String format, Locale locale, boolean valid) {
private void checkParsePosition(final String formattedDate, final String format, final Locale locale, final boolean valid) {
final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
sdf.setTimeZone(timeZone);
final DateParser fdf = new FastDateParser(format, timeZone, locale);

View File

@ -37,7 +37,7 @@ public class FastDatePrinterTimeZonesTest {
@ParameterizedTest
@MethodSource("data")
public void testCalendarTimezoneRespected(TimeZone timeZone) {
public void testCalendarTimezoneRespected(final TimeZone timeZone) {
final Calendar cal = Calendar.getInstance(timeZone);
final SimpleDateFormat sdf = new SimpleDateFormat(PATTERN);

View File

@ -54,7 +54,7 @@ public class WeekYearTest {
@ParameterizedTest
@MethodSource("data")
public void testParser(Calendar vulgar, String isoForm) {
public void testParser(final Calendar vulgar, final String isoForm) {
final DateParser parser = new FastDateParser("YYYY-'W'ww-u", TimeZone.getDefault(), Locale.getDefault());
final Calendar cal = Calendar.getInstance();
@ -68,7 +68,7 @@ public class WeekYearTest {
@ParameterizedTest
@MethodSource("data")
public void testPrinter(Calendar vulgar, String isoForm) {
public void testPrinter(final Calendar vulgar, final String isoForm) {
final FastDatePrinter printer = new FastDatePrinter("YYYY-'W'ww-u", TimeZone.getDefault(), Locale.getDefault());
vulgar.setMinimalDaysInFirstWeek(4);

View File

@ -154,7 +154,7 @@ public class ImmutablePairTest {
assertNull(pair2.getLeft());
assertEquals("bar", pair2.right);
assertEquals("bar", pair2.getRight());
ImmutablePair pair3 = ImmutablePair.of(null, null);
final ImmutablePair pair3 = ImmutablePair.of(null, null);
assertNull(pair3.left);
assertNull(pair3.right);
}
@ -182,11 +182,11 @@ public class ImmutablePairTest {
@Test
public void testUseAsKeyOfHashMap() {
HashMap<ImmutablePair<Object, Object>, String> map = new HashMap<>();
Object o1 = new Object();
Object o2 = new Object();
ImmutablePair<Object, Object> key1 = ImmutablePair.of(o1, o2);
String value1 = "a1";
final HashMap<ImmutablePair<Object, Object>, String> map = new HashMap<>();
final Object o1 = new Object();
final Object o2 = new Object();
final ImmutablePair<Object, Object> key1 = ImmutablePair.of(o1, o2);
final String value1 = "a1";
map.put(key1, value1);
assertEquals(value1, map.get(key1));
assertEquals(value1, map.get(ImmutablePair.of(o1, o2)));
@ -194,17 +194,17 @@ public class ImmutablePairTest {
@Test
public void testUseAsKeyOfTreeMap() {
TreeMap<ImmutablePair<Integer, Integer>, String> map = new TreeMap<>();
final TreeMap<ImmutablePair<Integer, Integer>, String> map = new TreeMap<>();
map.put(ImmutablePair.of(1, 2), "12");
map.put(ImmutablePair.of(1, 1), "11");
map.put(ImmutablePair.of(0, 1), "01");
ArrayList<ImmutablePair<Integer, Integer>> expected = new ArrayList<>();
final ArrayList<ImmutablePair<Integer, Integer>> expected = new ArrayList<>();
expected.add(ImmutablePair.of(0, 1));
expected.add(ImmutablePair.of(1, 1));
expected.add(ImmutablePair.of(1, 2));
Iterator<Entry<ImmutablePair<Integer, Integer>, String>> it = map.entrySet().iterator();
for (ImmutablePair<Integer, Integer> item : expected) {
Entry<ImmutablePair<Integer, Integer>, String> entry = it.next();
final Iterator<Entry<ImmutablePair<Integer, Integer>, String>> it = map.entrySet().iterator();
for (final ImmutablePair<Integer, Integer> item : expected) {
final Entry<ImmutablePair<Integer, Integer>, String> entry = it.next();
assertEquals(item, entry.getKey());
assertEquals(item.getLeft() + "" + item.getRight(), entry.getValue());
}

View File

@ -163,12 +163,12 @@ public class ImmutableTripleTest {
@Test
public void testUseAsKeyOfHashMap() {
HashMap<ImmutableTriple<Object, Object, Object>, String> map = new HashMap<>();
Object o1 = new Object();
Object o2 = new Object();
Object o3 = new Object();
ImmutableTriple<Object, Object, Object> key1 = ImmutableTriple.of(o1, o2, o3);
String value1 = "a1";
final HashMap<ImmutableTriple<Object, Object, Object>, String> map = new HashMap<>();
final Object o1 = new Object();
final Object o2 = new Object();
final Object o3 = new Object();
final ImmutableTriple<Object, Object, Object> key1 = ImmutableTriple.of(o1, o2, o3);
final String value1 = "a1";
map.put(key1, value1);
assertEquals(value1, map.get(key1));
assertEquals(value1, map.get(ImmutableTriple.of(o1, o2, o3)));
@ -176,17 +176,17 @@ public class ImmutableTripleTest {
@Test
public void testUseAsKeyOfTreeMap() {
TreeMap<ImmutableTriple<Integer, Integer, Integer>, String> map = new TreeMap<>();
final TreeMap<ImmutableTriple<Integer, Integer, Integer>, String> map = new TreeMap<>();
map.put(ImmutableTriple.of(0, 1, 2), "012");
map.put(ImmutableTriple.of(0, 1, 1), "011");
map.put(ImmutableTriple.of(0, 0, 1), "001");
ArrayList<ImmutableTriple<Integer, Integer, Integer>> expected = new ArrayList<>();
final ArrayList<ImmutableTriple<Integer, Integer, Integer>> expected = new ArrayList<>();
expected.add(ImmutableTriple.of(0, 0, 1));
expected.add(ImmutableTriple.of(0, 1, 1));
expected.add(ImmutableTriple.of(0, 1, 2));
Iterator<Entry<ImmutableTriple<Integer, Integer, Integer>, String>> it = map.entrySet().iterator();
for (ImmutableTriple<Integer, Integer, Integer> item : expected) {
Entry<ImmutableTriple<Integer, Integer, Integer>, String> entry = it.next();
final Iterator<Entry<ImmutableTriple<Integer, Integer, Integer>, String>> it = map.entrySet().iterator();
for (final ImmutableTriple<Integer, Integer, Integer> item : expected) {
final Entry<ImmutableTriple<Integer, Integer, Integer>, String> entry = it.next();
assertEquals(item, entry.getKey());
assertEquals(item.getLeft() + "" + item.getMiddle() + "" + item.getRight(), entry.getValue());
}

View File

@ -123,7 +123,7 @@ public class MutablePairTest {
final MutablePair<Object, String> pair2 = MutablePair.of(null, "bar");
assertNull(pair2.getLeft());
assertEquals("bar", pair2.getRight());
MutablePair pair3 = MutablePair.of(null, null);
final MutablePair pair3 = MutablePair.of(null, null);
assertNull(pair3.left);
assertNull(pair3.right);
}

View File

@ -123,7 +123,7 @@ public class PairTest {
assertTrue(pair2 instanceof ImmutablePair<?, ?>);
assertNull(((ImmutablePair<Object, String>) pair2).left);
assertEquals("bar", ((ImmutablePair<Object, String>) pair2).right);
Pair pair3 = Pair.of(null, null);
final Pair pair3 = Pair.of(null, null);
assertNull(pair3.getLeft());
assertNull(pair3.getRight());
}