http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/StringUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java index 8f0e88e..3e12a9c 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)); }
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java ---------------------------------------------------------------------- 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 aa53fd1..d04b70f 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); } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java ---------------------------------------------------------------------- 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 8ce0a04..b28b89c 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)); } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java ---------------------------------------------------------------------- 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 404c9c5..682a6d2 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) { } } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java ---------------------------------------------------------------------- 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 4b9ebee..51dfff4 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; http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java ---------------------------------------------------------------------- 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 1a0f911..7537f3b 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()!"); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java ---------------------------------------------------------------------- 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 d8515e7..3c5dfe4 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); } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreakerTest.java ---------------------------------------------------------------------- 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 70f22cd..8be9fa6 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())); } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java ---------------------------------------------------------------------- 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 15be2f4..2724910 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 } } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java ---------------------------------------------------------------------- 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 0b2ce48..18dc8f4 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)); } } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java ---------------------------------------------------------------------- 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 4903730..b63ea0a 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()); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java ---------------------------------------------------------------------- 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 95dab59..6ba4b71 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); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java ---------------------------------------------------------------------- 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 f507cb4..ce8851a 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); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java ---------------------------------------------------------------------- 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 d21c7a3..53a6d28 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()); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java ---------------------------------------------------------------------- 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 c2e66a2..fdf8bef 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()); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java ---------------------------------------------------------------------- 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 5cd597d..14543bc 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()); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java ---------------------------------------------------------------------- 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 c019cbe..c14625d 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); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java ---------------------------------------------------------------------- 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 a823325..0370a48 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})); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java ---------------------------------------------------------------------- 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 323f0dd..b01bd0f 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)); } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java ---------------------------------------------------------------------- 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 52fbe7e..6a8429f 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(); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java ---------------------------------------------------------------------- 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 2d3c2f5..d85d6ab 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 { http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/text/StrLookupTest.java ---------------------------------------------------------------------- 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 737c1e1..c89401d 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)); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java ---------------------------------------------------------------------- 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 1623dea..635483f 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)); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java ---------------------------------------------------------------------- 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 d793c14..2cd6740 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); } } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java ---------------------------------------------------------------------- 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 bb6e59f..360bf58 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()); } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eb2b89ef/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java ---------------------------------------------------------------------- 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 0fb7dce..3de6df8 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);