You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2013/11/07 22:03:26 UTC
svn commit: r1539819 -
/commons/proper/beanutils/branches/java5/src/test/java/org/apache/commons/beanutils/PropertyUtilsBenchCase.java
Author: oheger
Date: Thu Nov 7 21:03:26 2013
New Revision: 1539819
URL: http://svn.apache.org/r1539819
Log:
Fixed warnings in test class.
Modified:
commons/proper/beanutils/branches/java5/src/test/java/org/apache/commons/beanutils/PropertyUtilsBenchCase.java
Modified: commons/proper/beanutils/branches/java5/src/test/java/org/apache/commons/beanutils/PropertyUtilsBenchCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/branches/java5/src/test/java/org/apache/commons/beanutils/PropertyUtilsBenchCase.java?rev=1539819&r1=1539818&r2=1539819&view=diff
==============================================================================
--- commons/proper/beanutils/branches/java5/src/test/java/org/apache/commons/beanutils/PropertyUtilsBenchCase.java (original)
+++ commons/proper/beanutils/branches/java5/src/test/java/org/apache/commons/beanutils/PropertyUtilsBenchCase.java Thu Nov 7 21:03:26 2013
@@ -20,10 +20,10 @@ package org.apache.commons.beanutils;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
-import junit.framework.TestCase;
+
import junit.framework.Test;
+import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -63,7 +63,7 @@ public class PropertyUtilsBenchCase exte
// Input objects that have identical sets of properties and values.
private BenchBean inBean = null;
private DynaBean inDyna = null;
- private Map inMap = null;
+ private Map<String, Object> inMap = null;
// Output objects that have identical sets of properties.
private BenchBean outBean = null;
@@ -104,7 +104,7 @@ public class PropertyUtilsBenchCase exte
// Create input instances
inBean = new BenchBean();
- inMap = new HashMap();
+ inMap = new HashMap<String, Object>();
inMap.put("booleanProperty", new Boolean(inBean.getBooleanProperty()));
inMap.put("byteProperty", new Byte(inBean.getByteProperty()));
inMap.put("doubleProperty", new Double(inBean.getDoubleProperty()));
@@ -114,19 +114,16 @@ public class PropertyUtilsBenchCase exte
inMap.put("shortProperty", new Short(inBean.getShortProperty()));
inMap.put("stringProperty", inBean.getStringProperty());
inDyna = dynaClass.newInstance();
- Iterator inKeys = inMap.keySet().iterator();
- while (inKeys.hasNext()) {
- String inKey = (String) inKeys.next();
- inDyna.set(inKey, inMap.get(inKey));
+ for (Map.Entry<String, Object> e : inMap.entrySet()) {
+ inDyna.set(e.getKey(), e.getValue());
}
// Create output instances
outBean = new BenchBean();
outDyna = dynaClass.newInstance();
- Iterator outKeys = inMap.keySet().iterator();
- while (outKeys.hasNext()) {
- String outKey = (String) outKeys.next();
- outDyna.set(outKey, inMap.get(outKey));
+ inDyna = dynaClass.newInstance();
+ for (Map.Entry<String, Object> e : inMap.entrySet()) {
+ outDyna.set(e.getKey(), e.getValue());
}
// Set up PropertyUtilsBean instance we will use