commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1436770 [8/16] - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/ main/java/org/apache/commons/lang3/builder/ main/java/org/apache/commons/lang3/concurrent/ main/java/org/apache/commons/lang3/event/ main/java/org/apac...
Date Tue, 22 Jan 2013 07:09:49 GMT
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java Tue Jan 22 07:09:45 2013
@@ -44,7 +44,7 @@ public class StringEscapeUtilsTest {
     @Test
     public void testConstructor() {
         assertNotNull(new StringEscapeUtils());
-        Constructor<?>[] cons = StringEscapeUtils.class.getDeclaredConstructors();
+        final Constructor<?>[] cons = StringEscapeUtils.class.getDeclaredConstructors();
         assertEquals(1, cons.length);
         assertTrue(Modifier.isPublic(cons[0].getModifiers()));
         assertTrue(Modifier.isPublic(StringEscapeUtils.class.getModifiers()));
@@ -57,16 +57,16 @@ public class StringEscapeUtilsTest {
         try {
             StringEscapeUtils.ESCAPE_JAVA.translate(null, null);
             fail();
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
         }
         try {
             StringEscapeUtils.ESCAPE_JAVA.translate("", null);
             fail();
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
         }
         
         assertEscapeJava("empty string", "", "");
@@ -111,11 +111,11 @@ public class StringEscapeUtilsTest {
     }
 
     private void assertEscapeJava(String message, final String expected, final String original) throws IOException {
-        String converted = StringEscapeUtils.escapeJava(original);
+        final String converted = StringEscapeUtils.escapeJava(original);
         message = "escapeJava(String) failed" + (message == null ? "" : (": " + message));
         assertEquals(message, expected, converted);
 
-        StringWriter writer = new StringWriter();
+        final StringWriter writer = new StringWriter();
         StringEscapeUtils.ESCAPE_JAVA.translate(original, writer);
         assertEquals(expected, writer.toString());
     }
@@ -126,21 +126,21 @@ public class StringEscapeUtilsTest {
         try {
             StringEscapeUtils.UNESCAPE_JAVA.translate(null, null);
             fail();
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
         }
         try {
             StringEscapeUtils.UNESCAPE_JAVA.translate("", null);
             fail();
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
         }
         try {
             StringEscapeUtils.unescapeJava("\\u02-3");
             fail();
-        } catch (RuntimeException ex) {
+        } catch (final RuntimeException ex) {
         }
         
         assertUnescapeJava("", "");
@@ -160,8 +160,8 @@ public class StringEscapeUtilsTest {
     }
 
     private void assertUnescapeJava(final String message, final String unescaped, final String original) throws IOException {
-        String expected = unescaped;
-        String actual = StringEscapeUtils.unescapeJava(original);
+        final String expected = unescaped;
+        final String actual = StringEscapeUtils.unescapeJava(original);
 
         assertEquals("unescape(String) failed" +
                 (message == null ? "" : (": " + message)) +
@@ -170,7 +170,7 @@ public class StringEscapeUtilsTest {
                 "' actual '" + StringEscapeUtils.escapeJava(actual) + "'",
                 expected, actual);
 
-        StringWriter writer = new StringWriter();
+        final StringWriter writer = new StringWriter();
         StringEscapeUtils.UNESCAPE_JAVA.translate(original, writer);
         assertEquals(unescaped, writer.toString());
 
@@ -182,16 +182,16 @@ public class StringEscapeUtilsTest {
         try {
             StringEscapeUtils.ESCAPE_ECMASCRIPT.translate(null, null);
             fail();
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
         }
         try {
             StringEscapeUtils.ESCAPE_ECMASCRIPT.translate("", null);
             fail();
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             fail();
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
         }
         
         assertEquals("He didn\\'t say, \\\"stop!\\\"", StringEscapeUtils.escapeEcmaScript("He didn't say, \"stop!\""));
@@ -220,16 +220,16 @@ public class StringEscapeUtilsTest {
     @Test
     public void testEscapeHtml() {
         for (int i = 0; i < HTML_ESCAPES.length; ++i) {
-            String message = HTML_ESCAPES[i][0];
-            String expected = HTML_ESCAPES[i][1];
-            String original = HTML_ESCAPES[i][2];
+            final String message = HTML_ESCAPES[i][0];
+            final String expected = HTML_ESCAPES[i][1];
+            final String original = HTML_ESCAPES[i][2];
             assertEquals(message, expected, StringEscapeUtils.escapeHtml4(original));
-            StringWriter sw = new StringWriter();
+            final StringWriter sw = new StringWriter();
             try {
                 StringEscapeUtils.ESCAPE_HTML4.translate(original, sw);
-            } catch (IOException e) {
+            } catch (final IOException e) {
             }
-            String actual = original == null ? null : sw.toString();
+            final String actual = original == null ? null : sw.toString();
             assertEquals(message, expected, actual);
         }
     }
@@ -237,17 +237,17 @@ public class StringEscapeUtilsTest {
     @Test
     public void testUnescapeHtml4() {
         for (int i = 0; i < HTML_ESCAPES.length; ++i) {
-            String message = HTML_ESCAPES[i][0];
-            String expected = HTML_ESCAPES[i][2];
-            String original = HTML_ESCAPES[i][1];
+            final String message = HTML_ESCAPES[i][0];
+            final String expected = HTML_ESCAPES[i][2];
+            final String original = HTML_ESCAPES[i][1];
             assertEquals(message, expected, StringEscapeUtils.unescapeHtml4(original));
             
-            StringWriter sw = new StringWriter();
+            final StringWriter sw = new StringWriter();
             try {
                 StringEscapeUtils.UNESCAPE_HTML4.translate(original, sw);
-            } catch (IOException e) {
+            } catch (final IOException e) {
             }
-            String actual = original == null ? null : sw.toString();
+            final String actual = original == null ? null : sw.toString();
             assertEquals(message, expected, actual);
         }
         // \u00E7 is a cedilla (c with wiggle under)
@@ -268,11 +268,11 @@ public class StringEscapeUtilsTest {
         assertEquals("hex number unescape", "\u0080\u009F", StringEscapeUtils.unescapeHtml4("&#X80;&#X9F;"));
         // Test all Character values:
         for (char i = Character.MIN_VALUE; i < Character.MAX_VALUE; i++) {
-            Character c1 = new Character(i);
-            Character c2 = new Character((char)(i+1));
-            String expected = c1.toString() + c2.toString();
-            String escapedC1 = "&#x" + Integer.toHexString((c1.charValue())) + ";";
-            String escapedC2 = "&#x" + Integer.toHexString((c2.charValue())) + ";";
+            final Character c1 = new Character(i);
+            final Character c2 = new Character((char)(i+1));
+            final String expected = c1.toString() + c2.toString();
+            final String escapedC1 = "&#x" + Integer.toHexString((c1.charValue())) + ";";
+            final String escapedC2 = "&#x" + Integer.toHexString((c2.charValue())) + ";";
             assertEquals("hex number unescape index " + (int)i, expected, StringEscapeUtils.unescapeHtml4(escapedC1 + escapedC2));
         }
     }
@@ -315,14 +315,14 @@ public class StringEscapeUtilsTest {
         StringWriter sw = new StringWriter();
         try {
             StringEscapeUtils.ESCAPE_XML.translate("<abc>", sw);
-        } catch (IOException e) {
+        } catch (final IOException e) {
         }
         assertEquals("XML was escaped incorrectly", "&lt;abc&gt;", sw.toString() );
 
         sw = new StringWriter();
         try {
             StringEscapeUtils.UNESCAPE_XML.translate("&lt;abc&gt;", sw);
-        } catch (IOException e) {
+        } catch (final IOException e) {
         }
         assertEquals("XML was unescaped incorrectly", "<abc>", sw.toString() );
     }
@@ -343,7 +343,7 @@ public class StringEscapeUtilsTest {
      */
     @Test
     public void testEscapeXmlSupplementaryCharacters() {
-        CharSequenceTranslator escapeXml = 
+        final CharSequenceTranslator escapeXml = 
             StringEscapeUtils.ESCAPE_XML.with( NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );
 
         assertEquals("Supplementary character must be represented using a single escape", "&#144308;",
@@ -355,7 +355,7 @@ public class StringEscapeUtilsTest {
         // http://www.w3.org/TR/xml/#charsets says:
         // Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character,
         // excluding the surrogate blocks, FFFE, and FFFF. */
-        CharSequenceTranslator escapeXml = StringEscapeUtils.ESCAPE_XML
+        final CharSequenceTranslator escapeXml = StringEscapeUtils.ESCAPE_XML
                 .with(NumericEntityEscaper.below(9), NumericEntityEscaper.between(0xB, 0xC), NumericEntityEscaper.between(0xE, 0x19),
                         NumericEntityEscaper.between(0xD800, 0xDFFF), NumericEntityEscaper.between(0xFFFE, 0xFFFF), NumericEntityEscaper.above(0x110000));
 
@@ -418,10 +418,10 @@ public class StringEscapeUtilsTest {
 
     private void checkCsvEscapeWriter(final String expected, final String value) {
         try {
-            StringWriter writer = new StringWriter();
+            final StringWriter writer = new StringWriter();
             StringEscapeUtils.ESCAPE_CSV.translate(value, writer);
             assertEquals(expected, writer.toString());
-        } catch (IOException e) {
+        } catch (final IOException e) {
             fail("Threw: " + e);
         }
     }
@@ -454,10 +454,10 @@ public class StringEscapeUtilsTest {
 
     private void checkCsvUnescapeWriter(final String expected, final String value) {
         try {
-            StringWriter writer = new StringWriter();
+            final StringWriter writer = new StringWriter();
             StringEscapeUtils.UNESCAPE_CSV.translate(value, writer);
             assertEquals(expected, writer.toString());
-        } catch (IOException e) {
+        } catch (final IOException e) {
             fail("Threw: " + e);
         }
     }
@@ -473,14 +473,14 @@ public class StringEscapeUtilsTest {
         // COUNTING ROD UNIT DIGIT THREE
         // in Unicode
         // codepoint: U+1D362
-        byte[] data = new byte[] { (byte)0xF0, (byte)0x9D, (byte)0x8D, (byte)0xA2 };
+        final byte[] data = new byte[] { (byte)0xF0, (byte)0x9D, (byte)0x8D, (byte)0xA2 };
 
-        String original = new String(data, "UTF8");
+        final String original = new String(data, "UTF8");
 
-        String escaped = StringEscapeUtils.escapeHtml4( original );
+        final String escaped = StringEscapeUtils.escapeHtml4( original );
         assertEquals( "High Unicode should not have been escaped", original, escaped);
 
-        String unescaped = StringEscapeUtils.unescapeHtml4( escaped );
+        final String unescaped = StringEscapeUtils.unescapeHtml4( escaped );
         assertEquals( "High Unicode should have been unchanged", original, unescaped);
 
 // TODO: I think this should hold, needs further investigation
@@ -494,12 +494,12 @@ public class StringEscapeUtilsTest {
     @Test
     public void testEscapeHiragana() {
         // Some random Japanese Unicode characters
-        String original = "\u304B\u304C\u3068";
-        String escaped = StringEscapeUtils.escapeHtml4(original);
+        final String original = "\u304B\u304C\u3068";
+        final String escaped = StringEscapeUtils.escapeHtml4(original);
         assertEquals( "Hiragana character Unicode behaviour should not be being escaped by escapeHtml4",
         original, escaped);
 
-        String unescaped = StringEscapeUtils.unescapeHtml4( escaped );
+        final String unescaped = StringEscapeUtils.unescapeHtml4( escaped );
 
         assertEquals( "Hiragana character Unicode behaviour has changed - expected no unescaping", escaped, unescaped);
     }
@@ -512,8 +512,8 @@ public class StringEscapeUtilsTest {
      */
     @Test
     public void testLang708() throws IOException {
-        String input = IOUtils.toString(new FileInputStream("src/test/resources/lang-708-input.txt"), "UTF-8");
-        String escaped = StringEscapeUtils.escapeEcmaScript(input);
+        final String input = IOUtils.toString(new FileInputStream("src/test/resources/lang-708-input.txt"), "UTF-8");
+        final String escaped = StringEscapeUtils.escapeEcmaScript(input);
         // just the end:
         assertTrue(escaped, escaped.endsWith("}]"));
         // a little more:
@@ -525,8 +525,8 @@ public class StringEscapeUtilsTest {
      */
     @Test
     public void testLang720() {
-        String input = new StringBuilder("\ud842\udfb7").append("A").toString();
-        String escaped = StringEscapeUtils.escapeXml(input);
+        final String input = new StringBuilder("\ud842\udfb7").append("A").toString();
+        final String escaped = StringEscapeUtils.escapeXml(input);
         assertEquals(input, escaped);
     }
 }

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java Tue Jan 22 07:09:45 2013
@@ -216,11 +216,11 @@ public class StringUtilsEqualsIndexOfTes
 
     @Test
     public void testContainsIgnoreCase_LocaleIndependence() {
-        Locale orig = Locale.getDefault();
+        final Locale orig = Locale.getDefault();
 
-        Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() };
+        final Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() };
 
-        String[][] tdata = {
+        final String[][] tdata = {
             { "i", "I" },
             { "I", "i" },
             { "\u03C2", "\u03C3" },
@@ -228,12 +228,12 @@ public class StringUtilsEqualsIndexOfTes
             { "\u03A3", "\u03C3" },
         };
 
-        String[][] fdata = {
+        final String[][] fdata = {
             { "\u00DF", "SS" },
         };
 
         try {
-            for (Locale locale : locales) {
+            for (final Locale locale : locales) {
                 Locale.setDefault(locale);
                 for (int j = 0; j < tdata.length; j++) {
                     assertTrue(Locale.getDefault() + ": " + j + " " + tdata[j][0] + " " + tdata[j][1], StringUtils
@@ -286,13 +286,13 @@ public class StringUtilsEqualsIndexOfTes
 
     @Test
     public void testContainsNone_CharArray() {
-        String str1 = "a";
-        String str2 = "b";
-        String str3 = "ab.";
-        char[] chars1= {'b'};
-        char[] chars2= {'.'};
-        char[] chars3= {'c', 'd'};
-        char[] emptyChars = new char[0];
+        final String str1 = "a";
+        final String str2 = "b";
+        final String str3 = "ab.";
+        final char[] chars1= {'b'};
+        final char[] chars2= {'.'};
+        final char[] chars3= {'c', 'd'};
+        final char[] emptyChars = new char[0];
         assertTrue(StringUtils.containsNone(null, (char[]) null));
         assertTrue(StringUtils.containsNone("", (char[]) null));
         assertTrue(StringUtils.containsNone(null, emptyChars));
@@ -344,12 +344,12 @@ public class StringUtilsEqualsIndexOfTes
 
     @Test
     public void testContainsNone_String() {
-        String str1 = "a";
-        String str2 = "b";
-        String str3 = "ab.";
-        String chars1= "b";
-        String chars2= ".";
-        String chars3= "cd";
+        final String str1 = "a";
+        final String str2 = "b";
+        final String str3 = "ab.";
+        final String chars1= "b";
+        final String chars2= ".";
+        final String chars3= "cd";
         assertTrue(StringUtils.containsNone(null, (String) null));
         assertTrue(StringUtils.containsNone("", (String) null));
         assertTrue(StringUtils.containsNone(null, ""));
@@ -401,13 +401,13 @@ public class StringUtilsEqualsIndexOfTes
 
     @Test
     public void testContainsOnly_CharArray() {
-        String str1 = "a";
-        String str2 = "b";
-        String str3 = "ab";
-        char[] chars1= {'b'};
-        char[] chars2= {'a'};
-        char[] chars3= {'a', 'b'};
-        char[] emptyChars = new char[0];
+        final String str1 = "a";
+        final String str2 = "b";
+        final String str3 = "ab";
+        final char[] chars1= {'b'};
+        final char[] chars2= {'a'};
+        final char[] chars3= {'a', 'b'};
+        final char[] emptyChars = new char[0];
         assertFalse(StringUtils.containsOnly(null, (char[]) null));
         assertFalse(StringUtils.containsOnly("", (char[]) null));
         assertFalse(StringUtils.containsOnly(null, emptyChars));
@@ -427,12 +427,12 @@ public class StringUtilsEqualsIndexOfTes
 
     @Test
     public void testContainsOnly_String() {
-        String str1 = "a";
-        String str2 = "b";
-        String str3 = "ab";
-        String chars1= "b";
-        String chars2= "a";
-        String chars3= "ab";
+        final String str1 = "a";
+        final String str2 = "b";
+        final String str3 = "ab";
+        final String chars1= "b";
+        final String chars2= "a";
+        final String chars3= "ab";
         assertFalse(StringUtils.containsOnly(null, (String) null));
         assertFalse(StringUtils.containsOnly("", (String) null));
         assertFalse(StringUtils.containsOnly(null, ""));
@@ -492,7 +492,7 @@ public class StringUtilsEqualsIndexOfTes
             if (obj == null || !(obj instanceof CustomCharSequence)) {
                 return false;
             }
-            CustomCharSequence other = (CustomCharSequence) obj;
+            final CustomCharSequence other = (CustomCharSequence) obj;
             return seq.equals(other.seq);
         }
 

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java Tue Jan 22 07:09:45 2013
@@ -111,7 +111,7 @@ public class StringUtilsTest {
     @Test
     public void testConstructor() {
         assertNotNull(new StringUtils());
-        Constructor<?>[] cons = StringUtils.class.getDeclaredConstructors();
+        final Constructor<?>[] cons = StringUtils.class.getDeclaredConstructors();
         assertEquals(1, cons.length);
         assertTrue(Modifier.isPublic(cons[0].getModifiers()));
         assertTrue(Modifier.isPublic(StringUtils.class.getModifiers()));
@@ -184,8 +184,8 @@ public class StringUtilsTest {
         assertEquals("I AM here 123", StringUtils.swapCase("i am HERE 123") );
         assertEquals("i am here 123", StringUtils.swapCase("I AM HERE 123") );
         
-        String test = "This String contains a TitleCase character: \u01C8";
-        String expect = "tHIS sTRING CONTAINS A tITLEcASE CHARACTER: \u01C9";
+        final String test = "This String contains a TitleCase character: \u01C8";
+        final String expect = "tHIS sTRING CONTAINS A tITLEcASE CHARACTER: \u01C9";
         assertEquals(expect, WordUtils.swapCase(test));
     }
 
@@ -423,14 +423,14 @@ public class StringUtilsTest {
         }
         
         String[] results;
-        String[] expectedResults = {"ab", "de fg"};
+        final String[] expectedResults = {"ab", "de fg"};
         results = StringUtils.split("ab   de fg", null, 2);
         assertEquals(expectedResults.length, results.length);
         for (int i = 0; i < expectedResults.length; i++) {
             assertEquals(expectedResults[i], results[i]);
         }
         
-        String[] expectedResults2 = {"ab", "cd:ef"};
+        final String[] expectedResults2 = {"ab", "cd:ef"};
         results = StringUtils.split("ab:cd:ef",":", 2);
         assertEquals(expectedResults2.length, results.length);
         for (int i = 0; i < expectedResults2.length; i++) {
@@ -439,7 +439,7 @@ public class StringUtilsTest {
     }
     
     private void innerTestSplit(final char separator, final String sepStr, final char noMatch) {
-        String msg = "Failed on separator hex(" + Integer.toHexString(separator) +
+        final String msg = "Failed on separator hex(" + Integer.toHexString(separator) +
             "), noMatch hex(" + Integer.toHexString(noMatch) + "), sepStr(" + sepStr + ")";
         
         final String str = "a" + separator + "b" + separator + separator + noMatch + "c";
@@ -484,26 +484,26 @@ public class StringUtilsTest {
 
         assertEquals( 0, StringUtils.splitByWholeSeparator( "", "." ).length ) ;
 
-        String stringToSplitOnNulls = "ab   de fg" ;
-        String[] splitOnNullExpectedResults = { "ab", "de", "fg" } ;
+        final String stringToSplitOnNulls = "ab   de fg" ;
+        final String[] splitOnNullExpectedResults = { "ab", "de", "fg" } ;
 
-        String[] splitOnNullResults = StringUtils.splitByWholeSeparator( stringToSplitOnNulls, null ) ;
+        final String[] splitOnNullResults = StringUtils.splitByWholeSeparator( stringToSplitOnNulls, null ) ;
         assertEquals( splitOnNullExpectedResults.length, splitOnNullResults.length ) ;
         for ( int i = 0 ; i < splitOnNullExpectedResults.length ; i+= 1 ) {
             assertEquals( splitOnNullExpectedResults[i], splitOnNullResults[i] ) ;
         }
 
-        String stringToSplitOnCharactersAndString = "abstemiouslyaeiouyabstemiously" ;
+        final String stringToSplitOnCharactersAndString = "abstemiouslyaeiouyabstemiously" ;
 
-        String[] splitOnStringExpectedResults = { "abstemiously", "abstemiously" } ;
-        String[] splitOnStringResults = StringUtils.splitByWholeSeparator( stringToSplitOnCharactersAndString, "aeiouy" ) ;
+        final String[] splitOnStringExpectedResults = { "abstemiously", "abstemiously" } ;
+        final String[] splitOnStringResults = StringUtils.splitByWholeSeparator( stringToSplitOnCharactersAndString, "aeiouy" ) ;
         assertEquals( splitOnStringExpectedResults.length, splitOnStringResults.length ) ;
         for ( int i = 0 ; i < splitOnStringExpectedResults.length ; i+= 1 ) {
             assertEquals( splitOnStringExpectedResults[i], splitOnStringResults[i] ) ;
         }
 
-        String[] splitWithMultipleSeparatorExpectedResults = {"ab", "cd", "ef"};
-        String[] splitWithMultipleSeparator = StringUtils.splitByWholeSeparator("ab:cd::ef", ":");
+        final String[] splitWithMultipleSeparatorExpectedResults = {"ab", "cd", "ef"};
+        final String[] splitWithMultipleSeparator = StringUtils.splitByWholeSeparator("ab:cd::ef", ":");
         assertEquals( splitWithMultipleSeparatorExpectedResults.length, splitWithMultipleSeparator.length );
         for( int i = 0; i < splitWithMultipleSeparatorExpectedResults.length ; i++ ) {
             assertEquals( splitWithMultipleSeparatorExpectedResults[i], splitWithMultipleSeparator[i] ) ;
@@ -516,21 +516,21 @@ public class StringUtilsTest {
 
         assertEquals( 0, StringUtils.splitByWholeSeparator( "", ".", 3 ).length ) ;
 
-        String stringToSplitOnNulls = "ab   de fg" ;
-        String[] splitOnNullExpectedResults = { "ab", "de fg" } ;
+        final String stringToSplitOnNulls = "ab   de fg" ;
+        final String[] splitOnNullExpectedResults = { "ab", "de fg" } ;
         //String[] splitOnNullExpectedResults = { "ab", "de" } ;
 
-        String[] splitOnNullResults = StringUtils.splitByWholeSeparator( stringToSplitOnNulls, null, 2 ) ;
+        final String[] splitOnNullResults = StringUtils.splitByWholeSeparator( stringToSplitOnNulls, null, 2 ) ;
         assertEquals( splitOnNullExpectedResults.length, splitOnNullResults.length ) ;
         for ( int i = 0 ; i < splitOnNullExpectedResults.length ; i+= 1 ) {
             assertEquals( splitOnNullExpectedResults[i], splitOnNullResults[i] ) ;
         }
 
-        String stringToSplitOnCharactersAndString = "abstemiouslyaeiouyabstemiouslyaeiouyabstemiously" ;
+        final String stringToSplitOnCharactersAndString = "abstemiouslyaeiouyabstemiouslyaeiouyabstemiously" ;
 
-        String[] splitOnStringExpectedResults = { "abstemiously", "abstemiouslyaeiouyabstemiously" } ;
+        final String[] splitOnStringExpectedResults = { "abstemiously", "abstemiouslyaeiouyabstemiously" } ;
         //String[] splitOnStringExpectedResults = { "abstemiously", "abstemiously" } ;
-        String[] splitOnStringResults = StringUtils.splitByWholeSeparator( stringToSplitOnCharactersAndString, "aeiouy", 2 ) ;
+        final String[] splitOnStringResults = StringUtils.splitByWholeSeparator( stringToSplitOnCharactersAndString, "aeiouy", 2 ) ;
         assertEquals( splitOnStringExpectedResults.length, splitOnStringResults.length ) ;
         for ( int i = 0 ; i < splitOnStringExpectedResults.length ; i++ ) {
             assertEquals( splitOnStringExpectedResults[i], splitOnStringResults[i] ) ;
@@ -763,7 +763,7 @@ public class StringUtilsTest {
         // Match example in javadoc
         {
           String[] results;
-          String[] expectedResults = {"a", "", "b", "c"};
+          final String[] expectedResults = {"a", "", "b", "c"};
           results = StringUtils.splitPreserveAllTokens("a..b.c",'.');
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -792,7 +792,7 @@ public class StringUtilsTest {
 
         {
           String[] results;
-          String[] expectedResults = {"ab", "de fg"};
+          final String[] expectedResults = {"ab", "de fg"};
           results = StringUtils.splitPreserveAllTokens("ab de fg", null, 2);
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -802,7 +802,7 @@ public class StringUtilsTest {
 
         {
           String[] results;
-          String[] expectedResults = {"ab", "  de fg"};
+          final String[] expectedResults = {"ab", "  de fg"};
           results = StringUtils.splitPreserveAllTokens("ab   de fg", null, 2);
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -812,7 +812,7 @@ public class StringUtilsTest {
         
         {
           String[] results;
-          String[] expectedResults = {"ab", "::de:fg"};
+          final String[] expectedResults = {"ab", "::de:fg"};
           results = StringUtils.splitPreserveAllTokens("ab:::de:fg", ":", 2);
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -822,7 +822,7 @@ public class StringUtilsTest {
         
         {
           String[] results;
-          String[] expectedResults = {"ab", "", " de fg"};
+          final String[] expectedResults = {"ab", "", " de fg"};
           results = StringUtils.splitPreserveAllTokens("ab   de fg", null, 3);
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -832,7 +832,7 @@ public class StringUtilsTest {
         
         {
           String[] results;
-          String[] expectedResults = {"ab", "", "", "de fg"};
+          final String[] expectedResults = {"ab", "", "", "de fg"};
           results = StringUtils.splitPreserveAllTokens("ab   de fg", null, 4);
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -841,7 +841,7 @@ public class StringUtilsTest {
         }
 
         {
-          String[] expectedResults = {"ab", "cd:ef"};
+          final String[] expectedResults = {"ab", "cd:ef"};
           String[] results;
           results = StringUtils.splitPreserveAllTokens("ab:cd:ef",":", 2);
           assertEquals(expectedResults.length, results.length);
@@ -852,7 +852,7 @@ public class StringUtilsTest {
 
         {
           String[] results;
-          String[] expectedResults = {"ab", ":cd:ef"};
+          final String[] expectedResults = {"ab", ":cd:ef"};
           results = StringUtils.splitPreserveAllTokens("ab::cd:ef",":", 2);
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -862,7 +862,7 @@ public class StringUtilsTest {
 
         {
           String[] results;
-          String[] expectedResults = {"ab", "", ":cd:ef"};
+          final String[] expectedResults = {"ab", "", ":cd:ef"};
           results = StringUtils.splitPreserveAllTokens("ab:::cd:ef",":", 3);
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -872,7 +872,7 @@ public class StringUtilsTest {
 
         {
           String[] results;
-          String[] expectedResults = {"ab", "", "", "cd:ef"};
+          final String[] expectedResults = {"ab", "", "", "cd:ef"};
           results = StringUtils.splitPreserveAllTokens("ab:::cd:ef",":", 4);
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -882,7 +882,7 @@ public class StringUtilsTest {
 
         {
           String[] results;
-          String[] expectedResults = {"", "ab", "", "", "cd:ef"};
+          final String[] expectedResults = {"", "ab", "", "", "cd:ef"};
           results = StringUtils.splitPreserveAllTokens(":ab:::cd:ef",":", 5);
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -892,7 +892,7 @@ public class StringUtilsTest {
         
         {
           String[] results;
-          String[] expectedResults = {"", "", "ab", "", "", "cd:ef"};
+          final String[] expectedResults = {"", "", "ab", "", "", "cd:ef"};
           results = StringUtils.splitPreserveAllTokens("::ab:::cd:ef",":", 6);
           assertEquals(expectedResults.length, results.length);
           for (int i = 0; i < expectedResults.length; i++) {
@@ -903,7 +903,7 @@ public class StringUtilsTest {
     }
     
     private void innerTestSplitPreserveAllTokens(final char separator, final String sepStr, final char noMatch) {
-        String msg = "Failed on separator hex(" + Integer.toHexString(separator) +
+        final String msg = "Failed on separator hex(" + Integer.toHexString(separator) +
             "), noMatch hex(" + Integer.toHexString(noMatch) + "), sepStr(" + sepStr + ")";
         
         final String str = "a" + separator + "b" + separator + separator + noMatch + "c";
@@ -1065,7 +1065,7 @@ public class StringUtilsTest {
         assertEquals("", StringUtils.replace("", "any", null, 2));
         assertEquals("", StringUtils.replace("", "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.replace(str, "x", "", -1));
         
         assertEquals("f", StringUtils.replace("oofoo", "o", "", -1));
@@ -1155,7 +1155,7 @@ public class StringUtilsTest {
         try {
             StringUtils.replaceEachRepeatedly("abcde", new String[]{"ab", "d"}, new String[]{"d", "ab"});
             fail("Should be a circular reference");
-        } catch (IllegalStateException e) {}
+        } catch (final IllegalStateException e) {}
 
         //JAVADOC TESTS END
     }
@@ -1250,7 +1250,7 @@ public class StringUtilsTest {
         assertEquals("aaa", StringUtils.repeat("a", 3));
         assertEquals("ababab", StringUtils.repeat("ab", 3));
         assertEquals("abcabcabc", StringUtils.repeat("abc", 3));
-        String str = StringUtils.repeat("a", 10000);  // bigger than pad limit
+        final String str = StringUtils.repeat("a", 10000);  // bigger than pad limit
         assertEquals(10000, str.length());
         assertTrue(StringUtils.containsOnly(str, new char[] {'a'}));
     }
@@ -1272,7 +1272,7 @@ public class StringUtilsTest {
     @Test
     public void testChop() {
 
-        String[][] chopCases = {
+        final String[][] chopCases = {
             { FOO_UNCAP + "\r\n", FOO_UNCAP } ,
             { FOO_UNCAP + "\n" , FOO_UNCAP } ,
             { FOO_UNCAP + "\r", FOO_UNCAP },
@@ -1286,9 +1286,9 @@ public class StringUtilsTest {
             { "", "" },
             { "a", "" },
         };
-        for (String[] chopCase : chopCases) {
-            String original = chopCase[0];
-            String expectedResult = chopCase[1];
+        for (final String[] chopCase : chopCases) {
+            final String original = chopCase[0];
+            final String expectedResult = chopCase[1];
             assertEquals("chop(String) failed",
                     expectedResult, StringUtils.chop(original));
         }
@@ -1298,7 +1298,7 @@ public class StringUtilsTest {
     @Test
     public void testChomp() {
 
-        String[][] chompCases = {
+        final String[][] chompCases = {
             { FOO_UNCAP + "\r\n", FOO_UNCAP },
             { FOO_UNCAP + "\n" , FOO_UNCAP },
             { FOO_UNCAP + "\r", FOO_UNCAP },
@@ -1316,9 +1316,9 @@ public class StringUtilsTest {
             { null, null },
             { FOO_UNCAP + "\n\r", FOO_UNCAP + "\n"}
         };
-        for (String[] chompCase : chompCases) {
-            String original = chompCase[0];
-            String expectedResult = chompCase[1];
+        for (final String[] chompCase : chompCases) {
+            final String original = chompCase[0];
+            final String expectedResult = chompCase[1];
             assertEquals("chomp(String) failed",
                     expectedResult, StringUtils.chomp(original));
         }
@@ -1371,7 +1371,7 @@ public class StringUtilsTest {
         assertEquals("abc", StringUtils.rightPad("abc", 2, ' '));
         assertEquals("abc", StringUtils.rightPad("abc", -1, ' '));
         assertEquals("abcxx", StringUtils.rightPad("abc", 5, 'x'));
-        String str = StringUtils.rightPad("aaa", 10000, 'a');  // bigger than pad length
+        final String str = StringUtils.rightPad("aaa", 10000, 'a');  // bigger than pad length
         assertEquals(10000, str.length());
         assertTrue(StringUtils.containsOnly(str, new char[] {'a'}));
     }
@@ -1407,7 +1407,7 @@ public class StringUtilsTest {
         assertEquals("xxabc", StringUtils.leftPad("abc", 5, 'x'));
         assertEquals("\uffff\uffffabc", StringUtils.leftPad("abc", 5, '\uffff'));
         assertEquals("abc", StringUtils.leftPad("abc", 2, ' '));
-        String str = StringUtils.leftPad("aaa", 10000, 'a');  // bigger than pad length
+        final String str = StringUtils.leftPad("aaa", 10000, 'a');  // bigger than pad length
         assertEquals(10000, str.length());
         assertTrue(StringUtils.containsOnly(str, new char[] {'a'}));
     }
@@ -1552,7 +1552,7 @@ public class StringUtilsTest {
         assertEquals("abc", StringUtils.defaultIfEmpty("abc", "NULL"));
         assertNull(StringUtils.defaultIfEmpty("", null));
         // Tests compatibility for the API return type
-        String s = StringUtils.defaultIfEmpty("abc", "NULL");
+        final String s = StringUtils.defaultIfEmpty("abc", "NULL");
         assertEquals("abc", s);
     }
 
@@ -1564,7 +1564,7 @@ public class StringUtilsTest {
         assertEquals("abc", StringUtils.defaultIfBlank("abc", "NULL"));
         assertNull(StringUtils.defaultIfBlank("", null));
         // Tests compatibility for the API return type
-        String s = StringUtils.defaultIfBlank("abc", "NULL");
+        final String s = StringUtils.defaultIfBlank("abc", "NULL");
         assertEquals("abc", s);
     }
 
@@ -1574,7 +1574,7 @@ public class StringUtilsTest {
         assertEquals("abc", StringUtils.defaultIfEmpty(new StringBuilder("abc"), new StringBuilder("NULL")).toString());
         assertNull(StringUtils.defaultIfEmpty(new StringBuilder(""), null));
         // Tests compatibility for the API return type
-        StringBuilder s = StringUtils.defaultIfEmpty(new StringBuilder("abc"), new StringBuilder("NULL"));
+        final StringBuilder s = StringUtils.defaultIfEmpty(new StringBuilder("abc"), new StringBuilder("NULL"));
         assertEquals("abc", s.toString());
     }
 
@@ -1585,7 +1585,7 @@ public class StringUtilsTest {
         assertEquals("abc", StringUtils.defaultIfBlank(new StringBuilder("abc"), new StringBuilder("NULL")).toString());
         assertNull(StringUtils.defaultIfBlank(new StringBuilder(""), null));
         // Tests compatibility for the API return type
-        StringBuilder s = StringUtils.defaultIfBlank(new StringBuilder("abc"), new StringBuilder("NULL"));
+        final StringBuilder s = StringUtils.defaultIfBlank(new StringBuilder("abc"), new StringBuilder("NULL"));
         assertEquals("abc", s.toString());
     }
 
@@ -1595,7 +1595,7 @@ public class StringUtilsTest {
         assertEquals("abc", StringUtils.defaultIfEmpty(new StringBuffer("abc"), new StringBuffer("NULL")).toString());
         assertNull(StringUtils.defaultIfEmpty(new StringBuffer(""), null));
         // Tests compatibility for the API return type
-        StringBuffer s = StringUtils.defaultIfEmpty(new StringBuffer("abc"), new StringBuffer("NULL"));
+        final StringBuffer s = StringUtils.defaultIfEmpty(new StringBuffer("abc"), new StringBuffer("NULL"));
         assertEquals("abc", s.toString());
     }
 
@@ -1606,7 +1606,7 @@ public class StringUtilsTest {
         assertEquals("abc", StringUtils.defaultIfBlank(new StringBuffer("abc"), new StringBuffer("NULL")).toString());
         assertNull(StringUtils.defaultIfBlank(new StringBuffer(""), null));
         // Tests compatibility for the API return type
-        StringBuffer s = StringUtils.defaultIfBlank(new StringBuffer("abc"), new StringBuffer("NULL"));
+        final StringBuffer s = StringUtils.defaultIfBlank(new StringBuffer("abc"), new StringBuffer("NULL"));
         assertEquals("abc", s.toString());
     }
 
@@ -1616,7 +1616,7 @@ public class StringUtilsTest {
         assertEquals("abc", StringUtils.defaultIfEmpty(CharBuffer.wrap("abc"), CharBuffer.wrap("NULL")).toString());
         assertNull(StringUtils.defaultIfEmpty(CharBuffer.wrap(""), null));
         // Tests compatibility for the API return type
-        CharBuffer s = StringUtils.defaultIfEmpty(CharBuffer.wrap("abc"), CharBuffer.wrap("NULL"));
+        final CharBuffer s = StringUtils.defaultIfEmpty(CharBuffer.wrap("abc"), CharBuffer.wrap("NULL"));
         assertEquals("abc", s.toString());
     }
 
@@ -1627,7 +1627,7 @@ public class StringUtilsTest {
         assertEquals("abc", StringUtils.defaultIfBlank(CharBuffer.wrap("abc"), CharBuffer.wrap("NULL")).toString());
         assertNull(StringUtils.defaultIfBlank(CharBuffer.wrap(""), null));
         // Tests compatibility for the API return type
-        CharBuffer s = StringUtils.defaultIfBlank(CharBuffer.wrap("abc"), CharBuffer.wrap("NULL"));
+        final CharBuffer s = StringUtils.defaultIfBlank(CharBuffer.wrap("abc"), CharBuffer.wrap("NULL"));
         assertEquals("abc", s.toString());
     }
 
@@ -1639,7 +1639,7 @@ public class StringUtilsTest {
         assertEquals("short", StringUtils.abbreviate("short", 10));
         assertEquals("Now is ...", StringUtils.abbreviate("Now is the time for all good men to come to the aid of their party.", 10));
 
-        String raspberry = "raspberry peach";
+        final String raspberry = "raspberry peach";
         assertEquals("raspberry p...", StringUtils.abbreviate(raspberry, 14));
         assertEquals("raspberry peach", StringUtils.abbreviate("raspberry peach", 15));
         assertEquals("raspberry peach", StringUtils.abbreviate("raspberry peach", 16));
@@ -1651,9 +1651,10 @@ public class StringUtilsTest {
         
         try {
             @SuppressWarnings("unused")
+            final
             String res = StringUtils.abbreviate("abc", 3);
             fail("StringUtils.abbreviate expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
                 // empty
         }              
     }
@@ -1666,21 +1667,23 @@ public class StringUtilsTest {
         
         try {
             @SuppressWarnings("unused")
+            final
             String res = StringUtils.abbreviate("abcdefghij", 0, 3);
             fail("StringUtils.abbreviate expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
                 // empty
         }      
         try {
             @SuppressWarnings("unused")
+            final
             String res = StringUtils.abbreviate("abcdefghij", 5, 6);
             fail("StringUtils.abbreviate expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
                 // empty
         }      
         
 
-        String raspberry = "raspberry peach";
+        final String raspberry = "raspberry peach";
         assertEquals("raspberry peach", StringUtils.abbreviate(raspberry, 11, 15));
 
         assertEquals(null, StringUtils.abbreviate(null, 7, 14));
@@ -1707,9 +1710,9 @@ public class StringUtilsTest {
     }
 
     private void assertAbbreviateWithOffset(final String expected, final int offset, final int maxWidth) {
-        String abcdefghijklmno = "abcdefghijklmno";
-        String message = "abbreviate(String,int,int) failed";
-        String actual = StringUtils.abbreviate(abcdefghijklmno, offset, maxWidth);
+        final String abcdefghijklmno = "abcdefghijklmno";
+        final String message = "abbreviate(String,int,int) failed";
+        final String actual = StringUtils.abbreviate(abcdefghijklmno, offset, maxWidth);
         if (offset >= 0 && offset < abcdefghijklmno.length()) {
             assertTrue(message + " -- should contain offset character",
                     actual.indexOf((char)('a'+offset)) != -1);
@@ -1736,7 +1739,7 @@ public class StringUtilsTest {
                 "end to see if the text is complete.", "...", 50) );
 
         // Test a much longer text :)
-        String longText = "Start text" + StringUtils.repeat("x", 10000) + "Close text";
+        final String longText = "Start text" + StringUtils.repeat("x", 10000) + "Close text";
         assertEquals( 
             "Start text->Close text",
             StringUtils.abbreviateMiddle( longText, "->", 22 ) );
@@ -1803,16 +1806,18 @@ public class StringUtilsTest {
         assertEquals(1, StringUtils.getLevenshteinDistance("hello", "hallo") );
         try {
             @SuppressWarnings("unused")
+            final
             int d = StringUtils.getLevenshteinDistance("a", null);
             fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             // empty
         }
         try {
             @SuppressWarnings("unused")
+            final
             int d = StringUtils.getLevenshteinDistance(null, "a");
             fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             // empty
         }
     }
@@ -1875,24 +1880,27 @@ public class StringUtilsTest {
         // exceptions
         try {
             @SuppressWarnings("unused")
+            final
             int d = StringUtils.getLevenshteinDistance("a", null, 0);
             fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             // empty
         }
         try {
             @SuppressWarnings("unused")
+            final
             int d = StringUtils.getLevenshteinDistance(null, "a", 0);
             fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             // empty
         }
 
         try {
             @SuppressWarnings("unused")
+            final
             int d = StringUtils.getLevenshteinDistance("a", "a", -1);
             fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             // empty
         }
     }
@@ -2139,21 +2147,21 @@ public class StringUtilsTest {
     // This test enforces that this is done.
     @Test
     public void testStringUtilsCharSequenceContract() {
-        Class<StringUtils> c = StringUtils.class;
-        Method[] methods = c.getMethods();
-        for (Method m : methods) {
+        final Class<StringUtils> c = StringUtils.class;
+        final Method[] methods = c.getMethods();
+        for (final Method m : methods) {
             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 
                 // don't actively test for that.
-                Class<?>[] params = m.getParameterTypes();
+                final Class<?>[] params = m.getParameterTypes();
                 if ( params.length > 0 && (params[0] == CharSequence.class || params[0] == CharSequence[].class)) {
                     fail("The method " + m + " appears to be mutable in spirit and therefore must not accept a CharSequence");
                 }
             } else {
                 // Assume this is immutable in spirit and ensure the first parameter is not String.
                 // As above, it may be something other than CharSequence.
-                Class<?>[] params = m.getParameterTypes();
+                final Class<?>[] params = m.getParameterTypes();
                 if ( params.length > 0 && (params[0] == String.class || params[0] == String[].class)) {
                     fail("The method " + m + " appears to be immutable in spirit and therefore must not accept a String");
                 }

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTrimEmptyTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTrimEmptyTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTrimEmptyTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTrimEmptyTest.java Tue Jan 22 07:09:45 2013
@@ -241,10 +241,10 @@ public class StringUtilsTrimEmptyTest  {
     @Test
     public void testStripAll() {
         // test stripAll method, merely an array version of the above strip
-        String[] empty = new String[0];
-        String[] fooSpace = new String[] { "  "+FOO+"  ", "  "+FOO, FOO+"  " };
-        String[] fooDots = new String[] { ".."+FOO+"..", ".."+FOO, FOO+".." };
-        String[] foo = new String[] { FOO, FOO, FOO };
+        final String[] empty = new String[0];
+        final String[] fooSpace = new String[] { "  "+FOO+"  ", "  "+FOO, FOO+"  " };
+        final String[] fooDots = new String[] { ".."+FOO+"..", ".."+FOO, FOO+".." };
+        final String[] foo = new String[] { FOO, FOO, FOO };
 
         assertNull(StringUtils.stripAll((String[]) null));
         // Additional varargs tests
@@ -261,10 +261,10 @@ public class StringUtilsTrimEmptyTest  {
 
     @Test
     public void testStripAccents() {
-        String cue = "\u00C7\u00FA\u00EA";
+        final String cue = "\u00C7\u00FA\u00EA";
         assertEquals( "Failed to strip accents from " + cue, "Cue", StringUtils.stripAccents(cue));
 
-        String lots = "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C7\u00C8\u00C9" + 
+        final String lots = "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C7\u00C8\u00C9" + 
                       "\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D1\u00D2\u00D3" + 
                       "\u00D4\u00D5\u00D6\u00D9\u00DA\u00DB\u00DC\u00DD";
         assertEquals( "Failed to strip accents from " + lots, 

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java Tue Jan 22 07:09:45 2013
@@ -42,7 +42,7 @@ public class SystemUtilsTest {
     @Test
     public void testConstructor() {
         assertNotNull(new SystemUtils());
-        Constructor<?>[] cons = SystemUtils.class.getDeclaredConstructors();
+        final Constructor<?>[] cons = SystemUtils.class.getDeclaredConstructors();
         assertEquals(1, cons.length);
         assertTrue(Modifier.isPublic(cons[0].getModifiers()));
         assertTrue(Modifier.isPublic(SystemUtils.class.getModifiers()));
@@ -54,7 +54,7 @@ public class SystemUtilsTest {
      */
     @Test
     public void testGetJavaHome() {
-        File dir = SystemUtils.getJavaHome();
+        final File dir = SystemUtils.getJavaHome();
         Assert.assertNotNull(dir);
         Assert.assertTrue(dir.exists());
     }
@@ -64,7 +64,7 @@ public class SystemUtilsTest {
      */
     @Test
     public void testGetJavaIoTmpDir() {
-        File dir = SystemUtils.getJavaIoTmpDir();
+        final File dir = SystemUtils.getJavaIoTmpDir();
         Assert.assertNotNull(dir);
         Assert.assertTrue(dir.exists());
     }
@@ -74,7 +74,7 @@ public class SystemUtilsTest {
      */
     @Test
     public void testGetUserDir() {
-        File dir = SystemUtils.getUserDir();
+        final File dir = SystemUtils.getUserDir();
         Assert.assertNotNull(dir);
         Assert.assertTrue(dir.exists());
     }
@@ -84,14 +84,14 @@ public class SystemUtilsTest {
      */
     @Test
     public void testGetUserHome() {
-        File dir = SystemUtils.getUserHome();
+        final File dir = SystemUtils.getUserHome();
         Assert.assertNotNull(dir);
         Assert.assertTrue(dir.exists());
     }
 
     @Test
     public void testIS_JAVA() {
-        String javaVersion = System.getProperty("java.version");
+        final String javaVersion = System.getProperty("java.version");
         if (javaVersion == null) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -155,7 +155,7 @@ public class SystemUtilsTest {
 
     @Test
     public void testIS_OS() {
-        String osName = System.getProperty("os.name");
+        final String osName = System.getProperty("os.name");
         if (osName == null) {
             assertFalse(SystemUtils.IS_OS_WINDOWS);
             assertFalse(SystemUtils.IS_OS_UNIX);
@@ -356,12 +356,12 @@ public class SystemUtilsTest {
 
     @Test
     public void testJavaAwtHeadless() {
-        boolean atLeastJava14 = SystemUtils.isJavaVersionAtLeast(JAVA_1_4);
-        String expectedStringValue = System.getProperty("java.awt.headless");
-        String expectedStringValueWithDefault = System.getProperty("java.awt.headless", "false");
+        final boolean atLeastJava14 = SystemUtils.isJavaVersionAtLeast(JAVA_1_4);
+        final String expectedStringValue = System.getProperty("java.awt.headless");
+        final String expectedStringValueWithDefault = System.getProperty("java.awt.headless", "false");
         assertNotNull(expectedStringValueWithDefault);
         if (atLeastJava14) {
-            boolean expectedValue = Boolean.valueOf(expectedStringValue).booleanValue();
+            final boolean expectedValue = Boolean.valueOf(expectedStringValue).booleanValue();
             if (expectedStringValue != null) {
                 assertEquals(expectedStringValue, SystemUtils.JAVA_AWT_HEADLESS);
             }

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java Tue Jan 22 07:09:45 2013
@@ -51,7 +51,7 @@ public class ValidateTest  {
         try {
             Validate.isTrue(false);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("The validated expression is false", ex.getMessage());
         }
     }
@@ -63,7 +63,7 @@ public class ValidateTest  {
         try {
             Validate.isTrue(false, "MSG");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("MSG", ex.getMessage());
         }
     }
@@ -75,7 +75,7 @@ public class ValidateTest  {
         try {
             Validate.isTrue(false, "MSG", 6);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("MSG", ex.getMessage());
         }
     }
@@ -87,7 +87,7 @@ public class ValidateTest  {
         try {
             Validate.isTrue(false, "MSG", 7);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("MSG", ex.getMessage());
         }
     }
@@ -99,7 +99,7 @@ public class ValidateTest  {
         try {
             Validate.isTrue(false, "MSG", 7.4d);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("MSG", ex.getMessage());
         }
     }
@@ -112,12 +112,12 @@ public class ValidateTest  {
         try {
             Validate.notNull(null);
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("The validated object is null", ex.getMessage());
         }
         
-        String str = "Hi";
-        String testStr = Validate.notNull(str);
+        final String str = "Hi";
+        final String testStr = Validate.notNull(str);
         assertSame(str, testStr);
     }
 
@@ -128,12 +128,12 @@ public class ValidateTest  {
         try {
             Validate.notNull(null, "MSG");
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         
-        String str = "Hi";
-        String testStr = Validate.notNull(str, "Message");
+        final String str = "Hi";
+        final String testStr = Validate.notNull(str, "Message");
         assertSame(str, testStr);
     }
 
@@ -145,18 +145,18 @@ public class ValidateTest  {
         try {
             Validate.notEmpty((Object[]) null);
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("The validated array is empty", ex.getMessage());
         }
         try {
             Validate.notEmpty(new Object[0]);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("The validated array is empty", ex.getMessage());
         }
         
-        String[] array = new String[] {"hi"};
-        String[] test = Validate.notEmpty(array);
+        final String[] array = new String[] {"hi"};
+        final String[] test = Validate.notEmpty(array);
         assertSame(array, test);
     }
 
@@ -167,18 +167,18 @@ public class ValidateTest  {
         try {
             Validate.notEmpty((Object[]) null, "MSG");
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         try {
             Validate.notEmpty(new Object[0], "MSG");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         
-        String[] array = new String[] {"hi"};
-        String[] test = Validate.notEmpty(array, "Message");
+        final String[] array = new String[] {"hi"};
+        final String[] test = Validate.notEmpty(array, "Message");
         assertSame(array, test);
     }
 
@@ -186,46 +186,46 @@ public class ValidateTest  {
     //-----------------------------------------------------------------------
     @Test
     public void testNotEmptyCollection1() {
-        Collection<Integer> coll = new ArrayList<Integer>();
+        final Collection<Integer> coll = new ArrayList<Integer>();
         try {
             Validate.notEmpty((Collection<?>) null);
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("The validated collection is empty", ex.getMessage());
         }
         try {
             Validate.notEmpty(coll);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("The validated collection is empty", ex.getMessage());
         }
         coll.add(Integer.valueOf(8));
         Validate.notEmpty(coll);
         
-        Collection<Integer> test = Validate.notEmpty(coll);
+        final Collection<Integer> test = Validate.notEmpty(coll);
         assertSame(coll, test);
     }
 
     //-----------------------------------------------------------------------
     @Test
     public void testNotEmptyCollection2() {
-        Collection<Integer> coll = new ArrayList<Integer>();
+        final Collection<Integer> coll = new ArrayList<Integer>();
         try {
             Validate.notEmpty((Collection<?>) null, "MSG");
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         try {
             Validate.notEmpty(coll, "MSG");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         coll.add(Integer.valueOf(8));
         Validate.notEmpty(coll, "MSG");
         
-        Collection<Integer> test = Validate.notEmpty(coll, "Message");
+        final Collection<Integer> test = Validate.notEmpty(coll, "Message");
         assertSame(coll, test);
     }
 
@@ -233,46 +233,46 @@ public class ValidateTest  {
     //-----------------------------------------------------------------------
     @Test
     public void testNotEmptyMap1() {
-        Map<String, Integer> map = new HashMap<String, Integer>();
+        final Map<String, Integer> map = new HashMap<String, Integer>();
         try {
             Validate.notEmpty((Map<?, ?>) null);
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("The validated map is empty", ex.getMessage());
         }
         try {
             Validate.notEmpty(map);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("The validated map is empty", ex.getMessage());
         }
         map.put("ll", Integer.valueOf(8));
         Validate.notEmpty(map);
         
-        Map<String, Integer> test = Validate.notEmpty(map);
+        final Map<String, Integer> test = Validate.notEmpty(map);
         assertSame(map, test);
     }
 
     //-----------------------------------------------------------------------
     @Test
     public void testNotEmptyMap2() {
-        Map<String, Integer> map = new HashMap<String, Integer>();
+        final Map<String, Integer> map = new HashMap<String, Integer>();
         try {
             Validate.notEmpty((Map<?, ?>) null, "MSG");
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         try {
             Validate.notEmpty(map, "MSG");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         map.put("ll", Integer.valueOf(8));
         Validate.notEmpty(map, "MSG");
         
-        Map<String, Integer> test = Validate.notEmpty(map, "Message");
+        final Map<String, Integer> test = Validate.notEmpty(map, "Message");
         assertSame(map, test);
     }
 
@@ -284,18 +284,18 @@ public class ValidateTest  {
         try {
             Validate.notEmpty((String) null);
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("The validated character sequence is empty", ex.getMessage());
         }
         try {
             Validate.notEmpty("");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("The validated character sequence is empty", ex.getMessage());
         }
         
-        String str = "Hi";
-        String testStr = Validate.notEmpty(str);
+        final String str = "Hi";
+        final String testStr = Validate.notEmpty(str);
         assertSame(str, testStr);
     }
 
@@ -306,18 +306,18 @@ public class ValidateTest  {
         try {
             Validate.notEmpty((String) null, "MSG");
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         try {
             Validate.notEmpty("", "MSG");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         
-        String str = "Hi";
-        String testStr = Validate.notEmpty(str, "Message");
+        final String str = "Hi";
+        final String testStr = Validate.notEmpty(str, "Message");
         assertSame(str, testStr);
     }
 
@@ -326,13 +326,13 @@ public class ValidateTest  {
     @Test
     public void testNotBlankNullStringShouldThrow() {
         //given
-        String string = null;
+        final String string = null;
 
         try {
             //when
             Validate.notBlank(string);
             fail("Expecting NullPointerException");
-        } catch (NullPointerException e) {
+        } catch (final NullPointerException e) {
             //then
             assertEquals("The validated character sequence is blank", e.getMessage());
         }
@@ -342,13 +342,13 @@ public class ValidateTest  {
     @Test
     public void testNotBlankMsgNullStringShouldThrow() {
         //given
-        String string = null;
+        final String string = null;
 
         try {
             //when
             Validate.notBlank(string, "Message");
             fail("Expecting NullPointerException");
-        } catch (NullPointerException e) {
+        } catch (final NullPointerException e) {
             //then
             assertEquals("Message", e.getMessage());
         }
@@ -358,13 +358,13 @@ public class ValidateTest  {
     @Test
     public void testNotBlankEmptyStringShouldThrow() {
         //given
-        String string = "";
+        final String string = "";
 
         try {
             //when
             Validate.notBlank(string);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             //then
             assertEquals("The validated character sequence is blank", e.getMessage());
         }
@@ -374,13 +374,13 @@ public class ValidateTest  {
     @Test
     public void testNotBlankBlankStringWithWhitespacesShouldThrow() {
         //given
-        String string = "   ";
+        final String string = "   ";
 
         try {
             //when
             Validate.notBlank(string);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             //then
             assertEquals("The validated character sequence is blank", e.getMessage());
         }
@@ -390,13 +390,13 @@ public class ValidateTest  {
     @Test
     public void testNotBlankBlankStringWithNewlinesShouldThrow() {
         //given
-        String string = " \n \t \r \n ";
+        final String string = " \n \t \r \n ";
 
         try {
             //when
             Validate.notBlank(string);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             //then
             assertEquals("The validated character sequence is blank", e.getMessage());
         }
@@ -406,13 +406,13 @@ public class ValidateTest  {
     @Test
     public void testNotBlankMsgBlankStringShouldThrow() {
         //given
-        String string = " \n \t \r \n ";
+        final String string = " \n \t \r \n ";
 
         try {
             //when
             Validate.notBlank(string, "Message");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             //then
             assertEquals("Message", e.getMessage());
         }
@@ -422,13 +422,13 @@ public class ValidateTest  {
     @Test
     public void testNotBlankMsgBlankStringWithWhitespacesShouldThrow() {
         //given
-        String string = "   ";
+        final String string = "   ";
 
         try {
             //when
             Validate.notBlank(string, "Message");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             //then
             assertEquals("Message", e.getMessage());
         }
@@ -438,13 +438,13 @@ public class ValidateTest  {
     @Test
     public void testNotBlankMsgEmptyStringShouldThrow() {
         //given
-        String string = "";
+        final String string = "";
 
         try {
             //when
             Validate.notBlank(string, "Message");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             //then
             assertEquals("Message", e.getMessage());
         }
@@ -454,7 +454,7 @@ public class ValidateTest  {
     @Test
     public void testNotBlankNotBlankStringShouldNotThrow() {
         //given
-        String string = "abc";
+        final String string = "abc";
 
         //when
         Validate.notBlank(string);
@@ -466,7 +466,7 @@ public class ValidateTest  {
     @Test
     public void testNotBlankNotBlankStringWithWhitespacesShouldNotThrow() {
         //given
-        String string = "  abc   ";
+        final String string = "  abc   ";
 
         //when
         Validate.notBlank(string);
@@ -478,7 +478,7 @@ public class ValidateTest  {
     @Test
     public void testNotBlankNotBlankStringWithNewlinesShouldNotThrow() {
         //given
-        String string = " \n \t abc \r \n ";
+        final String string = " \n \t abc \r \n ";
 
         //when
         Validate.notBlank(string);
@@ -490,7 +490,7 @@ public class ValidateTest  {
     @Test
     public void testNotBlankMsgNotBlankStringShouldNotThrow() {
         //given
-        String string = "abc";
+        final String string = "abc";
 
         //when
         Validate.notBlank(string, "Message");
@@ -502,7 +502,7 @@ public class ValidateTest  {
     @Test
     public void testNotBlankMsgNotBlankStringWithWhitespacesShouldNotThrow() {
         //given
-        String string = "  abc   ";
+        final String string = "  abc   ";
 
         //when
         Validate.notBlank(string, "Message");
@@ -514,7 +514,7 @@ public class ValidateTest  {
     @Test
     public void testNotBlankMsgNotBlankStringWithNewlinesShouldNotThrow() {
         //given
-        String string = " \n \t abc \r \n ";
+        final String string = " \n \t abc \r \n ";
 
         //when
         Validate.notBlank(string, "Message");
@@ -525,15 +525,15 @@ public class ValidateTest  {
     //-----------------------------------------------------------------------
     @Test
     public void testNotBlankReturnValues1() {
-        String str = "Hi";
-        String test = Validate.notBlank(str);
+        final String str = "Hi";
+        final String test = Validate.notBlank(str);
         assertSame(str, test);
     }
 
     @Test
     public void testNotBlankReturnValues2() {
-        String str = "Hi";
-        String test = Validate.notBlank(str, "Message");
+        final String str = "Hi";
+        final String test = Validate.notBlank(str, "Message");
         assertSame(str, test);
     }
 
@@ -546,19 +546,19 @@ public class ValidateTest  {
         try {
             Validate.noNullElements((Object[]) null);
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("The validated object is null", ex.getMessage());
         }
         array[1] = null;
         try {
             Validate.noNullElements(array);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("The validated array contains null element at index: 1", ex.getMessage());
         }
         
         array = new String[] {"a", "b"};
-        String[] test = Validate.noNullElements(array);
+        final String[] test = Validate.noNullElements(array);
         assertSame(array, test);
     }
 
@@ -570,19 +570,19 @@ public class ValidateTest  {
         try {
             Validate.noNullElements((Object[]) null, "MSG");
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("The validated object is null", ex.getMessage());
         }
         array[1] = null;
         try {
             Validate.noNullElements(array, "MSG");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         
         array = new String[] {"a", "b"};
-        String[] test = Validate.noNullElements(array, "Message");
+        final String[] test = Validate.noNullElements(array, "Message");
         assertSame(array, test);
     }
 
@@ -590,52 +590,52 @@ public class ValidateTest  {
     //-----------------------------------------------------------------------
     @Test
     public void testNoNullElementsCollection1() {
-        List<String> coll = new ArrayList<String>();
+        final List<String> coll = new ArrayList<String>();
         coll.add("a");
         coll.add("b");
         Validate.noNullElements(coll);
         try {
             Validate.noNullElements((Collection<?>) null);
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("The validated object is null", ex.getMessage());
         }
         coll.set(1, null);
         try {
             Validate.noNullElements(coll);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("The validated collection contains null element at index: 1", ex.getMessage());
         }
         
         coll.set(1, "b");
-        List<String> test = Validate.noNullElements(coll);
+        final List<String> test = Validate.noNullElements(coll);
         assertSame(coll, test);
     }
 
     //-----------------------------------------------------------------------
     @Test
     public void testNoNullElementsCollection2() {
-        List<String> coll = new ArrayList<String>();
+        final List<String> coll = new ArrayList<String>();
         coll.add("a");
         coll.add("b");
         Validate.noNullElements(coll, "MSG");
         try {
             Validate.noNullElements((Collection<?>) null, "MSG");
             fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             assertEquals("The validated object is null", ex.getMessage());
         }
         coll.set(1, null);
         try {
             Validate.noNullElements(coll, "MSG");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {
+        } catch (final IllegalArgumentException ex) {
             assertEquals("MSG", ex.getMessage());
         }
         
         coll.set(1, "b");
-        List<String> test = Validate.noNullElements(coll, "Message");
+        final List<String> test = Validate.noNullElements(coll, "Message");
         assertSame(coll, test);
     }
 
@@ -644,7 +644,7 @@ public class ValidateTest  {
     @Test
     public void testConstructor() {
         assertNotNull(new Validate());
-        Constructor<?>[] cons = Validate.class.getDeclaredConstructors();
+        final Constructor<?>[] cons = Validate.class.getDeclaredConstructors();
         assertEquals(1, cons.length);
         assertTrue(Modifier.isPublic(cons[0].getModifiers()));
         assertTrue(Modifier.isPublic(Validate.class.getModifiers()));
@@ -655,47 +655,47 @@ public class ValidateTest  {
     //-----------------------------------------------------------------------
     @Test
     public void testValidIndex_withMessage_array() {
-        Object[] array = new Object[2];
+        final Object[] array = new Object[2];
         Validate.validIndex(array, 0, "Broken: ");
         Validate.validIndex(array, 1, "Broken: ");
         try {
             Validate.validIndex(array, -1, "Broken: ");
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("Broken: ", ex.getMessage());
         }
         try {
             Validate.validIndex(array, 2, "Broken: ");
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("Broken: ", ex.getMessage());
         }
         
-        String[] strArray = new String[] {"Hi"};
-        String[] test = Validate.noNullElements(strArray, "Message");
+        final String[] strArray = new String[] {"Hi"};
+        final String[] test = Validate.noNullElements(strArray, "Message");
         assertSame(strArray, test);
     }
 
     @Test
     public void testValidIndex_array() {
-        Object[] array = new Object[2];
+        final Object[] array = new Object[2];
         Validate.validIndex(array, 0);
         Validate.validIndex(array, 1);
         try {
             Validate.validIndex(array, -1);
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("The validated array index is invalid: -1", ex.getMessage());
         }
         try {
             Validate.validIndex(array, 2);
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("The validated array index is invalid: 2", ex.getMessage());
         }
         
-        String[] strArray = new String[] {"Hi"};
-        String[] test = Validate.noNullElements(strArray);
+        final String[] strArray = new String[] {"Hi"};
+        final String[] test = Validate.noNullElements(strArray);
         assertSame(strArray, test);
     }
 
@@ -703,7 +703,7 @@ public class ValidateTest  {
     //-----------------------------------------------------------------------
     @Test
     public void testValidIndex_withMessage_collection() {
-        Collection<String> coll = new ArrayList<String>();
+        final Collection<String> coll = new ArrayList<String>();
         coll.add(null);
         coll.add(null);
         Validate.validIndex(coll, 0, "Broken: ");
@@ -711,24 +711,24 @@ public class ValidateTest  {
         try {
             Validate.validIndex(coll, -1, "Broken: ");
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("Broken: ", ex.getMessage());
         }
         try {
             Validate.validIndex(coll, 2, "Broken: ");
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("Broken: ", ex.getMessage());
         }
         
-        List<String> strColl = Arrays.asList(new String[] {"Hi"});
-        List<String> test = Validate.validIndex(strColl, 0, "Message");
+        final List<String> strColl = Arrays.asList(new String[] {"Hi"});
+        final List<String> test = Validate.validIndex(strColl, 0, "Message");
         assertSame(strColl, test);
     }
 
     @Test
     public void testValidIndex_collection() {
-        Collection<String> coll = new ArrayList<String>();
+        final Collection<String> coll = new ArrayList<String>();
         coll.add(null);
         coll.add(null);
         Validate.validIndex(coll, 0);
@@ -736,18 +736,18 @@ public class ValidateTest  {
         try {
             Validate.validIndex(coll, -1);
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("The validated collection index is invalid: -1", ex.getMessage());
         }
         try {
             Validate.validIndex(coll, 2);
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("The validated collection index is invalid: 2", ex.getMessage());
         }
         
-        List<String> strColl = Arrays.asList(new String[] {"Hi"});
-        List<String> test = Validate.validIndex(strColl, 0);
+        final List<String> strColl = Arrays.asList(new String[] {"Hi"});
+        final List<String> test = Validate.validIndex(strColl, 0);
         assertSame(strColl, test);
     }
 
@@ -755,61 +755,61 @@ public class ValidateTest  {
     //-----------------------------------------------------------------------
     @Test
     public void testValidIndex_withMessage_charSequence() {
-        CharSequence str = "Hi";
+        final CharSequence str = "Hi";
         Validate.validIndex(str, 0, "Broken: ");
         Validate.validIndex(str, 1, "Broken: ");
         try {
             Validate.validIndex(str, -1, "Broken: ");
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("Broken: ", ex.getMessage());
         }
         try {
             Validate.validIndex(str, 2, "Broken: ");
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("Broken: ", ex.getMessage());
         }
         
-        String input = "Hi";
-        String test = Validate.validIndex(input, 0, "Message");
+        final String input = "Hi";
+        final String test = Validate.validIndex(input, 0, "Message");
         assertSame(input, test);
     }
 
     @Test
     public void testValidIndex_charSequence() {
-        CharSequence str = "Hi";
+        final CharSequence str = "Hi";
         Validate.validIndex(str, 0);
         Validate.validIndex(str, 1);
         try {
             Validate.validIndex(str, -1);
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("The validated character sequence index is invalid: -1", ex.getMessage());
         }
         try {
             Validate.validIndex(str, 2);
             fail("Expecting IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
             assertEquals("The validated character sequence index is invalid: 2", ex.getMessage());
         }
         
-        String input = "Hi";
-        String test = Validate.validIndex(input, 0);
+        final String input = "Hi";
+        final String test = Validate.validIndex(input, 0);
         assertSame(input, test);
     }
     
     @Test
     public void testMatchesPattern()
     {
-        CharSequence str = "hi";
+        final CharSequence str = "hi";
         Validate.matchesPattern(str, "[a-z]*");
         try
         {
             Validate.matchesPattern(str, "[0-9]*");
             fail("Expecting IllegalArgumentException");
         }
-        catch (IllegalArgumentException e)
+        catch (final IllegalArgumentException e)
         {
             assertEquals("The string hi does not match the pattern [0-9]*", e.getMessage());
         }
@@ -818,14 +818,14 @@ public class ValidateTest  {
     @Test
     public void testMatchesPattern_withMessage()
     {
-        CharSequence str = "hi";
+        final CharSequence str = "hi";
         Validate.matchesPattern(str, "[a-z]*", "Does not match");
         try
         {
             Validate.matchesPattern(str, "[0-9]*", "Does not match");
             fail("Expecting IllegalArgumentException");
         }
-        catch (IllegalArgumentException e)
+        catch (final IllegalArgumentException e)
         {
             assertEquals("Does not match", e.getMessage());
         }
@@ -840,7 +840,7 @@ public class ValidateTest  {
         try {
             Validate.inclusiveBetween(0, 5, 6);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             assertEquals("The value 6 is not in the specified inclusive range of 0 to 5", e.getMessage());
         }
     }
@@ -854,7 +854,7 @@ public class ValidateTest  {
         try {
             Validate.inclusiveBetween(0, 5, 6, "Error");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             assertEquals("Error", e.getMessage());
         }
     }
@@ -867,13 +867,13 @@ public class ValidateTest  {
         try {
             Validate.exclusiveBetween(0, 5, 6);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             assertEquals("The value 6 is not in the specified exclusive range of 0 to 5", e.getMessage());
         }
         try {
             Validate.exclusiveBetween(0, 5, 5);
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             assertEquals("The value 5 is not in the specified exclusive range of 0 to 5", e.getMessage());
         }
     }
@@ -886,13 +886,13 @@ public class ValidateTest  {
         try {
             Validate.exclusiveBetween(0, 5, 6, "Error");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             assertEquals("Error", e.getMessage());
         }
         try {
             Validate.exclusiveBetween(0, 5, 5, "Error");
             fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             assertEquals("Error", e.getMessage());
         }
     }
@@ -908,7 +908,7 @@ public class ValidateTest  {
         try {
             Validate.isInstanceOf(List.class, "hi");
             fail("Expecting IllegalArgumentException");
-        } catch(IllegalArgumentException e) {
+        } catch(final IllegalArgumentException e) {
             assertEquals("Expected type: java.util.List, actual: java.lang.String", e.getMessage());
         }
     }
@@ -920,7 +920,7 @@ public class ValidateTest  {
         try {
             Validate.isInstanceOf(List.class, "hi", "Error");
             fail("Expecting IllegalArgumentException");
-        } catch(IllegalArgumentException e) {
+        } catch(final IllegalArgumentException e) {
             assertEquals("Error", e.getMessage());
         }
     }
@@ -936,7 +936,7 @@ public class ValidateTest  {
         try {
             Validate.isAssignableFrom(List.class, String.class);
             fail("Expecting IllegalArgumentException");
-        } catch(IllegalArgumentException e) {
+        } catch(final IllegalArgumentException e) {
             assertEquals("Cannot assign a java.lang.String to a java.util.List", e.getMessage());
         }
     }
@@ -948,7 +948,7 @@ public class ValidateTest  {
         try {
             Validate.isAssignableFrom(List.class, String.class, "Error");
             fail("Expecting IllegalArgumentException");
-        } catch(IllegalArgumentException e) {
+        } catch(final IllegalArgumentException e) {
             assertEquals("Error", e.getMessage());
         }
     }



Mime
View raw message