commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1088463 - in /commons/proper/codec/trunk/src/test/org/apache/commons/codec: StringEncoderComparatorTest.java binary/HexTest.java
Date Mon, 04 Apr 2011 02:21:48 GMT
Author: ggregory
Date: Mon Apr  4 02:21:48 2011
New Revision: 1088463

URL: http://svn.apache.org/viewvc?rev=1088463&view=rev
Log:
Use Generics and Java 5 for loop.

Modified:
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/HexTest.java

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java?rev=1088463&r1=1088462&r2=1088463&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java
(original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java
Mon Apr  4 02:21:48 2011
@@ -53,20 +53,19 @@ public class StringEncoderComparatorTest
     
     @Test
     public void testComparatorWithDoubleMetaphone() throws Exception {
-        StringEncoderComparator sCompare =
-            new StringEncoderComparator( new DoubleMetaphone() );
-            
+        StringEncoderComparator sCompare = new StringEncoderComparator(new DoubleMetaphone());
+
         String[] testArray = { "Jordan", "Sosa", "Prior", "Pryor" };
-        List testList = Arrays.asList( testArray );        
-        
+        List<String> testList = Arrays.asList(testArray);
+
         String[] controlArray = { "Jordan", "Prior", "Pryor", "Sosa" };
 
-        Collections.sort( testList, sCompare);            
-        
+        Collections.sort(testList, sCompare);
+
         String[] resultArray = (String[]) testList.toArray(new String[0]);
-        
-        for( int i = 0; i < resultArray.length; i++) {
-            assertEquals( "Result Array not Equal to Control Array at index: " + i, controlArray[i],
resultArray[i] );
+
+        for (int i = 0; i < resultArray.length; i++) {
+            assertEquals("Result Array not Equal to Control Array at index: " + i, controlArray[i],
resultArray[i]);
         }
     }
 

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/HexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/HexTest.java?rev=1088463&r1=1088462&r2=1088463&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/HexTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/HexTest.java Mon Apr
 4 02:21:48 2011
@@ -25,10 +25,7 @@ import static org.junit.Assert.fail;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.Random;
-import java.util.Set;
-import java.util.SortedMap;
 
 import junit.framework.Assert;
 
@@ -126,13 +123,8 @@ public class HexTest {
 
     @Test
     public void testCustomCharset() throws UnsupportedEncodingException, DecoderException
{
-        SortedMap map = Charset.availableCharsets();
-        Set keys = map.keySet();
-        Iterator iterator = keys.iterator();
-        log("testCustomCharset: Checking " + keys.size() + " charsets...");
-        while (iterator.hasNext()) {
-            String name = (String) iterator.next();
-            testCustomCharset(name, "testCustomCharset");
+        for (String name : Charset.availableCharsets().keySet()) {
+            testCustomCharset(name, "testCustomCharset");            
         }
     }
 



Mime
View raw message