aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGary Gregory <ggregory@apache.org>2016-10-23 10:55:56 -0700
committerGary Gregory <ggregory@apache.org>2016-10-23 10:55:56 -0700
commiteb2b89efbe15ab0b70fd94f0ecd0aa03866fb4d2 (patch)
tree38e07f2997b0ee2d779dcbcb52198aa68a7cb738 /src/test
parentaadb9a31ed969fc72cc87d486ec02383faa5bd06 (diff)
downloadapache-commons-lang-eb2b89efbe15ab0b70fd94f0ecd0aa03866fb4d2.tar.gz
Add final modifier to local variables.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java88
-rw-r--r--src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java6
-rw-r--r--src/test/java/org/apache/commons/lang3/RandomUtilsTest.java8
-rw-r--r--src/test/java/org/apache/commons/lang3/StringUtilsTest.java50
-rw-r--r--src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java10
-rw-r--r--src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java4
-rw-r--r--src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java46
-rw-r--r--src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java48
-rw-r--r--src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java2
-rw-r--r--src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java58
-rw-r--r--src/test/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreakerTest.java10
-rw-r--r--src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java8
-rw-r--r--src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java18
-rw-r--r--src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java16
-rw-r--r--src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java16
-rw-r--r--src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java16
-rw-r--r--src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java16
-rw-r--r--src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java16
-rw-r--r--src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java16
-rw-r--r--src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java2
-rw-r--r--src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java8
-rw-r--r--src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java4
-rw-r--r--src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java6
-rw-r--r--src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java2
-rw-r--r--src/test/java/org/apache/commons/lang3/text/StrLookupTest.java10
-rw-r--r--src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java6
-rw-r--r--src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java16
-rw-r--r--src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java4
-rw-r--r--src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java6
-rw-r--r--src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java10
-rw-r--r--src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java22
-rw-r--r--src/test/java/org/apache/commons/lang3/time/FastDateParser_MoreOrLessTest.java42
-rw-r--r--src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java8
-rw-r--r--src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java50
-rw-r--r--src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java4
-rw-r--r--src/test/java/org/apache/commons/lang3/time/StopWatchTest.java2
-rw-r--r--src/test/java/org/apache/commons/lang3/time/WeekYearTest.java2
37 files changed, 328 insertions, 328 deletions
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index 8c21dbca1..7b2f57843 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -367,7 +367,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyGenericNull() {
- TestClass[] output = ArrayUtils.nullToEmpty(null, TestClass[].class);
+ final TestClass[] output = ArrayUtils.nullToEmpty(null, TestClass[].class);
assertTrue(output != null);
assertTrue(output.length == 0);
@@ -375,23 +375,23 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyGenericEmpty() {
- TestClass[] input = new TestClass[]{};
- TestClass[] output = ArrayUtils.nullToEmpty(input, TestClass[].class);
+ final TestClass[] input = new TestClass[]{};
+ final TestClass[] output = ArrayUtils.nullToEmpty(input, TestClass[].class);
assertSame(input, output);
}
@Test
public void testNullToEmptyGeneric() {
- TestClass[] input = new TestClass[]{new TestClass(), new TestClass()};
- TestClass[] output = ArrayUtils.nullToEmpty(input, TestClass[].class);
+ final TestClass[] input = new TestClass[]{new TestClass(), new TestClass()};
+ final TestClass[] output = ArrayUtils.nullToEmpty(input, TestClass[].class);
assertSame(input, output);
}
@Test(expected=IllegalArgumentException.class)
public void testNullToEmptyGenericNullType() {
- TestClass[] input = new TestClass[]{};
+ final TestClass[] input = new TestClass[]{};
ArrayUtils.nullToEmpty(input, null);
}
@@ -2165,7 +2165,7 @@ public class ArrayUtilsTest {
@Test
public void testSwapFloat() {
- float[] array = new float[] {1, 2, 3};
+ final float[] array = new float[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2196,7 +2196,7 @@ public class ArrayUtilsTest {
@Test
public void testSwapDouble() {
- double[] array = new double[] {1, 2, 3};
+ final double[] array = new double[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2227,7 +2227,7 @@ public class ArrayUtilsTest {
@Test
public void testSwapInt() {
- int[] array = new int[] {1, 2, 3};
+ final int[] array = new int[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
@@ -2270,7 +2270,7 @@ public class ArrayUtilsTest {
@Test
public void testSwapLong() {
- long[] array = new long[] {1, 2, 3};
+ final long[] array = new long[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
@@ -2301,7 +2301,7 @@ public class ArrayUtilsTest {
@Test
public void testSwapObject() {
- String[] array = new String[] {"1", "2", "3"};
+ final String[] array = new String[] {"1", "2", "3"};
ArrayUtils.swap(array, 0, 2);
assertEquals("3", array[0]);
assertEquals("2", array[1]);
@@ -2336,7 +2336,7 @@ public class ArrayUtilsTest {
//-----------------------------------------------------------------------
@Test
public void testShiftDouble() {
- double[] array = new double[] {1, 2, 3, 4};
+ final double[] array = new double[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1);
assertEquals(4, array[0], 0);
assertEquals(1, array[1], 0);
@@ -2361,7 +2361,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeDouble() {
- double[] array = new double[] {1, 2, 3, 4, 5};
+ final double[] array = new double[] {1, 2, 3, 4, 5};
ArrayUtils.shift(array, 1, 3, 1);
assertEquals(1, array[0], 0);
assertEquals(3, array[1], 0);
@@ -2378,7 +2378,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeNoElemDouble() {
- double[] array = new double[] {1, 2, 3, 4};
+ final double[] array = new double[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1, 1, 1);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2388,7 +2388,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftAllDouble() {
- double[] array = new double[] {1, 2, 3, 4};
+ final double[] array = new double[] {1, 2, 3, 4};
ArrayUtils.shift(array, 4);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2403,7 +2403,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftFloat() {
- float[] array = new float[] {1, 2, 3, 4};
+ final float[] array = new float[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1);
assertEquals(4, array[0], 0);
assertEquals(1, array[1], 0);
@@ -2428,7 +2428,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeFloat() {
- float[] array = new float[] {1, 2, 3, 4, 5};
+ final float[] array = new float[] {1, 2, 3, 4, 5};
ArrayUtils.shift(array, 1, 3, 1);
assertEquals(1, array[0], 0);
assertEquals(3, array[1], 0);
@@ -2445,7 +2445,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeNoElemFloat() {
- float[] array = new float[] {1, 2, 3, 4};
+ final float[] array = new float[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1, 1, 1);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2455,7 +2455,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftAllFloat() {
- float[] array = new float[] {1, 2, 3, 4};
+ final float[] array = new float[] {1, 2, 3, 4};
ArrayUtils.shift(array, 4);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2502,7 +2502,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeShort() {
- short[] array = new short[] {1, 2, 3, 4, 5};
+ final short[] array = new short[] {1, 2, 3, 4, 5};
ArrayUtils.shift(array, 1, 3, 1);
assertEquals(1, array[0]);
assertEquals(3, array[1]);
@@ -2519,7 +2519,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeNoElemShort() {
- short[] array = new short[] {1, 2, 3, 4};
+ final short[] array = new short[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1, 1, 1);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2529,7 +2529,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftAllShort() {
- short[] array = new short[] {1, 2, 3, 4};
+ final short[] array = new short[] {1, 2, 3, 4};
ArrayUtils.shift(array, 4);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2544,7 +2544,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftByte() {
- byte[] array = new byte[] {1, 2, 3, 4};
+ final byte[] array = new byte[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1);
assertEquals(4, array[0]);
assertEquals(1, array[1]);
@@ -2569,7 +2569,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeByte() {
- byte[] array = new byte[] {1, 2, 3, 4, 5};
+ final byte[] array = new byte[] {1, 2, 3, 4, 5};
ArrayUtils.shift(array, 1, 3, 1);
assertEquals(1, array[0]);
assertEquals(3, array[1]);
@@ -2586,7 +2586,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeNoElemByte() {
- byte[] array = new byte[] {1, 2, 3, 4};
+ final byte[] array = new byte[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1, 1, 1);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2596,7 +2596,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftAllByte() {
- byte[] array = new byte[] {1, 2, 3, 4};
+ final byte[] array = new byte[] {1, 2, 3, 4};
ArrayUtils.shift(array, 4);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2611,7 +2611,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftChar() {
- char[] array = new char[] {1, 2, 3, 4};
+ final char[] array = new char[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1);
assertEquals(4, array[0]);
assertEquals(1, array[1]);
@@ -2636,7 +2636,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeChar() {
- char[] array = new char[] {1, 2, 3, 4, 5};
+ final char[] array = new char[] {1, 2, 3, 4, 5};
ArrayUtils.shift(array, 1, 3, 1);
assertEquals(1, array[0]);
assertEquals(3, array[1]);
@@ -2653,7 +2653,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeNoElemChar() {
- char[] array = new char[] {1, 2, 3, 4};
+ final char[] array = new char[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1, 1, 1);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2663,7 +2663,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftAllChar() {
- char[] array = new char[] {1, 2, 3, 4};
+ final char[] array = new char[] {1, 2, 3, 4};
ArrayUtils.shift(array, 4);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2678,7 +2678,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftLong() {
- long[] array = new long[] {1, 2, 3, 4};
+ final long[] array = new long[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1);
assertEquals(4, array[0]);
assertEquals(1, array[1]);
@@ -2703,7 +2703,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeLong() {
- long[] array = new long[] {1, 2, 3, 4, 5};
+ final long[] array = new long[] {1, 2, 3, 4, 5};
ArrayUtils.shift(array, 1, 3, 1);
assertEquals(1, array[0]);
assertEquals(3, array[1]);
@@ -2720,7 +2720,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeNoElemLong() {
- long[] array = new long[] {1, 2, 3, 4};
+ final long[] array = new long[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1, 1, 1);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2730,7 +2730,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftAllLong() {
- long[] array = new long[] {1, 2, 3, 4};
+ final long[] array = new long[] {1, 2, 3, 4};
ArrayUtils.shift(array, 4);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2745,7 +2745,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftInt() {
- int[] array = new int[] {1, 2, 3, 4};
+ final int[] array = new int[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1);
assertEquals(4, array[0]);
assertEquals(1, array[1]);
@@ -2770,7 +2770,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeInt() {
- int[] array = new int[] {1, 2, 3, 4, 5};
+ final int[] array = new int[] {1, 2, 3, 4, 5};
ArrayUtils.shift(array, 1, 3, 1);
assertEquals(1, array[0]);
assertEquals(3, array[1]);
@@ -2787,7 +2787,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeNoElemInt() {
- int[] array = new int[] {1, 2, 3, 4};
+ final int[] array = new int[] {1, 2, 3, 4};
ArrayUtils.shift(array, 1, 1, 1);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2797,7 +2797,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftAllInt() {
- int[] array = new int[] {1, 2, 3, 4};
+ final int[] array = new int[] {1, 2, 3, 4};
ArrayUtils.shift(array, 4);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2812,7 +2812,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftObject() {
- String[] array = new String[] {"1", "2", "3", "4"};
+ final String[] array = new String[] {"1", "2", "3", "4"};
ArrayUtils.shift(array, 1);
assertEquals("4", array[0]);
assertEquals("1", array[1]);
@@ -2837,7 +2837,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeObject() {
- String[] array = new String[] {"1", "2", "3", "4", "5"};
+ final String[] array = new String[] {"1", "2", "3", "4", "5"};
ArrayUtils.shift(array, 1, 3, 1);
assertEquals("1", array[0]);
assertEquals("3", array[1]);
@@ -2854,7 +2854,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftRangeNoElemObject() {
- String[] array = new String[] {"1", "2", "3", "4"};
+ final String[] array = new String[] {"1", "2", "3", "4"};
ArrayUtils.shift(array, 1, 1, 1);
assertEquals("1", array[0]);
assertEquals("2", array[1]);
@@ -2864,7 +2864,7 @@ public class ArrayUtilsTest {
@Test
public void testShiftAllObject() {
- String[] array = new String[] {"1", "2", "3", "4"};
+ final String[] array = new String[] {"1", "2", "3", "4"};
ArrayUtils.shift(array, 4);
assertEquals("1", array[0]);
assertEquals("2", array[1]);
@@ -2965,7 +2965,7 @@ public class ArrayUtilsTest {
class LANG1261ChildObject extends LANG1261ParentObject {
}
- Object[] array = new LANG1261ChildObject[] { new LANG1261ChildObject() };
+ final Object[] array = new LANG1261ChildObject[] { new LANG1261ChildObject() };
assertTrue(ArrayUtils.contains(array, new LANG1261ParentObject()));
}
@@ -4287,7 +4287,7 @@ public class ArrayUtilsTest {
@Test
public void testIsSortedComparator() {
- Comparator<Integer> c = new Comparator<Integer>() {
+ final Comparator<Integer> c = new Comparator<Integer>() {
public int compare(final Integer o1, final Integer o2) {
return o2.compareTo(o1);
}
diff --git a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
index 06396be86..7abafead5 100644
--- a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
@@ -105,7 +105,7 @@ public class CharSequenceUtilsTest {
this.throwable = throwable;
}
public String toString(){
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append(source).append("[").append(toffset).append("]");
sb.append(ignoreCase? " caseblind ":" samecase ");
sb.append(other).append("[").append(ooffset).append("]");
@@ -145,13 +145,13 @@ public class CharSequenceUtilsTest {
try {
invoke();
Assert.fail(id + " Expected " + data.throwable);
- } catch (Exception e) {
+ } catch (final Exception e) {
if (!e.getClass().equals(data.throwable)) {
Assert.fail(id + " Expected " + data.throwable + " got " + e.getClass());
}
}
} else {
- boolean stringCheck = invoke();
+ final boolean stringCheck = invoke();
Assert.assertEquals(id + " Failed test " + data, data.expected, stringCheck);
}
}
diff --git a/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
index e1108e50b..a46a36ab8 100644
--- a/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
@@ -117,7 +117,7 @@ public class RandomUtilsTest {
*/
@Test
public void testNextIntRandomResult() {
- int randomResult = RandomUtils.nextInt();
+ final int randomResult = RandomUtils.nextInt();
assertTrue(randomResult > 0);
assertTrue(randomResult < Integer.MAX_VALUE);
}
@@ -152,7 +152,7 @@ public class RandomUtilsTest {
*/
@Test
public void testNextDoubleRandomResult() {
- double randomResult = RandomUtils.nextDouble();
+ final double randomResult = RandomUtils.nextDouble();
assertTrue(randomResult > 0);
assertTrue(randomResult < Double.MAX_VALUE);
}
@@ -171,7 +171,7 @@ public class RandomUtilsTest {
*/
@Test
public void testNextFloatRandomResult() {
- float randomResult = RandomUtils.nextFloat();
+ final float randomResult = RandomUtils.nextFloat();
assertTrue(randomResult > 0);
assertTrue(randomResult < Float.MAX_VALUE);
}
@@ -198,7 +198,7 @@ public class RandomUtilsTest {
*/
@Test
public void testNextLongRandomResult() {
- long randomResult = RandomUtils.nextLong();
+ final long randomResult = RandomUtils.nextLong();
assertTrue(randomResult > 0);
assertTrue(randomResult < Long.MAX_VALUE);
}
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index 8f0e88e4a..3e12a9c44 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -1283,7 +1283,7 @@ public class StringUtilsTest {
assertEquals("", StringUtils.replaceIgnoreCase("", "any", null, 2));
assertEquals("", StringUtils.replaceIgnoreCase("", "any", "any", 2));
- String str = new String(new char[] { 'o', 'o', 'f', 'o', 'o' });
+ final String str = new String(new char[] { 'o', 'o', 'f', 'o', 'o' });
assertSame(str, StringUtils.replaceIgnoreCase(str, "x", "", -1));
assertEquals("f", StringUtils.replaceIgnoreCase("oofoo", "o", "", -1));
@@ -2052,19 +2052,19 @@ public class StringUtilsTest {
try {
StringUtils.truncate(null, -1);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate(null, -10);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate(null, Integer.MIN_VALUE);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
assertEquals("", StringUtils.truncate("", 10));
@@ -2075,19 +2075,19 @@ public class StringUtilsTest {
try {
StringUtils.truncate("abcdefghij", -1);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", -100);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", Integer.MIN_VALUE);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
assertEquals("abcdefghij", StringUtils.truncate("abcdefghijklmno", 10));
@@ -2102,19 +2102,19 @@ public class StringUtilsTest {
try {
StringUtils.truncate(null, -1, 0);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate(null, -10, -4);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate(null, Integer.MIN_VALUE, Integer.MIN_VALUE);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
assertNull(StringUtils.truncate(null, 10, 12));
@@ -2126,79 +2126,79 @@ public class StringUtilsTest {
try {
StringUtils.truncate("abcdefghij", 0, -1);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", 0, -10);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", 0, -100);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", 1, -100);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", 0, Integer.MIN_VALUE);
fail("maxWith cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", -1, 0);
fail("offset cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", -10, 0);
fail("offset cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", -100, 1);
fail("offset cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", Integer.MIN_VALUE, 0);
fail("offset cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", -1, -1);
fail("offset cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", -10, -10);
fail("offset cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", -100, -100);
fail("offset cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
StringUtils.truncate("abcdefghij", Integer.MIN_VALUE, Integer.MIN_VALUE);
fail("offset cannot be negative");
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
final String raspberry = "raspberry peach";
@@ -2764,7 +2764,7 @@ public class StringUtilsTest {
final Method[] methods = c.getMethods();
for (final Method m : methods) {
- String methodStr = m.toString();
+ final String methodStr = m.toString();
if (m.getReturnType() == String.class || m.getReturnType() == String[].class) {
// Assume this is mutable and ensure the first parameter is not CharSequence.
// It may be String or it may be something else (String[], Object, Object[]) so
@@ -2803,7 +2803,7 @@ public class StringUtilsTest {
// sanity check end
assertEquals(expectedString, StringUtils.toString(expectedBytes, null));
assertEquals(expectedString, StringUtils.toString(expectedBytes, SystemUtils.FILE_ENCODING));
- String encoding = "UTF-16";
+ final String encoding = "UTF-16";
expectedBytes = expectedString.getBytes(Charset.forName(encoding));
assertEquals(expectedString, StringUtils.toString(expectedBytes, encoding));
}
diff --git a/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
index aa53fd1b8..d04b70fbe 100644
--- a/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
@@ -471,12 +471,12 @@ public class DiffBuilderTest {
final Matcher<Integer> equalToOne = equalTo(1);
// Constructor's arguments are not trivially equal, but not testing for that.
- DiffBuilder explicitTestAndNotEqual1 = new DiffBuilder(1, 2, null, false);
+ final DiffBuilder explicitTestAndNotEqual1 = new DiffBuilder(1, 2, null, false);
explicitTestAndNotEqual1.append("letter", "X", "Y");
assertThat(explicitTestAndNotEqual1.build().getNumberOfDiffs(), equalToOne);
// Constructor's arguments are trivially equal, but not testing for that.
- DiffBuilder explicitTestAndNotEqual2 = new DiffBuilder(1, 1, null, false);
+ final DiffBuilder explicitTestAndNotEqual2 = new DiffBuilder(1, 1, null, false);
// This append(f, l, r) will not abort early.
explicitTestAndNotEqual2.append("letter", "X", "Y");
assertThat(explicitTestAndNotEqual2.build().getNumberOfDiffs(), equalToOne);
@@ -488,19 +488,19 @@ public class DiffBuilderTest {
final Matcher<Integer> equalToOne = equalTo(1);
// The option to test if trivially equal is enabled by default.
- DiffBuilder implicitTestAndEqual = new DiffBuilder(1, 1, null);
+ final DiffBuilder implicitTestAndEqual = new DiffBuilder(1, 1, null);
// This append(f, l, r) will abort without creating a Diff for letter.
implicitTestAndEqual.append("letter", "X", "Y");
assertThat(implicitTestAndEqual.build().getNumberOfDiffs(), equalToZero);
- DiffBuilder implicitTestAndNotEqual = new DiffBuilder(1, 2, null);
+ final DiffBuilder implicitTestAndNotEqual = new DiffBuilder(1, 2, null);
// This append(f, l, r) will not abort early
// because the constructor's arguments were not trivially equal.
implicitTestAndNotEqual.append("letter", "X", "Y");
assertThat(implicitTestAndNotEqual.build().getNumberOfDiffs(), equalToOne);
// This is explicitly enabling the trivially equal test.
- DiffBuilder explicitTestAndEqual = new DiffBuilder(1, 1, null, true);
+ final DiffBuilder explicitTestAndEqual = new DiffBuilder(1, 1, null, true);
explicitTestAndEqual.append("letter", "X", "Y");
assertThat(explicitTestAndEqual.build().getNumberOfDiffs(), equalToZero);
}
diff --git a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
index 8ce0a049d..b28b89c3f 100644
--- a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
@@ -604,8 +604,8 @@ public class HashCodeBuilderTest {
@Test
public void testToHashCodeExclude() {
- TestObjectHashCodeExclude one = new TestObjectHashCodeExclude(1, 2);
- TestObjectHashCodeExclude2 two = new TestObjectHashCodeExclude2(1, 2);
+ final TestObjectHashCodeExclude one = new TestObjectHashCodeExclude(1, 2);
+ final TestObjectHashCodeExclude2 two = new TestObjectHashCodeExclude2(1, 2);
assertEquals(17 * 37 + 2, HashCodeBuilder.reflectionHashCode(one));
assertEquals(17, HashCodeBuilder.reflectionHashCode(two));
}
diff --git a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
index 404c9c561..682a6d26f 100644
--- a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
@@ -95,7 +95,7 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append('A').toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
assertEquals("{\"a\":\"A\"}", new ToStringBuilder(base).append("a", 'A')
@@ -112,7 +112,7 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append(now).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
assertEquals("{\"now\":\"" + now.toString() +"\"}", new ToStringBuilder(base).append("now", now)
@@ -130,13 +130,13 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append((Object) null).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
new ToStringBuilder(base).append(i3).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
assertEquals("{\"a\":null}",
@@ -150,13 +150,13 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append("a", i3, false).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
assertEquals(
@@ -167,7 +167,7 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append("a", new HashMap<>(), false).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
assertEquals(
@@ -178,7 +178,7 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append("a", (Object) new String[0], false).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
assertEquals(
@@ -189,7 +189,7 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append("a", (Object) new int[]{1, 2, 3}, false).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
@@ -201,7 +201,7 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append("a", (Object) new String[]{"v", "x", "y", "z"}, false).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
@@ -256,7 +256,7 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append(3L).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
assertEquals("{\"a\":3}", new ToStringBuilder(base).append("a", 3L)
@@ -273,26 +273,26 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append(array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
new ToStringBuilder(base).append((Object) array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
array = null;
try {
new ToStringBuilder(base).append(array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
new ToStringBuilder(base).append((Object) array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@@ -303,13 +303,13 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append(array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
new ToStringBuilder(base).append((Object) array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
array = null;
@@ -317,13 +317,13 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append(array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
new ToStringBuilder(base).append((Object) array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@@ -334,13 +334,13 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append(array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
new ToStringBuilder(base).append((Object) array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
array = null;
@@ -348,13 +348,13 @@ public class JsonToStringStyleTest {
try {
new ToStringBuilder(base).append(array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
new ToStringBuilder(base).append((Object) array).toString();
fail("Should have generated UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
diff --git a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
index 4b9ebeea1..51dfff40f 100644
--- a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
@@ -33,8 +33,8 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void simpleObject() {
- Transaction tx = new Transaction("2014.10.15", 100);
- String expected = getClassPrefix(tx) + "[" + BR
+ final Transaction tx = new Transaction("2014.10.15", 100);
+ final String expected = getClassPrefix(tx) + "[" + BR
+ " amount=100.0," + BR
+ " date=2014.10.15" + BR
+ "]";
@@ -43,10 +43,10 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void nestedElements() {
- Customer customer = new Customer("Douglas Adams");
- Bank bank = new Bank("ASF Bank");
+ final Customer customer = new Customer("Douglas Adams");
+ final Bank bank = new Bank("ASF Bank");
customer.bank = bank;
- String exp = getClassPrefix(customer) + "[" + BR
+ final String exp = getClassPrefix(customer) + "[" + BR
+ " name=Douglas Adams," + BR
+ " bank=" + getClassPrefix(bank) + "[" + BR
+ " name=ASF Bank" + BR
@@ -58,12 +58,12 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void nestedAndArray() {
- Account acc = new Account();
- Transaction tx1 = new Transaction("2014.10.14", 100);
- Transaction tx2 = new Transaction("2014.10.15", 50);
+ final Account acc = new Account();
+ final Transaction tx1 = new Transaction("2014.10.14", 100);
+ final Transaction tx2 = new Transaction("2014.10.15", 50);
acc.transactions.add(tx1);
acc.transactions.add(tx2);
- String expected = getClassPrefix(acc) + "[" + BR
+ final String expected = getClassPrefix(acc) + "[" + BR
+ " owner=<null>," + BR
+ " transactions=" + getClassPrefix(acc.transactions) + "{" + BR
+ " " + getClassPrefix(tx1) + "[" + BR
@@ -81,8 +81,8 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void noArray() {
- WithArrays wa = new WithArrays();
- String exp = getClassPrefix(wa) + "[" + BR
+ final WithArrays wa = new WithArrays();
+ final String exp = getClassPrefix(wa) + "[" + BR
+ " boolArray=<null>," + BR
+ " charArray=<null>," + BR
+ " intArray=<null>," + BR
@@ -95,9 +95,9 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void boolArray() {
- WithArrays wa = new WithArrays();
+ final WithArrays wa = new WithArrays();
wa.boolArray = new boolean[] { true, false, true };
- String exp = getClassPrefix(wa) + "[" + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ " boolArray={" + BR
+ " true," + BR
+ " false," + BR
@@ -114,9 +114,9 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void charArray() {
- WithArrays wa = new WithArrays();
+ final WithArrays wa = new WithArrays();
wa.charArray = new char[] { 'a', 'A' };
- String exp = getClassPrefix(wa) + "[" + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ " boolArray=<null>," + BR
+ " charArray={" + BR
+ " a," + BR
@@ -132,9 +132,9 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void intArray() {
- WithArrays wa = new WithArrays();
+ final WithArrays wa = new WithArrays();
wa.intArray = new int[] { 1, 2 };
- String exp = getClassPrefix(wa) + "[" + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ " boolArray=<null>," + BR
+ " charArray=<null>," + BR
+ " intArray={" + BR
@@ -150,9 +150,9 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void doubleArray() {
- WithArrays wa = new WithArrays();
+ final WithArrays wa = new WithArrays();
wa.doubleArray = new double[] { 1, 2 };
- String exp = getClassPrefix(wa) + "[" + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ " boolArray=<null>," + BR
+ " charArray=<null>," + BR
+ " intArray=<null>," + BR
@@ -168,9 +168,9 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void longArray() {
- WithArrays wa = new WithArrays();
+ final WithArrays wa = new WithArrays();
wa.longArray = new long[] { 1L, 2L };
- String exp = getClassPrefix(wa) + "[" + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ " boolArray=<null>," + BR
+ " charArray=<null>," + BR
+ " intArray=<null>," + BR
@@ -186,9 +186,9 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void stringArray() {
- WithArrays wa = new WithArrays();
+ final WithArrays wa = new WithArrays();
wa.stringArray = new String[] { "a", "A" };
- String exp = getClassPrefix(wa) + "[" + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ " boolArray=<null>," + BR
+ " charArray=<null>," + BR
+ " intArray=<null>," + BR
@@ -243,7 +243,7 @@ public class MultilineRecursiveToStringStyleTest {
public double getBalance() {
double balance = 0;
- for (Transaction tx : transactions) {
+ for (final Transaction tx : transactions) {
balance += tx.amount;
}
return balance;
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
index 1a0f91111..7537f3bf3 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
@@ -136,7 +136,7 @@ public class BackgroundInitializerTest {
public void testSetExternalExecutorAfterStart() throws ConcurrentException, InterruptedException {
final BackgroundInitializerTestImpl init = new BackgroundInitializerTestImpl();
init.start();
- ExecutorService exec = Executors.newSingleThreadExecutor();
+ final ExecutorService exec = Executors.newSingleThreadExecutor();
try {
init.setExternalExecutor(exec);
fail("Could set executor after start()!");
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
index d8515e768..3c5dfe484 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
@@ -49,7 +49,7 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testIntervalCalculation() {
- EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
+ final EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS, CLOSING_THRESHOLD, 2, TimeUnit.MILLISECONDS);
assertEquals("Wrong opening interval", NANO_FACTOR, breaker.getOpeningInterval());
assertEquals("Wrong closing interval", 2 * NANO_FACTOR / 1000,
@@ -62,7 +62,7 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testDefaultClosingInterval() {
- EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
+ final EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS, CLOSING_THRESHOLD);
assertEquals("Wrong closing interval", NANO_FACTOR, breaker.getClosingInterval());
}
@@ -73,7 +73,7 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testDefaultClosingThreshold() {
- EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
+ final EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS);
assertEquals("Wrong closing interval", NANO_FACTOR, breaker.getClosingInterval());
assertEquals("Wrong closing threshold", OPENING_THRESHOLD,
@@ -85,7 +85,7 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testInitiallyClosed() {
- EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
+ final EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS);
assertFalse("Open", breaker.isOpen());
assertTrue("Not closed", breaker.isClosed());
@@ -96,10 +96,10 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testNow() {
- EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
+ final EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS);
- long now = breaker.now();
- long delta = Math.abs(System.nanoTime() - now);
+ final long now = breaker.now();
+ final long delta = Math.abs(System.nanoTime() - now);
assertTrue("Delta to current time too large", delta < 100000);
}
@@ -110,7 +110,7 @@ public class EventCountCircuitBreakerTest {
@Test
public void testNotOpeningUnderThreshold() {
long startTime = 1000;
- EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 1,
+ final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
for (int i = 0; i < OPENING_THRESHOLD - 1; i++) {
assertTrue("In open state", breaker.at(startTime).incrementAndCheckState());
@@ -126,8 +126,8 @@ public class EventCountCircuitBreakerTest {
@Test
public void testNotOpeningCheckIntervalExceeded() {
long startTime = 0L;
- long timeIncrement = 3 * NANO_FACTOR / (2 * OPENING_THRESHOLD);
- EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 1,
+ final long timeIncrement = 3 * NANO_FACTOR / (2 * OPENING_THRESHOLD);
+ final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
for (int i = 0; i < 5 * OPENING_THRESHOLD; i++) {
assertTrue("In open state", breaker.at(startTime).incrementAndCheckState());
@@ -142,8 +142,8 @@ public class EventCountCircuitBreakerTest {
@Test
public void testOpeningWhenThresholdReached() {
long startTime = 0;
- long timeIncrement = NANO_FACTOR / OPENING_THRESHOLD - 1;
- EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 1,
+ final long timeIncrement = NANO_FACTOR / OPENING_THRESHOLD - 1;
+ final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
boolean open = false;
for (int i = 0; i < OPENING_THRESHOLD + 1; i++) {
@@ -160,7 +160,7 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testNotClosingOverThreshold() {
- EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD,
+ final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD,
10, TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
long startTime = 0;
breaker.open();
@@ -179,7 +179,7 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testClosingWhenThresholdReached() {
- EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD,
+ final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD,
10, TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
breaker.open();
breaker.at(1000).incrementAndCheckState();
@@ -196,7 +196,7 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testOpenStartsNewCheckInterval() {
- EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 2,
+ final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 2,
TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
breaker.at(NANO_FACTOR - 1000).open();
assertTrue("Not open", breaker.isOpen());
@@ -209,7 +209,7 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testAutomaticOpenStartsNewCheckInterval() {
- EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 2,
+ final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 2,
TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
long time = 10 * NANO_FACTOR;
for (int i = 0; i <= OPENING_THRESHOLD; i++) {
@@ -227,7 +227,7 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testClose() {
- EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 2,
+ final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 2,
TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
long time = 0;
for (int i = 0; i <= OPENING_THRESHOLD; i++, time += 1000) {
@@ -244,9 +244,9 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testChangeEvents() {
- EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
+ final EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS);
- ChangeListener listener = new ChangeListener(breaker);
+ final ChangeListener listener = new ChangeListener(breaker);
breaker.addChangeListener(listener);
breaker.open();
breaker.close();
@@ -258,9 +258,9 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testRemoveChangeListener() {
- EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
+ final EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS);
- ChangeListener listener = new ChangeListener(breaker);
+ final ChangeListener listener = new ChangeListener(breaker);
breaker.addChangeListener(listener);
breaker.open();
breaker.removeChangeListener(listener);
@@ -276,19 +276,19 @@ public class EventCountCircuitBreakerTest {
public void testStateTransitionGuarded() throws InterruptedException {
final EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(OPENING_THRESHOLD, 1,
TimeUnit.SECONDS);
- ChangeListener listener = new ChangeListener(breaker);
+ final ChangeListener listener = new ChangeListener(breaker);
breaker.addChangeListener(listener);
final int threadCount = 128;
final CountDownLatch latch = new CountDownLatch(1);
- Thread[] threads = new Thread[threadCount];
+ final Thread[] threads = new Thread[threadCount];
for (int i = 0; i < threadCount; i++) {
threads[i] = new Thread() {
@Override
public void run() {
try {
latch.await();
- } catch (InterruptedException iex) {
+ } catch (final InterruptedException iex) {
// ignore
}
breaker.open();
@@ -297,7 +297,7 @@ public class EventCountCircuitBreakerTest {
threads[i].start();
}
latch.countDown();
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
thread.join();
}
listener.verify(Boolean.TRUE);
@@ -308,9 +308,9 @@ public class EventCountCircuitBreakerTest {
*/
@Test
public void testChangeEventsGeneratedByAutomaticTransitions() {
- EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 2,
+ final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 2,
TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
- ChangeListener listener = new ChangeListener(breaker);
+ final ChangeListener listener = new ChangeListener(breaker);
breaker.addChangeListener(listener);
long time = 0;
for (int i = 0; i <= OPENING_THRESHOLD; i++, time += 1000) {
@@ -382,8 +382,8 @@ public class EventCountCircuitBreakerTest {
public void propertyChange(final PropertyChangeEvent evt) {
assertEquals("Wrong event source", expectedSource, evt.getSource());
assertEquals("Wrong property name", "open", evt.getPropertyName());
- Boolean newValue = (Boolean) evt.getNewValue();
- Boolean oldValue = (Boolean) evt.getOldValue();
+ final Boolean newValue = (Boolean) evt.getNewValue();
+ final Boolean oldValue = (Boolean) evt.getOldValue();
assertNotEquals("Old and new value are equal", newValue, oldValue);
changedValues.add(newValue);
}
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreakerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreakerTest.java
index 70f22cd22..8be9fa644 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreakerTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreakerTest.java
@@ -39,7 +39,7 @@ public class ThresholdCircuitBreakerTest {
*/
@Test
public void testThreshold() {
- ThresholdCircuitBreaker circuit = new ThresholdCircuitBreaker(threshold);
+ final ThresholdCircuitBreaker circuit = new ThresholdCircuitBreaker(threshold);
circuit.incrementAndCheckState(9L);
assertFalse("Circuit opened before reaching the threshold", circuit.incrementAndCheckState(1L));
}
@@ -49,7 +49,7 @@ public class ThresholdCircuitBreakerTest {
*/
@Test
public void testThresholdCircuitBreakingException() {
- ThresholdCircuitBreaker circuit = new ThresholdCircuitBreaker(threshold);
+ final ThresholdCircuitBreaker circuit = new ThresholdCircuitBreaker(threshold);
circuit.incrementAndCheckState(9L);
assertTrue("The circuit was spposed to be open after increment above the threshold", circuit.incrementAndCheckState(2L));
}
@@ -59,7 +59,7 @@ public class ThresholdCircuitBreakerTest {
*/
@Test
public void testThresholdEqualsZero() {
- ThresholdCircuitBreaker circuit = new ThresholdCircuitBreaker(zeroThreshold);
+ final ThresholdCircuitBreaker circuit = new ThresholdCircuitBreaker(zeroThreshold);
assertTrue("When the threshold is zero, the circuit is supposed to be always open", circuit.incrementAndCheckState(0L));
}
@@ -68,7 +68,7 @@ public class ThresholdCircuitBreakerTest {
*/
@Test
public void testClosingThresholdCircuitBreaker() {
- ThresholdCircuitBreaker circuit = new ThresholdCircuitBreaker(threshold);
+ final ThresholdCircuitBreaker circuit = new ThresholdCircuitBreaker(threshold);
circuit.incrementAndCheckState(9L);
circuit.close();
// now the internal counter is back at zero, not 9 anymore. So it is safe to increment 9 again
@@ -80,7 +80,7 @@ public class ThresholdCircuitBreakerTest {
*/
@Test
public void testGettingThreshold() {
- ThresholdCircuitBreaker circuit = new ThresholdCircuitBreaker(threshold);
+ final ThresholdCircuitBreaker circuit = new ThresholdCircuitBreaker(threshold);
assertEquals("Wrong value of threshold", Long.valueOf(threshold), Long.valueOf(circuit.getThreshold()));
}
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java b/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java
index 15be2f4d9..272491083 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java
@@ -392,8 +392,8 @@ public class TimedSemaphoreTest {
public void testTryAcquire() throws InterruptedException {
final TimedSemaphore semaphore = new TimedSemaphore(PERIOD, TimeUnit.SECONDS,
LIMIT);
- TryAcquireThread[] threads = new TryAcquireThread[3 * LIMIT];
- CountDownLatch latch = new CountDownLatch(1);
+ final TryAcquireThread[] threads = new TryAcquireThread[3 * LIMIT];
+ final CountDownLatch latch = new CountDownLatch(1);
for (int i = 0; i < threads.length; i++) {
threads[i] = new TryAcquireThread(semaphore, latch);
threads[i].start();
@@ -401,7 +401,7 @@ public class TimedSemaphoreTest {
latch.countDown();
int permits = 0;
- for (TryAcquireThread t : threads) {
+ for (final TryAcquireThread t : threads) {
t.join();
if (t.acquired) {
permits++;
@@ -557,7 +557,7 @@ public class TimedSemaphoreTest {
if (latch.await(10, TimeUnit.SECONDS)) {
acquired = semaphore.tryAcquire();
}
- } catch (InterruptedException iex) {
+ } catch (final InterruptedException iex) {
// ignore
}
}
diff --git a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
index 0b2ce4802..18dc8f44c 100644
--- a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
@@ -534,12 +534,12 @@ public class ExceptionUtilsTest {
@Test
public void testThrow() {
- Exception expected = new InterruptedException();
+ final Exception expected = new InterruptedException();
try {
ExceptionUtils.rethrow(expected);
Assert.fail("Exception not thrown");
}
- catch(Exception actual) {
+ catch(final Exception actual) {
Assert.assertSame(expected, actual);
}
}
@@ -550,7 +550,7 @@ public class ExceptionUtilsTest {
throwsCheckedException();
Assert.fail("Exception not thrown");
}
- catch(Exception ioe) {
+ catch(final Exception ioe) {
assertTrue(ioe instanceof IOException);
assertEquals(1, ExceptionUtils.getThrowableCount(ioe));
}
@@ -559,7 +559,7 @@ public class ExceptionUtilsTest {
redeclareCheckedException();
Assert.fail("Exception not thrown");
}
- catch(IOException ioe) {
+ catch(final IOException ioe) {
assertEquals(1, ExceptionUtils.getThrowableCount(ioe));
}
}
@@ -571,7 +571,7 @@ public class ExceptionUtilsTest {
private static int throwsCheckedException() {
try {
throw new IOException();
- } catch (Exception e) {
+ } catch (final Exception e) {
return ExceptionUtils.<Integer>rethrow(e);
}
}
@@ -586,7 +586,7 @@ public class ExceptionUtilsTest {
ExceptionUtils.wrapAndThrow(new OutOfMemoryError());
Assert.fail("Error not thrown");
}
- catch(Throwable t) {
+ catch(final Throwable t) {
Assert.assertTrue(ExceptionUtils.hasCause(t, Error.class));
}
}
@@ -597,7 +597,7 @@ public class ExceptionUtilsTest {
ExceptionUtils.wrapAndThrow(new IllegalArgumentException());
Assert.fail("RuntimeException not thrown");
}
- catch(Throwable t) {
+ catch(final Throwable t) {
Assert.assertTrue(ExceptionUtils.hasCause(t, RuntimeException.class));
}
}
@@ -608,7 +608,7 @@ public class ExceptionUtilsTest {
ExceptionUtils.wrapAndThrow(new IOException());
Assert.fail("Checked Exception not thrown");
}
- catch(Throwable t) {
+ catch(final Throwable t) {
Assert.assertTrue(ExceptionUtils.hasCause(t, IOException.class));
}
}
@@ -619,7 +619,7 @@ public class ExceptionUtilsTest {
ExceptionUtils.wrapAndThrow(new TestThrowable());
Assert.fail("Checked Exception not thrown");
}
- catch(Throwable t) {
+ catch(final Throwable t) {
Assert.assertTrue(ExceptionUtils.hasCause(t, TestThrowable.class));
}
}
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java
index 4903730f2..b63ea0a1b 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java
@@ -145,7 +145,7 @@ public class MutableByteTest {
@Test
public void testIncrementAndGet() {
final MutableByte mutNum = new MutableByte((byte) 1);
- byte result = mutNum.incrementAndGet();
+ final byte result = mutNum.incrementAndGet();
assertEquals(2, result);
assertEquals(2, mutNum.intValue());
@@ -155,7 +155,7 @@ public class MutableByteTest {
@Test
public void testGetAndIncrement() {
final MutableByte mutNum = new MutableByte((byte) 1);
- byte result = mutNum.getAndIncrement();
+ final byte result = mutNum.getAndIncrement();
assertEquals(1, result);
assertEquals(2, mutNum.intValue());
@@ -174,7 +174,7 @@ public class MutableByteTest {
@Test
public void testDecrementAndGet() {
final MutableByte mutNum = new MutableByte((byte) 1);
- byte result = mutNum.decrementAndGet();
+ final byte result = mutNum.decrementAndGet();
assertEquals(0, result);
assertEquals(0, mutNum.intValue());
@@ -184,7 +184,7 @@ public class MutableByteTest {
@Test
public void testGetAndDecrement() {
final MutableByte mutNum = new MutableByte((byte) 1);
- byte result = mutNum.getAndDecrement();
+ final byte result = mutNum.getAndDecrement();
assertEquals(1, result);
assertEquals(0, mutNum.intValue());
@@ -210,7 +210,7 @@ public class MutableByteTest {
@Test
public void testGetAndAddValuePrimitive() {
final MutableByte mutableByte = new MutableByte((byte)0);
- byte result = mutableByte.getAndAdd((byte) 1);
+ final byte result = mutableByte.getAndAdd((byte) 1);
assertEquals((byte) 0, result);
assertEquals((byte) 1, mutableByte.byteValue());
@@ -219,7 +219,7 @@ public class MutableByteTest {
@Test
public void testGetAndAddValueObject() {
final MutableByte mutableByte = new MutableByte((byte)0);
- byte result = mutableByte.getAndAdd(Byte.valueOf((byte) 1));
+ final byte result = mutableByte.getAndAdd(Byte.valueOf((byte) 1));
assertEquals((byte) 0, result);
assertEquals((byte) 1, mutableByte.byteValue());
@@ -228,7 +228,7 @@ public class MutableByteTest {
@Test
public void testAddAndGetValuePrimitive() {
final MutableByte mutableByte = new MutableByte((byte)0);
- byte result = mutableByte.addAndGet((byte) 1);
+ final byte result = mutableByte.addAndGet((byte) 1);
assertEquals((byte) 1, result);
assertEquals((byte) 1, mutableByte.byteValue());
@@ -237,7 +237,7 @@ public class MutableByteTest {
@Test
public void testAddAndGetValueObject() {
final MutableByte mutableByte = new MutableByte((byte)0);
- byte result = mutableByte.addAndGet(Byte.valueOf((byte) 1));
+ final byte result = mutableByte.addAndGet(Byte.valueOf((byte) 1));
assertEquals((byte) 1, result);
assertEquals((byte) 1, mutableByte.byteValue());
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java
index 95dab5990..6ba4b7198 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java
@@ -157,7 +157,7 @@ public class MutableDoubleTest {
@Test
public void testIncrementAndGet() {
final MutableDouble mutNum = new MutableDouble(1d);
- double result = mutNum.incrementAndGet();
+ final double result = mutNum.incrementAndGet();
assertEquals(2d, result, 0.01d);
assertEquals(2, mutNum.intValue());
@@ -167,7 +167,7 @@ public class MutableDoubleTest {
@Test
public void testGetAndIncrement() {
final MutableDouble mutNum = new MutableDouble(1d);
- double result = mutNum.getAndIncrement();
+ final double result = mutNum.getAndIncrement();
assertEquals(1d, result, 0.01d);
assertEquals(2, mutNum.intValue());
@@ -186,7 +186,7 @@ public class MutableDoubleTest {
@Test
public void testDecrementAndGet() {
final MutableDouble mutNum = new MutableDouble(1d);
- double result = mutNum.decrementAndGet();
+ final double result = mutNum.decrementAndGet();
assertEquals(0d, result, 0.01d);
assertEquals(0, mutNum.intValue());
@@ -196,7 +196,7 @@ public class MutableDoubleTest {
@Test
public void testGetAndDecrement() {
final MutableDouble mutNum = new MutableDouble(1d);
- double result = mutNum.getAndDecrement();
+ final double result = mutNum.getAndDecrement();
assertEquals(1d, result, 0.01d);
assertEquals(0, mutNum.intValue());
@@ -222,7 +222,7 @@ public class MutableDoubleTest {
@Test
public void testGetAndAddValuePrimitive() {
final MutableDouble mutableDouble = new MutableDouble(0.5d);
- double result = mutableDouble.getAndAdd(1d);
+ final double result = mutableDouble.getAndAdd(1d);
assertEquals(0.5d, result, 0.01d);
assertEquals(1.5d, mutableDouble.doubleValue(), 0.01d);
@@ -231,7 +231,7 @@ public class MutableDoubleTest {
@Test
public void testGetAndAddValueObject() {
final MutableDouble mutableDouble = new MutableDouble(0.5d);
- double result = mutableDouble.getAndAdd(Double.valueOf(2d));
+ final double result = mutableDouble.getAndAdd(Double.valueOf(2d));
assertEquals(0.5d, result, 0.01d);
assertEquals(2.5d, mutableDouble.doubleValue(), 0.01d);
@@ -240,7 +240,7 @@ public class MutableDoubleTest {
@Test
public void testAddAndGetValuePrimitive() {
final MutableDouble mutableDouble = new MutableDouble(10.5d);
- double result = mutableDouble.addAndGet(-0.5d);
+ final double result = mutableDouble.addAndGet(-0.5d);
assertEquals(10d, result, 0.01d);
assertEquals(10d, mutableDouble.doubleValue(), 0.01d);
@@ -249,7 +249,7 @@ public class MutableDoubleTest {
@Test
public void testAddAndGetValueObject() {
final MutableDouble mutableDouble = new MutableDouble(7.5d);
- double result = mutableDouble.addAndGet(Double.valueOf(-2.5d));
+ final double result = mutableDouble.addAndGet(Double.valueOf(-2.5d));
assertEquals(5d, result, 0.01d);
assertEquals(5d, mutableDouble.doubleValue(), 0.01d);
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java
index f507cb457..ce8851a9b 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java
@@ -157,7 +157,7 @@ public class MutableFloatTest {
@Test
public void testIncrementAndGet() {
final MutableFloat mutNum = new MutableFloat(1f);
- float result = mutNum.incrementAndGet();
+ final float result = mutNum.incrementAndGet();
assertEquals(2f, result, 0.01f);
assertEquals(2, mutNum.intValue());
@@ -167,7 +167,7 @@ public class MutableFloatTest {
@Test
public void testGetAndIncrement() {
final MutableFloat mutNum = new MutableFloat(1f);
- float result = mutNum.getAndIncrement();
+ final float result = mutNum.getAndIncrement();
assertEquals(1f, result, 0.01f);
assertEquals(2, mutNum.intValue());
@@ -186,7 +186,7 @@ public class MutableFloatTest {
@Test
public void testDecrementAndGet() {
final MutableFloat mutNum = new MutableFloat(1f);
- float result = mutNum.decrementAndGet();
+ final float result = mutNum.decrementAndGet();
assertEquals(0f, result, 0.01f);
assertEquals(0, mutNum.intValue());
@@ -196,7 +196,7 @@ public class MutableFloatTest {
@Test
public void testGetAndDecrement() {
final MutableFloat mutNum = new MutableFloat(1f);
- float result = mutNum.getAndDecrement();
+ final float result = mutNum.getAndDecrement();
assertEquals(1f, result, 0.01f);
assertEquals(0, mutNum.intValue());
@@ -222,7 +222,7 @@ public class MutableFloatTest {
@Test
public void testGetAndAddValuePrimitive() {
final MutableFloat mutableFloat = new MutableFloat(1.25f);
- float result = mutableFloat.getAndAdd(0.75f);
+ final float result = mutableFloat.getAndAdd(0.75f);
assertEquals(1.25f, result, 0.01f);
assertEquals(2f, mutableFloat.floatValue(), 0.01f);
@@ -231,7 +231,7 @@ public class MutableFloatTest {
@Test
public void testGetAndAddValueObject() {
final MutableFloat mutableFloat = new MutableFloat(7.75f);
- float result = mutableFloat.getAndAdd(Float.valueOf(2.25f));
+ final float result = mutableFloat.getAndAdd(Float.valueOf(2.25f));
assertEquals(7.75f, result, 0.01f);
assertEquals(10f, mutableFloat.floatValue(), 0.01f);
@@ -240,7 +240,7 @@ public class MutableFloatTest {
@Test
public void testAddAndGetValuePrimitive() {
final MutableFloat mutableFloat = new MutableFloat(0.5f);
- float result = mutableFloat.addAndGet(1f);
+ final float result = mutableFloat.addAndGet(1f);
assertEquals(1.5f, result, 0.01f);
assertEquals(1.5f, mutableFloat.floatValue(), 0.01f);
@@ -249,7 +249,7 @@ public class MutableFloatTest {
@Test
public void testAddAndGetValueObject() {
final MutableFloat mutableFloat = new MutableFloat(5f);
- float result = mutableFloat.addAndGet(Float.valueOf(2.5f));
+ final float result = mutableFloat.addAndGet(Float.valueOf(2.5f));
assertEquals(7.5f, result, 0.01f);
assertEquals(7.5f, mutableFloat.floatValue(), 0.01f);
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java
index d21c7a3aa..53a6d28eb 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java
@@ -151,7 +151,7 @@ public class MutableIntTest {
@Test
public void testIncrementAndGet() {
final MutableInt mutNum = new MutableInt((int) 1);
- int result = mutNum.incrementAndGet();
+ final int result = mutNum.incrementAndGet();
assertEquals(2, result);
assertEquals(2, mutNum.intValue());
@@ -161,7 +161,7 @@ public class MutableIntTest {
@Test
public void testGetAndIncrement() {
final MutableInt mutNum = new MutableInt((int) 1);
- int result = mutNum.getAndIncrement();
+ final int result = mutNum.getAndIncrement();
assertEquals(1, result);
assertEquals(2, mutNum.intValue());
@@ -180,7 +180,7 @@ public class MutableIntTest {
@Test
public void testDecrementAndGet() {
final MutableInt mutNum = new MutableInt((int) 1);
- int result = mutNum.decrementAndGet();
+ final int result = mutNum.decrementAndGet();
assertEquals(0, result);
assertEquals(0, mutNum.intValue());
@@ -190,7 +190,7 @@ public class MutableIntTest {
@Test
public void testGetAndDecrement() {
final MutableInt mutNum = new MutableInt((int) 1);
- int result = mutNum.getAndDecrement();
+ final int result = mutNum.getAndDecrement();
assertEquals(1, result);
assertEquals(0, mutNum.intValue());
@@ -218,7 +218,7 @@ public class MutableIntTest {
@Test
public void testGetAndAddValuePrimitive() {
final MutableInt mutableInteger = new MutableInt((int)0);
- int result = mutableInteger.getAndAdd((int) 1);
+ final int result = mutableInteger.getAndAdd((int) 1);
assertEquals((int) 0, result);
assertEquals((int) 1, mutableInteger.intValue());
@@ -227,7 +227,7 @@ public class MutableIntTest {
@Test
public void testGetAndAddValueObject() {
final MutableInt mutableInteger = new MutableInt((int)0);
- int result = mutableInteger.getAndAdd(Integer.valueOf((int) 1));
+ final int result = mutableInteger.getAndAdd(Integer.valueOf((int) 1));
assertEquals((int) 0, result);
assertEquals((int) 1, mutableInteger.intValue());
@@ -236,7 +236,7 @@ public class MutableIntTest {
@Test
public void testAddAndGetValuePrimitive() {
final MutableInt mutableInteger = new MutableInt((int)0);
- int result = mutableInteger.addAndGet((int) 1);
+ final int result = mutableInteger.addAndGet((int) 1);
assertEquals((int) 1, result);
assertEquals((int) 1, mutableInteger.intValue());
@@ -245,7 +245,7 @@ public class MutableIntTest {
@Test
public void testAddAndGetValueObject() {
final MutableInt mutableInteger = new MutableInt((int)0);
- int result = mutableInteger.addAndGet(Integer.valueOf((int) 1));
+ final int result = mutableInteger.addAndGet(Integer.valueOf((int) 1));
assertEquals((int) 1, result);
assertEquals((int) 1, mutableInteger.intValue());
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java
index c2e66a2c7..fdf8bef49 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java
@@ -145,7 +145,7 @@ public class MutableLongTest {
@Test
public void testIncrementAndGet() {
final MutableLong mutNum = new MutableLong((long) 1);
- long result = mutNum.incrementAndGet();
+ final long result = mutNum.incrementAndGet();
assertEquals(2, result);
assertEquals(2, mutNum.intValue());
@@ -155,7 +155,7 @@ public class MutableLongTest {
@Test
public void testGetAndIncrement() {
final MutableLong mutNum = new MutableLong((long) 1);
- long result = mutNum.getAndIncrement();
+ final long result = mutNum.getAndIncrement();
assertEquals(1, result);
assertEquals(2, mutNum.intValue());
@@ -174,7 +174,7 @@ public class MutableLongTest {
@Test
public void testDecrementAndGet() {
final MutableLong mutNum = new MutableLong((long) 1);
- long result = mutNum.decrementAndGet();
+ final long result = mutNum.decrementAndGet();
assertEquals(0, result);
assertEquals(0, mutNum.intValue());
@@ -184,7 +184,7 @@ public class MutableLongTest {
@Test
public void testGetAndDecrement() {
final MutableLong mutNum = new MutableLong((long) 1);
- long result = mutNum.getAndDecrement();
+ final long result = mutNum.getAndDecrement();
assertEquals(1, result);
assertEquals(0, mutNum.intValue());
@@ -212,7 +212,7 @@ public class MutableLongTest {
@Test
public void testGetAndAddValuePrimitive() {
final MutableLong mutableLong = new MutableLong((long)0);
- long result = mutableLong.getAndAdd((long) 1);
+ final long result = mutableLong.getAndAdd((long) 1);
assertEquals((long) 0, result);
assertEquals((long) 1, mutableLong.longValue());
@@ -221,7 +221,7 @@ public class MutableLongTest {
@Test
public void testGetAndAddValueObject() {
final MutableLong mutableLong = new MutableLong((long)0);
- long result = mutableLong.getAndAdd(Long.valueOf((long) 1));
+ final long result = mutableLong.getAndAdd(Long.valueOf((long) 1));
assertEquals((long) 0, result);
assertEquals((long) 1, mutableLong.longValue());
@@ -230,7 +230,7 @@ public class MutableLongTest {
@Test
public void testAddAndGetValuePrimitive() {
final MutableLong mutableLong = new MutableLong((long)0);
- long result = mutableLong.addAndGet((long) 1);
+ final long result = mutableLong.addAndGet((long) 1);
assertEquals((long) 1, result);
assertEquals((long) 1, mutableLong.longValue());
@@ -239,7 +239,7 @@ public class MutableLongTest {
@Test
public void testAddAndGetValueObject() {
final MutableLong mutableLong = new MutableLong((long)0);
- long result = mutableLong.addAndGet(Long.valueOf((long) 1));
+ final long result = mutableLong.addAndGet(Long.valueOf((long) 1));
assertEquals((long) 1, result);
assertEquals((long) 1, mutableLong.longValue());
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java
index 5cd597d9f..14543bcdf 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java
@@ -140,7 +140,7 @@ public class MutableShortTest {
@Test
public void testIncrementAndGet() {
final MutableShort mutNum = new MutableShort((short) 1);
- short result = mutNum.incrementAndGet();
+ final short result = mutNum.incrementAndGet();
assertEquals(2, result);
assertEquals(2, mutNum.intValue());
@@ -150,7 +150,7 @@ public class MutableShortTest {
@Test
public void testGetAndIncrement() {
final MutableShort mutNum = new MutableShort((short) 1);
- short result = mutNum.getAndIncrement();
+ final short result = mutNum.getAndIncrement();
assertEquals(1, result);
assertEquals(2, mutNum.intValue());
@@ -169,7 +169,7 @@ public class MutableShortTest {
@Test
public void testDecrementAndGet() {
final MutableShort mutNum = new MutableShort((short) 1);
- short result = mutNum.decrementAndGet();
+ final short result = mutNum.decrementAndGet();
assertEquals(0, result);
assertEquals(0, mutNum.intValue());
@@ -179,7 +179,7 @@ public class MutableShortTest {
@Test
public void testGetAndDecrement() {
final MutableShort mutNum = new MutableShort((short) 1);
- short result = mutNum.getAndDecrement();
+ final short result = mutNum.getAndDecrement();
assertEquals(1, result);
assertEquals(0, mutNum.intValue());
@@ -205,7 +205,7 @@ public class MutableShortTest {
@Test
public void testGetAndAddValuePrimitive() {
final MutableShort mutableShort = new MutableShort((short)0);
- short result = mutableShort.getAndAdd((short) 1);
+ final short result = mutableShort.getAndAdd((short) 1);
assertEquals((short) 0, result);
assertEquals((short) 1, mutableShort.shortValue());
@@ -214,7 +214,7 @@ public class MutableShortTest {
@Test
public void testGetAndAddValueObject() {
final MutableShort mutableShort = new MutableShort((short)0);
- short result = mutableShort.getAndAdd(Short.valueOf((short) 1));
+ final short result = mutableShort.getAndAdd(Short.valueOf((short) 1));
assertEquals((short) 0, result);
assertEquals((short) 1, mutableShort.shortValue());
@@ -223,7 +223,7 @@ public class MutableShortTest {
@Test
public void testAddAndGetValuePrimitive() {
final MutableShort mutableShort = new MutableShort((short) 0);
- short result = mutableShort.addAndGet((short) 1);
+ final short result = mutableShort.addAndGet((short) 1);
assertEquals((short) 1, result);
assertEquals((short) 1, mutableShort.shortValue());
@@ -232,7 +232,7 @@ public class MutableShortTest {
@Test
public void testAddAndGetValueObject() {
final MutableShort mutableShort = new MutableShort((short) 0);
- short result = mutableShort.addAndGet(Short.valueOf((short) 1));
+ final short result = mutableShort.addAndGet(Short.valueOf((short) 1));
assertEquals((short) 1, result);
assertEquals((short) 1, mutableShort.shortValue());
diff --git a/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java
index c019cbea7..c14625d71 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java
@@ -284,7 +284,7 @@ public class ConstructorUtilsTest {
@Test
public void testVarArgsUnboxing() throws Exception {
- TestBean testBean = ConstructorUtils.invokeConstructor(
+ final TestBean testBean = ConstructorUtils.invokeConstructor(
TestBean.class, Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3));
assertArrayEquals(new String[]{"2", "3"}, testBean.varArgs);
diff --git a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
index a823325a6..0370a483f 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
@@ -655,7 +655,7 @@ public class MethodUtilsTest {
public void testGetMethodsWithAnnotation() throws NoSuchMethodException {
assertArrayEquals(new Method[0], MethodUtils.getMethodsWithAnnotation(Object.class, Annotated.class));
- Method[] methodsWithAnnotation = MethodUtils.getMethodsWithAnnotation(MethodUtilsTest.class, Annotated.class);
+ final Method[] methodsWithAnnotation = MethodUtils.getMethodsWithAnnotation(MethodUtilsTest.class, Annotated.class);
assertEquals(2, methodsWithAnnotation.length);
assertThat(methodsWithAnnotation, hasItemInArray(MethodUtilsTest.class.getMethod("testGetMethodsWithAnnotation")));
assertThat(methodsWithAnnotation, hasItemInArray(MethodUtilsTest.class.getMethod("testGetMethodsListWithAnnotation")));
@@ -756,8 +756,8 @@ public class MethodUtilsTest {
@Test
public void testVarArgsUnboxing() throws Exception {
- TestBean testBean = new TestBean();
- int[] actual = (int[])MethodUtils.invokeMethod(testBean, "unboxing", Integer.valueOf(1), Integer.valueOf(2));
+ final TestBean testBean = new TestBean();
+ final int[] actual = (int[])MethodUtils.invokeMethod(testBean, "unboxing", Integer.valueOf(1), Integer.valueOf(2));
Assert.assertArrayEquals(new int[]{1, 2}, actual);
}
@@ -776,7 +776,7 @@ public class MethodUtilsTest {
@Test
public void testDistance() throws Exception {
- Method distanceMethod = MethodUtils.getMatchingMethod(MethodUtils.class, "distance", Class[].class, Class[].class);
+ final Method distanceMethod = MethodUtils.getMatchingMethod(MethodUtils.class, "distance", Class[].class, Class[].class);
distanceMethod.setAccessible(true);
Assert.assertEquals(-1, distanceMethod.invoke(null, new Class[]{String.class}, new Class[]{Date.class}));
diff --git a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
index 323f0ddf3..b01bd0f45 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
@@ -766,8 +766,8 @@ public class TypeUtilsTest<B> {
@Test
public void testLANG1190() throws Exception {
- Type fromType = ClassWithSuperClassWithGenericType.class.getDeclaredMethod("methodWithGenericReturnType").getGenericReturnType();
- Type failingToType = TypeUtils.wildcardType().withLowerBounds(ClassWithSuperClassWithGenericType.class).build();
+ final Type fromType = ClassWithSuperClassWithGenericType.class.getDeclaredMethod("methodWithGenericReturnType").getGenericReturnType();
+ final Type failingToType = TypeUtils.wildcardType().withLowerBounds(ClassWithSuperClassWithGenericType.class).build();
Assert.assertTrue(TypeUtils.isAssignable(fromType, failingToType));
}
diff --git a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java
index 52fbe7e87..6a8429f8d 100644
--- a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java
+++ b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java
@@ -61,7 +61,7 @@ public class SystemDefaultsSwitch implements TestRule {
@Override
public Statement apply(final Statement stmt, final Description description) {
- SystemDefaults defaults = description.getAnnotation(SystemDefaults.class);
+ final SystemDefaults defaults = description.getAnnotation(SystemDefaults.class);
if (defaults == null) {
return stmt;
}
@@ -78,7 +78,7 @@ public class SystemDefaultsSwitch implements TestRule {
return new Statement() {
@Override
public void evaluate() throws Throwable {
- TimeZone save = TimeZone.getDefault();
+ final TimeZone save = TimeZone.getDefault();
try {
TimeZone.setDefault(newTimeZone);
stmt.evaluate();
@@ -99,7 +99,7 @@ public class SystemDefaultsSwitch implements TestRule {
return new Statement() {
@Override
public void evaluate() throws Throwable {
- Locale save = Locale.getDefault();
+ final Locale save = Locale.getDefault();
try {
Locale.setDefault(newLocale);
stmt.evaluate();
diff --git a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java
index 2d3c2f55e..d85d6abca 100644
--- a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java
+++ b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java
@@ -46,7 +46,7 @@ public class SystemDefaultsSwitchTest {
TEST_DEFAULT_LOCALE = Locale.getDefault();
DEFAULT_TIMEZONE_BEFORE_TEST = TimeZone.getDefault();
- TimeZone utc = TimeZone.getTimeZone("UTC");
+ final TimeZone utc = TimeZone.getTimeZone("UTC");
if (!DEFAULT_TIMEZONE_BEFORE_TEST.equals(utc)) {
TimeZone.setDefault(utc);
} else {
diff --git a/src/test/java/org/apache/commons/lang3/text/StrLookupTest.java b/src/test/java/org/apache/commons/lang3/text/StrLookupTest.java
index 737c1e12e..c89401d93 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrLookupTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrLookupTest.java
@@ -59,12 +59,12 @@ public class StrLookupTest {
*/
@Test
public void testSystemPropertiesLookupReplacedProperties() {
- Properties oldProperties = System.getProperties();
+ final Properties oldProperties = System.getProperties();
final String osName = "os.name";
final String newOsName = oldProperties.getProperty(osName) + "_changed";
- StrLookup<String> sysLookup = StrLookup.systemPropertiesLookup();
- Properties newProps = new Properties();
+ final StrLookup<String> sysLookup = StrLookup.systemPropertiesLookup();
+ final Properties newProps = new Properties();
newProps.setProperty(osName, newOsName);
System.setProperties(newProps);
try {
@@ -81,10 +81,10 @@ public class StrLookupTest {
@Test
public void testSystemPropertiesLookupUpdatedProperty() {
final String osName = "os.name";
- String oldOs = System.getProperty(osName);
+ final String oldOs = System.getProperty(osName);
final String newOsName = oldOs + "_changed";
- StrLookup<String> sysLookup = StrLookup.systemPropertiesLookup();
+ final StrLookup<String> sysLookup = StrLookup.systemPropertiesLookup();
System.setProperty(osName, newOsName);
try {
assertEquals("Changed properties not detected", newOsName, sysLookup.lookup(osName));
diff --git a/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java b/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
index 1623dea95..635483fd7 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
@@ -594,8 +594,8 @@ public class StrSubstitutorTest {
public void testLANG1055() {
System.setProperty("test_key", "test_value");
- String expected = StrSubstitutor.replace("test_key=${test_key}", System.getProperties());
- String actual = StrSubstitutor.replaceSystemProperties("test_key=${test_key}");
+ final String expected = StrSubstitutor.replace("test_key=${test_key}", System.getProperties());
+ final String actual = StrSubstitutor.replaceSystemProperties("test_key=${test_key}");
assertEquals(expected, actual);
}
@@ -629,7 +629,7 @@ public class StrSubstitutorTest {
final Map<String, String> map = new HashMap<>();
map.put("not-escaped", "value");
- StrSubstitutor sub = new StrSubstitutor(map, "${", "}", '$');
+ final StrSubstitutor sub = new StrSubstitutor(map, "${", "}", '$');
assertFalse(sub.isPreserveEscapes());
assertEquals("value ${escaped}", sub.replace(org));
diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
index d793c14db..2cd67403f 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
@@ -216,7 +216,7 @@ public class DateFormatUtilsTest {
@Test
public void testLANG1000() throws Exception {
- String date = "2013-11-18T12:48:05Z";
+ final String date = "2013-11-18T12:48:05Z";
DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(date);
}
@@ -239,35 +239,35 @@ public class DateFormatUtilsTest {
@Test
public void testLang916() throws Exception {
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris"));
+ final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris"));
cal.clear();
cal.set(2009, 9, 16, 8, 42, 16);
// Long.
{
- String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Europe/Paris"));
+ final String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Europe/Paris"));
assertEquals("long", "2009-10-16T08:42:16+02:00", value);
}
{
- String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Asia/Kolkata"));
+ final String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Asia/Kolkata"));
assertEquals("long", "2009-10-16T12:12:16+05:30", value);
}
{
- String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Europe/London"));
+ final String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Europe/London"));
assertEquals("long", "2009-10-16T07:42:16+01:00", value);
}
// Calendar.
{
- String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Europe/Paris"));
+ final String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Europe/Paris"));
assertEquals("calendar", "2009-10-16T08:42:16+02:00", value);
}
{
- String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Asia/Kolkata"));
+ final String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Asia/Kolkata"));
assertEquals("calendar", "2009-10-16T12:12:16+05:30", value);
}
{
- String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Europe/London"));
+ final String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone("Europe/London"));
assertEquals("calendar", "2009-10-16T07:42:16+01:00", value);
}
}
diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
index bb6e59f55..360bf5897 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
@@ -363,7 +363,7 @@ public class DateUtilsTest {
final String dateStr = "02 942, 1996";
final String[] parsers = new String[] {"MM DDD, yyyy"};
- Date date = DateUtils.parseDate(dateStr, parsers);
+ final Date date = DateUtils.parseDate(dateStr, parsers);
assertEquals(cal.getTime(), date);
try {
@@ -709,7 +709,7 @@ public class DateUtilsTest {
//-----------------------------------------------------------------------
@Test
public void testToCalendarWithDateAndTimeZoneNotNull() {
- Calendar c = DateUtils.toCalendar(date2, defaultZone);
+ final Calendar c = DateUtils.toCalendar(date2, defaultZone);
assertEquals("Convert Date and TimeZone to a Calendar, but failed to get the Date back", date2, c.getTime());
assertEquals("Convert Date and TimeZone to a Calendar, but failed to get the TimeZone back", defaultZone, c.getTimeZone());
}
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
index 0fb7dce77..3de6df86e 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
@@ -246,7 +246,7 @@ public class FastDateFormatTest {
};
final AtomicLongArray sdfTime= measureTime(sdf, sdf);
- Format fdf = FastDateFormat.getInstance(pattern);
+ final Format fdf = FastDateFormat.getInstance(pattern);
final AtomicLongArray fdfTime= measureTime(fdf, fdf);
System.out.println(">>FastDateFormatTest: FastDatePrinter:"+fdfTime.get(0)+" SimpleDateFormat:"+sdfTime.get(0));
@@ -311,8 +311,8 @@ public class FastDateFormatTest {
@Test
public void testLANG_1152() {
- TimeZone utc = TimeZone.getTimeZone("UTC");
- Date date = new Date(Long.MAX_VALUE);
+ final TimeZone utc = TimeZone.getTimeZone("UTC");
+ final Date date = new Date(Long.MAX_VALUE);
String dateAsString = FastDateFormat.getInstance("yyyy-MM-dd", utc, Locale.US).format(date);
Assert.assertEquals("292278994-08-17", dateAsString);
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
index bb30e2a79..43464ed6c 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
@@ -161,7 +161,7 @@ public class FastDateParserSDFTest {
// Error in test data
throw new RuntimeException("Test data error: expected SDF parse to fail, but got " + expectedTime);
}
- } catch (ParseException e) {
+ } catch (final ParseException e) {
if (valid) {
// Error in test data
throw new RuntimeException("Test data error: expected SDF parse to succeed, but got " + e);
@@ -176,7 +176,7 @@ public class FastDateParserSDFTest {
// failure in test
fail("Expected FDP parse to fail, but got " + actualTime);
}
- } catch (ParseException e) {
+ } catch (final ParseException e) {
if (valid) {
// failure in test
fail("Expected FDP parse to succeed, but got " + e);
@@ -194,8 +194,8 @@ public class FastDateParserSDFTest {
sdf.setTimeZone(timeZone);
final DateParser fdf = new FastDateParser(format, timeZone, locale);
- ParsePosition sdfP = new ParsePosition(0);
- Date expectedTime = sdf.parse(formattedDate, sdfP);
+ final ParsePosition sdfP = new ParsePosition(0);
+ final Date expectedTime = sdf.parse(formattedDate, sdfP);
final int sdferrorIndex = sdfP.getErrorIndex();
if (valid) {
assertEquals("Expected SDF error index -1 ", -1, sdferrorIndex);
@@ -213,7 +213,7 @@ public class FastDateParserSDFTest {
}
final ParsePosition fdfP = new ParsePosition(0);
- Date actualTime = fdf.parse(formattedDate, fdfP);
+ final Date actualTime = fdf.parse(formattedDate, fdfP);
final int fdferrorIndex = fdfP.getErrorIndex();
if (valid) {
assertEquals("Expected FDF error index -1 ", -1, fdferrorIndex);
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
index 1c374455b..c334f36fc 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
@@ -612,7 +612,7 @@ public class FastDateParserTest {
}
private static Calendar initializeCalendar(final TimeZone tz) {
- Calendar cal = Calendar.getInstance(tz);
+ final Calendar cal = Calendar.getInstance(tz);
cal.set(Calendar.YEAR, 2001);
cal.set(Calendar.MONTH, 1); // not daylight savings
cal.set(Calendar.DAY_OF_MONTH, 4);
@@ -645,13 +645,13 @@ public class FastDateParserTest {
@Test
public void test1806() throws ParseException {
- String formatStub = "yyyy-MM-dd'T'HH:mm:ss.SSS";
- String dateStub = "2001-02-04T12:08:56.235";
+ final String formatStub = "yyyy-MM-dd'T'HH:mm:ss.SSS";
+ final String dateStub = "2001-02-04T12:08:56.235";
- for (Expected1806 trial : Expected1806.values()) {
- Calendar cal = initializeCalendar(trial.zone);
+ for (final Expected1806 trial : Expected1806.values()) {
+ final Calendar cal = initializeCalendar(trial.zone);
- String message = trial.zone.getDisplayName()+";";
+ final String message = trial.zone.getDisplayName()+";";
DateParser parser = getInstance(formatStub+"X", trial.zone);
assertEquals(message+trial.one, cal.getTime().getTime(), parser.parse(dateStub+trial.one).getTime()-trial.offset);
@@ -666,13 +666,13 @@ public class FastDateParserTest {
@Test
public void testLang1121() throws ParseException {
- TimeZone kst = TimeZone.getTimeZone("KST");
+ final TimeZone kst = TimeZone.getTimeZone("KST");
final DateParser fdp = getInstance("yyyyMMdd", kst, Locale.KOREA);
try {
fdp.parse("2015");
Assert.fail("expected parse exception");
- } catch (ParseException pe) {
+ } catch (final ParseException pe) {
}
// Wed Apr 29 00:00:00 KST 2015
@@ -683,7 +683,7 @@ public class FastDateParserTest {
Date expected = cal.getTime();
Assert.assertEquals(expected, actual);
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd", Locale.KOREA);
+ final SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd", Locale.KOREA);
df.setTimeZone(kst);
expected = df.parse("20150429113100");
@@ -694,7 +694,7 @@ public class FastDateParserTest {
@Test
public void testParseOffset() throws ParseException {
- DateParser parser = getInstance(YMD_SLASH);
+ final DateParser parser = getInstance(YMD_SLASH);
final Date date = parser.parse("Today is 2015/07/04", new ParsePosition(9));
final Calendar cal = Calendar.getInstance();
@@ -706,7 +706,7 @@ public class FastDateParserTest {
@Test
public void testDayNumberOfWeek() throws ParseException {
final DateParser parser = getInstance("u");
- Calendar calendar = Calendar.getInstance();
+ final Calendar calendar = Calendar.getInstance();
calendar.setTime(parser.parse("1"));
Assert.assertEquals(Calendar.MONDAY, calendar.get(Calendar.DAY_OF_WEEK));
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParser_MoreOrLessTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParser_MoreOrLessTest.java
index 15b8817c5..2b7c414bf 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParser_MoreOrLessTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParser_MoreOrLessTest.java
@@ -32,9 +32,9 @@ public class FastDateParser_MoreOrLessTest {
@Test
public void testInputHasPrecedingCharacters() throws ParseException {
- FastDateParser parser = new FastDateParser("MM/dd", TimeZone.getDefault(), Locale.getDefault());
- ParsePosition parsePosition = new ParsePosition(0);
- Date date = parser.parse("A 3/23/61", parsePosition);
+ final FastDateParser parser = new FastDateParser("MM/dd", TimeZone.getDefault(), Locale.getDefault());
+ final ParsePosition parsePosition = new ParsePosition(0);
+ final Date date = parser.parse("A 3/23/61", parsePosition);
Assert.assertNull(date);
Assert.assertEquals(0, parsePosition.getIndex());
Assert.assertEquals(0, parsePosition.getErrorIndex());
@@ -42,13 +42,13 @@ public class FastDateParser_MoreOrLessTest {
@Test
public void testInputHasWhitespace() throws ParseException {
- FastDateParser parser = new FastDateParser("M/d/y", TimeZone.getDefault(), Locale.getDefault());
+ final FastDateParser parser = new FastDateParser("M/d/y", TimeZone.getDefault(), Locale.getDefault());
//SimpleDateFormat parser = new SimpleDateFormat("M/d/y");
- ParsePosition parsePosition = new ParsePosition(0);
- Date date = parser.parse(" 3/ 23/ 1961", parsePosition);
+ final ParsePosition parsePosition = new ParsePosition(0);
+ final Date date = parser.parse(" 3/ 23/ 1961", parsePosition);
Assert.assertEquals(12, parsePosition.getIndex());
- Calendar calendar = Calendar.getInstance();
+ final Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
Assert.assertEquals(1961, calendar.get(Calendar.YEAR));
Assert.assertEquals(2, calendar.get(Calendar.MONTH));
@@ -57,12 +57,12 @@ public class FastDateParser_MoreOrLessTest {
@Test
public void testInputHasMoreCharacters() throws ParseException {
- FastDateParser parser = new FastDateParser("MM/dd", TimeZone.getDefault(), Locale.getDefault());
- ParsePosition parsePosition = new ParsePosition(0);
- Date date = parser.parse("3/23/61", parsePosition);
+ final FastDateParser parser = new FastDateParser("MM/dd", TimeZone.getDefault(), Locale.getDefault());
+ final ParsePosition parsePosition = new ParsePosition(0);
+ final Date date = parser.parse("3/23/61", parsePosition);
Assert.assertEquals(4, parsePosition.getIndex());
- Calendar calendar = Calendar.getInstance();
+ final Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
Assert.assertEquals(2, calendar.get(Calendar.MONTH));
Assert.assertEquals(23, calendar.get(Calendar.DATE));
@@ -70,26 +70,26 @@ public class FastDateParser_MoreOrLessTest {
@Test
public void testInputHasWrongCharacters() {
- FastDateParser parser = new FastDateParser("MM-dd-yyy", TimeZone.getDefault(), Locale.getDefault());
- ParsePosition parsePosition = new ParsePosition(0);
+ final FastDateParser parser = new FastDateParser("MM-dd-yyy", TimeZone.getDefault(), Locale.getDefault());
+ final ParsePosition parsePosition = new ParsePosition(0);
Assert.assertNull(parser.parse("03/23/1961", parsePosition));
Assert.assertEquals(2, parsePosition.getErrorIndex());
}
@Test
public void testInputHasLessCharacters() {
- FastDateParser parser = new FastDateParser("MM/dd/yyy", TimeZone.getDefault(), Locale.getDefault());
- ParsePosition parsePosition = new ParsePosition(0);
+ final FastDateParser parser = new FastDateParser("MM/dd/yyy", TimeZone.getDefault(), Locale.getDefault());
+ final ParsePosition parsePosition = new ParsePosition(0);
Assert.assertNull(parser.parse("03/23", parsePosition));
Assert.assertEquals(5, parsePosition.getErrorIndex());
}
@Test
public void testInputHasWrongTimeZone() {
- FastDateParser parser = new FastDateParser("mm:ss z", NEW_YORK, Locale.US);
+ final FastDateParser parser = new FastDateParser("mm:ss z", NEW_YORK, Locale.US);
- String input = "11:23 Pacific Standard Time";
- ParsePosition parsePosition = new ParsePosition(0);
+ final String input = "11:23 Pacific Standard Time";
+ final ParsePosition parsePosition = new ParsePosition(0);
Assert.assertNotNull(parser.parse(input, parsePosition));
Assert.assertEquals(input.length(), parsePosition.getIndex());
@@ -100,9 +100,9 @@ public class FastDateParser_MoreOrLessTest {
@Test
public void testInputHasWrongDay() throws ParseException {
- FastDateParser parser = new FastDateParser("EEEE, MM/dd/yyy", NEW_YORK, Locale.US);
- String input = "Thursday, 03/23/61";
- ParsePosition parsePosition = new ParsePosition(0);
+ final FastDateParser parser = new FastDateParser("EEEE, MM/dd/yyy", NEW_YORK, Locale.US);
+ final String input = "Thursday, 03/23/61";
+ final ParsePosition parsePosition = new ParsePosition(0);
Assert.assertNotNull(parser.parse(input, parsePosition));
Assert.assertEquals(input.length(), parsePosition.getIndex());
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
index 2ed0c7f9b..ecb876b4c 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
@@ -41,7 +41,7 @@ public class FastDateParser_TimeZoneStrategyTest {
try {
parser.parse(tzDisplay);
}
- catch(Exception ex) {
+ catch(final Exception ex) {
Assert.fail("'" + tzDisplay + "'"
+ " Locale: '" + locale.getDisplayName() + "'"
+ " TimeZone: " + zone[0]
@@ -57,10 +57,10 @@ public class FastDateParser_TimeZoneStrategyTest {
@Test
public void testLang1219() throws ParseException {
- FastDateParser parser = new FastDateParser("dd.MM.yyyy HH:mm:ss z", TimeZone.getDefault(), Locale.GERMAN);
+ final FastDateParser parser = new FastDateParser("dd.MM.yyyy HH:mm:ss z", TimeZone.getDefault(), Locale.GERMAN);
- Date summer = parser.parse("26.10.2014 02:00:00 MESZ");
- Date standard = parser.parse("26.10.2014 02:00:00 MEZ");
+ final Date summer = parser.parse("26.10.2014 02:00:00 MESZ");
+ final Date standard = parser.parse("26.10.2014 02:00:00 MEZ");
Assert.assertNotEquals(summer.getTime(), standard.getTime());
}
}
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
index e862766d3..fa8836ef6 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
@@ -265,19 +265,19 @@ public class FastDatePrinterTest {
@SystemDefaults(timezone="UTC")
@Test
public void testTimeZoneAsZ() throws Exception {
- Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
- FastDateFormat noColonFormat = FastDateFormat.getInstance("Z");
+ final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+ final FastDateFormat noColonFormat = FastDateFormat.getInstance("Z");
assertEquals("+0000", noColonFormat.format(c));
- FastDateFormat isoFormat = FastDateFormat.getInstance("ZZ");
+ final FastDateFormat isoFormat = FastDateFormat.getInstance("ZZ");
assertEquals("Z", isoFormat.format(c));
- FastDateFormat colonFormat = FastDateFormat.getInstance("ZZZ");
+ final FastDateFormat colonFormat = FastDateFormat.getInstance("ZZZ");
assertEquals("+00:00", colonFormat.format(c));
}
private static Calendar initializeCalendar(final TimeZone tz) {
- Calendar cal = Calendar.getInstance(tz);
+ final Calendar cal = Calendar.getInstance(tz);
cal.set(Calendar.YEAR, 2001);
cal.set(Calendar.MONTH, 1); // not daylight savings
cal.set(Calendar.DAY_OF_MONTH, 4);
@@ -312,8 +312,8 @@ public class FastDatePrinterTest {
@Test
public void test1806() throws ParseException {
- for (Expected1806 trial : Expected1806.values()) {
- Calendar cal = initializeCalendar(trial.zone);
+ for (final Expected1806 trial : Expected1806.values()) {
+ final Calendar cal = initializeCalendar(trial.zone);
DatePrinter printer = getInstance("X", trial.zone);
assertEquals(trial.one, printer.format(cal));
@@ -328,7 +328,7 @@ public class FastDatePrinterTest {
@Test
public void testLang1103() throws ParseException {
- Calendar cal = Calendar.getInstance(SWEDEN);
+ final Calendar cal = Calendar.getInstance(SWEDEN);
cal.set(Calendar.DAY_OF_MONTH, 2);
assertEquals("2", getInstance("d", SWEDEN).format(cal));
@@ -347,30 +347,30 @@ public class FastDatePrinterTest {
@Test
public void testLang916() throws Exception {
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris"));
+ final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris"));
cal.clear();
cal.set(2009, 9, 16, 8, 42, 16);
// calendar fast.
{
- String value = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss Z", TimeZone.getTimeZone("Europe/Paris")).format(cal);
+ final String value = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss Z", TimeZone.getTimeZone("Europe/Paris")).format(cal);
assertEquals("calendar", "2009-10-16T08:42:16 +0200", value);
}
{
- String value = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss Z", TimeZone.getTimeZone("Asia/Kolkata")).format(cal);
+ final String value = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss Z", TimeZone.getTimeZone("Asia/Kolkata")).format(cal);
assertEquals("calendar", "2009-10-16T12:12:16 +0530", value);
}
{
- String value = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss Z", TimeZone.getTimeZone("Europe/London")).format(cal);
+ final String value = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss Z", TimeZone.getTimeZone("Europe/London")).format(cal);
assertEquals("calendar", "2009-10-16T07:42:16 +0100", value);
}
}
@Test
public void testHourFormats() {
- Calendar calendar = Calendar.getInstance();
+ final Calendar calendar = Calendar.getInstance();
calendar.clear();
- DatePrinter printer = getInstance("K k H h");
+ final DatePrinter printer = getInstance("K k H h");
calendar.set(Calendar.HOUR_OF_DAY, 0);
assertEquals("0 24 0 12", printer.format(calendar));
@@ -386,20 +386,20 @@ public class FastDatePrinterTest {
@Test
public void testStringBufferOptions() {
final DatePrinter format = getInstance("yyyy-MM-dd HH:mm:ss.SSS Z", TimeZone.getTimeZone("GMT"));
- Calendar calendar = Calendar.getInstance();
- StringBuffer sb = new StringBuffer();
- String expected = format.format(calendar, sb, new FieldPosition(0)).toString();
+ final Calendar calendar = Calendar.getInstance();
+ final StringBuffer sb = new StringBuffer();
+ final String expected = format.format(calendar, sb, new FieldPosition(0)).toString();
sb.setLength(0);
assertEquals(expected, format.format(calendar, sb).toString());
sb.setLength(0);
- Date date = calendar.getTime();
+ final Date date = calendar.getTime();
assertEquals(expected, format.format(date, sb, new FieldPosition(0)).toString());
sb.setLength(0);
assertEquals(expected, format.format(date, sb).toString());
sb.setLength(0);
- long epoch = date.getTime();
+ final long epoch = date.getTime();
assertEquals(expected, format.format(epoch, sb, new FieldPosition(0)).toString());
sb.setLength(0);
assertEquals(expected, format.format(epoch, sb).toString());
@@ -408,23 +408,23 @@ public class FastDatePrinterTest {
@Test
public void testAppendableOptions() {
final DatePrinter format = getInstance("yyyy-MM-dd HH:mm:ss.SSS Z", TimeZone.getTimeZone("GMT"));
- Calendar calendar = Calendar.getInstance();
- StringBuilder sb = new StringBuilder();
- String expected = format.format(calendar, sb).toString();
+ final Calendar calendar = Calendar.getInstance();
+ final StringBuilder sb = new StringBuilder();
+ final String expected = format.format(calendar, sb).toString();
sb.setLength(0);
- Date date = calendar.getTime();
+ final Date date = calendar.getTime();
assertEquals(expected, format.format(date, sb).toString());
sb.setLength(0);
- long epoch = date.getTime();
+ final long epoch = date.getTime();
assertEquals(expected, format.format(epoch, sb).toString());
}
@Test
public void testDayNumberOfWeek() {
final DatePrinter printer = getInstance("u");
- Calendar calendar = Calendar.getInstance();
+ final Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
assertEquals("1", printer.format(calendar.getTime()));
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java
index bac2556e6..78983718f 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java
@@ -37,8 +37,8 @@ public class FastDatePrinterTimeZonesTest {
@Parameterized.Parameters
public static Collection<TimeZone> data() {
final String[] zoneIds = TimeZone.getAvailableIDs();
- List<TimeZone> timeZones = new ArrayList<>();
- for (String zoneId : zoneIds) {
+ final List<TimeZone> timeZones = new ArrayList<>();
+ for (final String zoneId : zoneIds) {
timeZones.add(TimeZone.getTimeZone(zoneId));
}
return timeZones;
diff --git a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
index b7b4809da..eefe2b323 100644
--- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
@@ -295,7 +295,7 @@ public class StopWatchTest {
final long currentNanos = System.nanoTime();
FieldUtils.writeField(watch, "startTime", currentNanos - nanos, true);
FieldUtils.writeField(watch, "stopTime", currentNanos, true);
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
return null;
}
return watch;
diff --git a/src/test/java/org/apache/commons/lang3/time/WeekYearTest.java b/src/test/java/org/apache/commons/lang3/time/WeekYearTest.java
index de93208fd..ba7e3f770 100644
--- a/src/test/java/org/apache/commons/lang3/time/WeekYearTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/WeekYearTest.java
@@ -69,7 +69,7 @@ public class WeekYearTest {
public void testParser() throws ParseException {
final DateParser parser = new FastDateParser("YYYY-'W'ww-u", TimeZone.getDefault(), Locale.getDefault());
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.setMinimalDaysInFirstWeek(4);
cal.setFirstDayOfWeek(Calendar.MONDAY);
cal.clear();