Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaResultSetTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaResultSetTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaResultSetTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaResultSetTestCase.java Wed Oct 15 20:15:17 2014 @@ -67,7 +67,7 @@ public class DynaResultSetTestCase exten * * @param name Name of the test case */ - public DynaResultSetTestCase(String name) { + public DynaResultSetTestCase(final String name) { super(name); @@ -129,7 +129,7 @@ public class DynaResultSetTestCase exten try { dynaClass.getDynaProperty(null); fail("Did not throw IllegaArgumentException"); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { // Expected result } @@ -151,7 +151,7 @@ public class DynaResultSetTestCase exten public void testGetDynaProperties() { - DynaProperty dynaProps[] = dynaClass.getDynaProperties(); + final DynaProperty dynaProps[] = dynaClass.getDynaProperties(); assertNotNull("dynaProps exists", dynaProps); assertEquals("dynaProps length", columns.length, dynaProps.length); for (int i = 0; i < columns.length; i++) { @@ -167,9 +167,9 @@ public class DynaResultSetTestCase exten try { dynaClass.newInstance(); fail("Did not throw UnsupportedOperationException()"); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { // Expected result - } catch (Exception e) { + } catch (final Exception e) { fail("Threw exception " + e); } @@ -178,7 +178,7 @@ public class DynaResultSetTestCase exten public void testIteratorCount() { - Iterator<?> rows = dynaClass.iterator(); + final Iterator<?> rows = dynaClass.iterator(); assertNotNull("iterator exists", rows); int n = 0; while (rows.hasNext()) { @@ -196,22 +196,22 @@ public class DynaResultSetTestCase exten public void testIteratorResults() { // Grab the third row - Iterator<DynaBean> rows = dynaClass.iterator(); + final Iterator<DynaBean> rows = dynaClass.iterator(); rows.next(); rows.next(); - DynaBean row = (DynaBean) rows.next(); + final DynaBean row = (DynaBean) rows.next(); // Invalid argument test try { row.get("unknownProperty"); fail("Did not throw IllegalArgumentException"); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { // Expected result } // Verify property values - Object bigDecimalProperty = row.get("bigdecimalproperty"); + final Object bigDecimalProperty = row.get("bigdecimalproperty"); assertNotNull("bigDecimalProperty exists", bigDecimalProperty); assertTrue("bigDecimalProperty type", bigDecimalProperty instanceof BigDecimal); @@ -220,7 +220,7 @@ public class DynaResultSetTestCase exten ((BigDecimal) bigDecimalProperty).doubleValue(), 0.005); - Object intProperty = row.get("intproperty"); + final Object intProperty = row.get("intproperty"); assertNotNull("intProperty exists", intProperty); assertTrue("intProperty type", intProperty instanceof Integer); @@ -228,10 +228,10 @@ public class DynaResultSetTestCase exten 103, ((Integer) intProperty).intValue()); - Object nullProperty = row.get("nullproperty"); + final Object nullProperty = row.get("nullproperty"); assertNull("nullProperty null", nullProperty); - Object stringProperty = row.get("stringproperty"); + final Object stringProperty = row.get("stringproperty"); assertNotNull("stringProperty exists", stringProperty); assertTrue("stringProperty type", stringProperty instanceof String); @@ -250,27 +250,27 @@ public class DynaResultSetTestCase exten ResultSetDynaClass dynaClass = null; try { dynaClass = new ResultSetDynaClass(TestResultSet.createProxy(), false); - } catch (Exception e) { + } catch (final Exception e) { fail("Error creating ResultSetDynaClass: " + e); } // Grab the third row - Iterator<DynaBean> rows = dynaClass.iterator(); + final Iterator<DynaBean> rows = dynaClass.iterator(); rows.next(); rows.next(); - DynaBean row = (DynaBean) rows.next(); + final DynaBean row = (DynaBean) rows.next(); // Invalid argument test try { row.get("unknownProperty"); fail("Did not throw IllegalArgumentException"); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { // Expected result } // Verify property values - Object bigDecimalProperty = row.get("bigDecimalProperty"); + final Object bigDecimalProperty = row.get("bigDecimalProperty"); assertNotNull("bigDecimalProperty exists", bigDecimalProperty); assertTrue("bigDecimalProperty type", bigDecimalProperty instanceof BigDecimal); @@ -279,7 +279,7 @@ public class DynaResultSetTestCase exten ((BigDecimal) bigDecimalProperty).doubleValue(), 0.005); - Object intProperty = row.get("intProperty"); + final Object intProperty = row.get("intProperty"); assertNotNull("intProperty exists", intProperty); assertTrue("intProperty type", intProperty instanceof Integer); @@ -287,10 +287,10 @@ public class DynaResultSetTestCase exten 103, ((Integer) intProperty).intValue()); - Object nullProperty = row.get("nullProperty"); + final Object nullProperty = row.get("nullProperty"); assertNull("nullProperty null", nullProperty); - Object stringProperty = row.get("stringProperty"); + final Object stringProperty = row.get("stringProperty"); assertNotNull("stringProperty exists", stringProperty); assertTrue("stringProperty type", stringProperty instanceof String);
Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaRowSetTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaRowSetTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaRowSetTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaRowSetTestCase.java Wed Oct 15 20:15:17 2014 @@ -70,7 +70,7 @@ public class DynaRowSetTestCase extends * * @param name Name of the test case */ - public DynaRowSetTestCase(String name) { + public DynaRowSetTestCase(final String name) { super(name); @@ -132,7 +132,7 @@ public class DynaRowSetTestCase extends try { dynaClass.getDynaProperty(null); fail("Did not throw IllegaArgumentException"); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { // Expected result } @@ -154,7 +154,7 @@ public class DynaRowSetTestCase extends public void testGetDynaProperties() { - DynaProperty dynaProps[] = dynaClass.getDynaProperties(); + final DynaProperty dynaProps[] = dynaClass.getDynaProperties(); assertNotNull("dynaProps exists", dynaProps); assertEquals("dynaProps length", columns.length, dynaProps.length); for (int i = 0; i < columns.length; i++) { @@ -170,9 +170,9 @@ public class DynaRowSetTestCase extends try { dynaClass.newInstance(); fail("Did not throw UnsupportedOperationException()"); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { // Expected result - } catch (Exception e) { + } catch (final Exception e) { fail("Threw exception " + e); } @@ -181,7 +181,7 @@ public class DynaRowSetTestCase extends public void testListCount() { - List<DynaBean> rows = dynaClass.getRows(); + final List<DynaBean> rows = dynaClass.getRows(); assertNotNull("list exists", rows); assertEquals("list row count", 5, rows.size()); @@ -191,20 +191,20 @@ public class DynaRowSetTestCase extends public void testListResults() { // Grab the third row - List<DynaBean> rows = dynaClass.getRows(); - DynaBean row = rows.get(2); + final List<DynaBean> rows = dynaClass.getRows(); + final DynaBean row = rows.get(2); // Invalid argument test try { row.get("unknownProperty"); fail("Did not throw IllegalArgumentException"); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { // Expected result } // Verify property values - Object bigDecimalProperty = row.get("bigdecimalproperty"); + final Object bigDecimalProperty = row.get("bigdecimalproperty"); assertNotNull("bigDecimalProperty exists", bigDecimalProperty); assertTrue("bigDecimalProperty type", bigDecimalProperty instanceof BigDecimal); @@ -213,7 +213,7 @@ public class DynaRowSetTestCase extends ((BigDecimal) bigDecimalProperty).doubleValue(), 0.005); - Object intProperty = row.get("intproperty"); + final Object intProperty = row.get("intproperty"); assertNotNull("intProperty exists", intProperty); assertTrue("intProperty type", intProperty instanceof Integer); @@ -221,10 +221,10 @@ public class DynaRowSetTestCase extends 103, ((Integer) intProperty).intValue()); - Object nullProperty = row.get("nullproperty"); + final Object nullProperty = row.get("nullproperty"); assertNull("nullProperty null", nullProperty); - Object stringProperty = row.get("stringproperty"); + final Object stringProperty = row.get("stringproperty"); assertNotNull("stringProperty exists", stringProperty); assertTrue("stringProperty type", stringProperty instanceof String); @@ -242,25 +242,25 @@ public class DynaRowSetTestCase extends RowSetDynaClass dynaClass = null; try { dynaClass = new RowSetDynaClass(TestResultSet.createProxy(), false); - } catch (Exception e) { + } catch (final Exception e) { fail("Error creating RowSetDynaClass: " + e); } // Grab the third row - List<DynaBean> rows = dynaClass.getRows(); - DynaBean row = rows.get(2); + final List<DynaBean> rows = dynaClass.getRows(); + final DynaBean row = rows.get(2); // Invalid argument test try { row.get("unknownProperty"); fail("Did not throw IllegalArgumentException"); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { // Expected result } // Verify property values - Object bigDecimalProperty = row.get("bigDecimalProperty"); + final Object bigDecimalProperty = row.get("bigDecimalProperty"); assertNotNull("bigDecimalProperty exists", bigDecimalProperty); assertTrue("bigDecimalProperty type", bigDecimalProperty instanceof BigDecimal); @@ -269,7 +269,7 @@ public class DynaRowSetTestCase extends ((BigDecimal) bigDecimalProperty).doubleValue(), 0.005); - Object intProperty = row.get("intProperty"); + final Object intProperty = row.get("intProperty"); assertNotNull("intProperty exists", intProperty); assertTrue("intProperty type", intProperty instanceof Integer); @@ -277,10 +277,10 @@ public class DynaRowSetTestCase extends 103, ((Integer) intProperty).intValue()); - Object nullProperty = row.get("nullProperty"); + final Object nullProperty = row.get("nullProperty"); assertNull("nullProperty null", nullProperty); - Object stringProperty = row.get("stringProperty"); + final Object stringProperty = row.get("stringProperty"); assertNotNull("stringProperty exists", stringProperty); assertTrue("stringProperty type", stringProperty instanceof String); @@ -294,8 +294,8 @@ public class DynaRowSetTestCase extends public void testLimitedRows() throws Exception { // created one with low limit - RowSetDynaClass limitedDynaClass = new RowSetDynaClass(TestResultSet.createProxy(), 3); - List<DynaBean> rows = limitedDynaClass.getRows(); + final RowSetDynaClass limitedDynaClass = new RowSetDynaClass(TestResultSet.createProxy(), 3); + final List<DynaBean> rows = limitedDynaClass.getRows(); assertNotNull("list exists", rows); assertEquals("limited row count", 3, rows.size()); @@ -310,26 +310,26 @@ public class DynaRowSetTestCase extends */ public void testInconsistentOracleDriver() throws Exception { - ResultSetMetaData metaData = TestResultSetMetaData.createProxy(new TestResultSetMetaDataInconsistent()); - ResultSet resultSet = TestResultSet.createProxy(new TestResultSetInconsistent(metaData)); + final ResultSetMetaData metaData = TestResultSetMetaData.createProxy(new TestResultSetMetaDataInconsistent()); + final ResultSet resultSet = TestResultSet.createProxy(new TestResultSetInconsistent(metaData)); // Date Column returns "java.sql.Timestamp" for the column class name but ResultSet getObject // returns a java.sql.Date value - int dateColIdx = 4; + final int dateColIdx = 4; assertEquals("Date Meta Name", "dateProperty", metaData.getColumnName(dateColIdx)); assertEquals("Date Meta Class", "java.sql.Timestamp", metaData.getColumnClassName(dateColIdx)); assertEquals("Date Meta Type", java.sql.Types.DATE, metaData.getColumnType(dateColIdx)); assertEquals("Date ResultSet Value", java.sql.Date.class, resultSet.getObject("dateProperty").getClass()); // Timestamp column class returns a custom Timestamp impl for the column class name and ResultSet getObject - int timestampColIdx = 13; + final int timestampColIdx = 13; assertEquals("Timestamp Meta Name", "timestampProperty", metaData.getColumnName(timestampColIdx)); assertEquals("Timestamp Meta Class", CustomTimestamp.class.getName(), metaData.getColumnClassName(timestampColIdx)); assertEquals("Timestamp Meta Type", java.sql.Types.TIMESTAMP, metaData.getColumnType(timestampColIdx)); assertEquals("Timestamp ResultSet Value", CustomTimestamp.class, resultSet.getObject("timestampProperty").getClass()); - RowSetDynaClass inconsistentDynaClass = new RowSetDynaClass(resultSet); - DynaBean firstRow = inconsistentDynaClass.getRows().get(0); + final RowSetDynaClass inconsistentDynaClass = new RowSetDynaClass(resultSet); + final DynaBean firstRow = inconsistentDynaClass.getRows().get(0); Class<?> expectedType = null; DynaProperty property = null; @@ -353,7 +353,7 @@ public class DynaRowSetTestCase extends */ private static class TestResultSetInconsistent extends TestResultSet { - public TestResultSetInconsistent(ResultSetMetaData metaData) { + public TestResultSetInconsistent(final ResultSetMetaData metaData) { super(metaData); } /** @@ -363,7 +363,7 @@ public class DynaRowSetTestCase extends * @throws SQLException if an error occurs */ @Override - public Object getObject(String columnName) throws SQLException { + public Object getObject(final String columnName) throws SQLException { if ("timestampProperty".equals(columnName)) { return new CustomTimestamp(); } else { @@ -390,8 +390,8 @@ public class DynaRowSetTestCase extends * @throws SQLException if an error occurs */ @Override - public String getColumnClassName(int columnIndex) throws SQLException { - String columnName = getColumnName(columnIndex); + public String getColumnClassName(final int columnIndex) throws SQLException { + final String columnName = getColumnName(columnIndex); if (columnName.equals("dateProperty")) { return java.sql.Timestamp.class.getName(); } else if (columnName.equals("timestampProperty")) { Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ExtendMapBean.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ExtendMapBean.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ExtendMapBean.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ExtendMapBean.java Wed Oct 15 20:15:17 2014 @@ -37,7 +37,7 @@ public class ExtendMapBean extends Hasht return dbName; } - public void setUnusuallyNamedProperty(String dbName) + public void setUnusuallyNamedProperty(final String dbName) { this.dbName = dbName; } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/FluentIntrospectionTestBean.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/FluentIntrospectionTestBean.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/FluentIntrospectionTestBean.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/FluentIntrospectionTestBean.java Wed Oct 15 20:15:17 2014 @@ -30,11 +30,11 @@ public class FluentIntrospectionTestBean return stringProperty; } - public void setStringProperty(String stringProperty) { + public void setStringProperty(final String stringProperty) { this.stringProperty = stringProperty; } - public FluentIntrospectionTestBean setFluentProperty(String value) { + public FluentIntrospectionTestBean setFluentProperty(final String value) { setStringProperty(value); return this; } @@ -44,7 +44,7 @@ public class FluentIntrospectionTestBean } public FluentIntrospectionTestBean setFluentGetProperty( - String fluentGetProperty) { + final String fluentGetProperty) { this.fluentGetProperty = fluentGetProperty; return this; } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospectorTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospectorTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospectorTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospectorTestCase.java Wed Oct 15 20:15:17 2014 @@ -37,9 +37,9 @@ public class FluentPropertyBeanIntrospec * @return a map with property names as keys */ private static Map<String, PropertyDescriptor> createDescriptorMap( - PropertyDescriptor[] descs) { - Map<String, PropertyDescriptor> map = new HashMap<String, PropertyDescriptor>(); - for (PropertyDescriptor pd : descs) { + final PropertyDescriptor[] descs) { + final Map<String, PropertyDescriptor> map = new HashMap<String, PropertyDescriptor>(); + for (final PropertyDescriptor pd : descs) { map.put(pd.getName(), pd); } return map; @@ -54,7 +54,7 @@ public class FluentPropertyBeanIntrospec * @return the descriptor from the map */ private static PropertyDescriptor fetchDescriptor( - Map<String, PropertyDescriptor> props, String name) { + final Map<String, PropertyDescriptor> props, final String name) { assertTrue("Property not found: " + name, props.containsKey(name)); return props.get(name); } @@ -66,7 +66,7 @@ public class FluentPropertyBeanIntrospec try { new FluentPropertyBeanIntrospector(null); fail("Missing prefix for write methods not detected!"); - } catch (IllegalArgumentException iex) { + } catch (final IllegalArgumentException iex) { // ok } } @@ -75,10 +75,10 @@ public class FluentPropertyBeanIntrospec * Tests whether correct property descriptors are detected. */ public void testIntrospection() throws IntrospectionException { - PropertyUtilsBean pu = new PropertyUtilsBean(); - FluentPropertyBeanIntrospector introspector = new FluentPropertyBeanIntrospector(); + final PropertyUtilsBean pu = new PropertyUtilsBean(); + final FluentPropertyBeanIntrospector introspector = new FluentPropertyBeanIntrospector(); pu.addBeanIntrospector(introspector); - Map<String, PropertyDescriptor> props = createDescriptorMap(pu + final Map<String, PropertyDescriptor> props = createDescriptorMap(pu .getPropertyDescriptors(FluentIntrospectionTestBean.class)); PropertyDescriptor pd = fetchDescriptor(props, "name"); assertNotNull("No read method for name", pd.getReadMethod()); Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/IndexedPropertyTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/IndexedPropertyTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/IndexedPropertyTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/IndexedPropertyTestCase.java Wed Oct 15 20:15:17 2014 @@ -63,7 +63,7 @@ public class IndexedPropertyTestCase ext * * @param name Name of the test case */ - public IndexedPropertyTestCase(String name) { + public IndexedPropertyTestCase(final String name) { super(name); } @@ -132,7 +132,7 @@ public class IndexedPropertyTestCase ext public void testArrayIndexedPropertyDescriptor() { try { - PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, "stringArray"); + final PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, "stringArray"); assertNotNull("No Array Descriptor", descriptor); assertEquals("Not IndexedPropertyDescriptor", IndexedPropertyDescriptor.class, @@ -140,7 +140,7 @@ public class IndexedPropertyTestCase ext assertEquals("PropertDescriptor Type invalid", testArray.getClass(), descriptor.getPropertyType()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -151,7 +151,7 @@ public class IndexedPropertyTestCase ext public void testListIndexedPropertyDescriptor() { try { - PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, "stringList"); + final PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, "stringList"); assertNotNull("No List Descriptor", descriptor); assertEquals("Not IndexedPropertyDescriptor", IndexedPropertyDescriptor.class, @@ -159,7 +159,7 @@ public class IndexedPropertyTestCase ext assertEquals("PropertDescriptor Type invalid", List.class, descriptor.getPropertyType()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -170,7 +170,7 @@ public class IndexedPropertyTestCase ext public void testArrayListIndexedPropertyDescriptor() { try { - PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, "arrayList"); + final PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, "arrayList"); assertNotNull("No ArrayList Descriptor", descriptor); assertEquals("Not IndexedPropertyDescriptor", IndexedPropertyDescriptor.class, @@ -178,7 +178,7 @@ public class IndexedPropertyTestCase ext assertEquals("PropertDescriptor Type invalid", ArrayList.class, descriptor.getPropertyType()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -189,10 +189,10 @@ public class IndexedPropertyTestCase ext public void testArrayReadMethod() { try { - IndexedPropertyDescriptor descriptor = + final IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)propertyUtilsBean.getPropertyDescriptor(bean, "stringArray"); assertNotNull("No Array Read Method", descriptor.getReadMethod()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -203,10 +203,10 @@ public class IndexedPropertyTestCase ext public void testArrayWriteMethod() { try { - IndexedPropertyDescriptor descriptor = + final IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)propertyUtilsBean.getPropertyDescriptor(bean, "stringArray"); assertNotNull("No Array Write Method", descriptor.getWriteMethod()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -217,10 +217,10 @@ public class IndexedPropertyTestCase ext public void testArrayIndexedReadMethod() { try { - IndexedPropertyDescriptor descriptor = + final IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)propertyUtilsBean.getPropertyDescriptor(bean, "stringArray"); assertNotNull("No Array Indexed Read Method", descriptor.getIndexedReadMethod()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -231,10 +231,10 @@ public class IndexedPropertyTestCase ext public void testArrayIndexedWriteMethod() { try { - IndexedPropertyDescriptor descriptor = + final IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)propertyUtilsBean.getPropertyDescriptor(bean, "stringArray"); assertNotNull("No Array Indexed Write Method", descriptor.getIndexedWriteMethod()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -249,10 +249,10 @@ public class IndexedPropertyTestCase ext public void testListReadMethod() { try { - IndexedPropertyDescriptor descriptor = + final IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)propertyUtilsBean.getPropertyDescriptor(bean, "stringList"); assertNotNull("No List Read Method", descriptor.getReadMethod()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -267,10 +267,10 @@ public class IndexedPropertyTestCase ext public void testListWriteMethod() { try { - IndexedPropertyDescriptor descriptor = + final IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)propertyUtilsBean.getPropertyDescriptor(bean, "stringList"); assertNotNull("No List Write Method", descriptor.getWriteMethod()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -281,10 +281,10 @@ public class IndexedPropertyTestCase ext public void testListIndexedReadMethod() { try { - IndexedPropertyDescriptor descriptor = + final IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)propertyUtilsBean.getPropertyDescriptor(bean, "stringList"); assertNotNull("No List Indexed Read Method", descriptor.getIndexedReadMethod()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -295,10 +295,10 @@ public class IndexedPropertyTestCase ext public void testListIndexedWriteMethod() { try { - IndexedPropertyDescriptor descriptor = + final IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)propertyUtilsBean.getPropertyDescriptor(bean, "stringList"); assertNotNull("No List Indexed Write Method", descriptor.getIndexedWriteMethod()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -309,10 +309,10 @@ public class IndexedPropertyTestCase ext public void testArrayListReadMethod() { try { - IndexedPropertyDescriptor descriptor = + final IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)propertyUtilsBean.getPropertyDescriptor(bean, "arrayList"); assertNotNull("No ArrayList Read Method", descriptor.getReadMethod()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -323,10 +323,10 @@ public class IndexedPropertyTestCase ext public void testArrayListWriteMethod() { try { - IndexedPropertyDescriptor descriptor = + final IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)propertyUtilsBean.getPropertyDescriptor(bean, "arrayList"); assertNotNull("No ArrayList Write Method", descriptor.getWriteMethod()); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -338,7 +338,7 @@ public class IndexedPropertyTestCase ext try { assertEquals(testArray, propertyUtilsBean.getProperty(bean, "stringArray")); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -353,7 +353,7 @@ public class IndexedPropertyTestCase ext try { assertEquals("array-0", beanUtilsBean.getProperty(bean, "stringArray")); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -366,7 +366,7 @@ public class IndexedPropertyTestCase ext try { assertEquals("array-1", beanUtilsBean.getProperty(bean, "stringArray[1]")); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -379,7 +379,7 @@ public class IndexedPropertyTestCase ext try { assertEquals("array-1", beanUtilsBean.getIndexedProperty(bean, "stringArray", 1)); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -396,7 +396,7 @@ public class IndexedPropertyTestCase ext try { assertEquals(testList, propertyUtilsBean.getProperty(bean, "stringList")); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -413,7 +413,7 @@ public class IndexedPropertyTestCase ext try { assertEquals("list-0", beanUtilsBean.getProperty(bean, "stringList")); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -426,7 +426,7 @@ public class IndexedPropertyTestCase ext try { assertEquals("list-1", beanUtilsBean.getProperty(bean, "stringList[1]")); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -439,7 +439,7 @@ public class IndexedPropertyTestCase ext try { assertEquals("list-1", beanUtilsBean.getIndexedProperty(bean, "stringList", 1)); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -458,14 +458,14 @@ public class IndexedPropertyTestCase ext public void testSetArray() { try { beanUtilsBean.setProperty(bean, "stringArray", newArray); - Object value = bean.getStringArray(); + final Object value = bean.getStringArray(); assertEquals("Type is different", newArray.getClass(), value.getClass()); - String[] array = (String[])value; + final String[] array = (String[])value; assertEquals("Array Length is different", newArray.length, array.length); for (int i = 0; i < array.length; i++) { assertEquals("Element " + i + " is different", newArray[i], array[i]); } - } catch(Exception e) { + } catch(final Exception e) { log.error("testSetArray()", e); fail("Threw exception " + e); } @@ -480,7 +480,7 @@ public class IndexedPropertyTestCase ext try { beanUtilsBean.setProperty(bean, "stringArray[1]", "modified-1"); assertEquals("modified-1", bean.getStringArray(1)); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -493,7 +493,7 @@ public class IndexedPropertyTestCase ext try { propertyUtilsBean.setIndexedProperty(bean, "stringArray", 1, "modified-1"); assertEquals("modified-1", bean.getStringArray(1)); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -509,14 +509,14 @@ public class IndexedPropertyTestCase ext public void testSetList() { try { beanUtilsBean.setProperty(bean, "stringList", newList); - Object value = bean.getStringList(); + final Object value = bean.getStringList(); assertEquals("Type is different", newList.getClass(), value.getClass()); - List<?> list = (List<?>)value; + final List<?> list = (List<?>)value; assertEquals("List size is different", newList.size(), list.size()); for (int i = 0; i < list.size(); i++) { assertEquals("Element " + i + " is different", newList.get(i), list.get(i)); } - } catch(Exception e) { + } catch(final Exception e) { log.error("testSetList()", e); fail("Threw exception " + e); } @@ -531,7 +531,7 @@ public class IndexedPropertyTestCase ext try { beanUtilsBean.setProperty(bean, "stringList[1]", "modified-1"); assertEquals("modified-1", bean.getStringList(1)); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -544,7 +544,7 @@ public class IndexedPropertyTestCase ext try { propertyUtilsBean.setIndexedProperty(bean, "stringList", 1, "modified-1"); assertEquals("modified-1", bean.getStringList(1)); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -558,7 +558,7 @@ public class IndexedPropertyTestCase ext try { assertEquals(arrayList, propertyUtilsBean.getProperty(bean, "arrayList")); - } catch(Exception e) { + } catch(final Exception e) { fail("Threw exception " + e); } } @@ -569,14 +569,14 @@ public class IndexedPropertyTestCase ext public void testSetArrayList() { try { beanUtilsBean.setProperty(bean, "arrayList", newList); - Object value = bean.getArrayList(); + final Object value = bean.getArrayList(); assertEquals("Type is different", newList.getClass(), value.getClass()); - List<?> list = (List<?>)value; + final List<?> list = (List<?>)value; assertEquals("List size is different", newList.size(), list.size()); for (int i = 0; i < list.size(); i++) { assertEquals("Element " + i + " is different", newList.get(i), list.get(i)); } - } catch(Exception e) { + } catch(final Exception e) { log.error("testSetList()", e); fail("Threw exception " + e); } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/IndexedTestBean.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/IndexedTestBean.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/IndexedTestBean.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/IndexedTestBean.java Wed Oct 15 20:15:17 2014 @@ -50,21 +50,21 @@ public class IndexedTestBean { /** * Setter for the String[] property. */ - public void setStringArray(String[] stringArray) { + public void setStringArray(final String[] stringArray) { this.stringArray = stringArray; } /** * Indexed Getter for the String[] property. */ - public String getStringArray(int index) { + public String getStringArray(final int index) { return stringArray[index]; } /** * Indexed Setter for the String[] property. */ - public void setStringArray(int index, String value) { + public void setStringArray(final int index, final String value) { stringArray[index] = value; } @@ -78,21 +78,21 @@ public class IndexedTestBean { /** * Setter for the java.util.List property. */ - public void setStringList(List<String> stringList) { + public void setStringList(final List<String> stringList) { this.stringList = stringList; } /** * Indexed Getter for the java.util.List property. */ - public String getStringList(int index) { + public String getStringList(final int index) { return stringList.get(index); } /** * Indexed Setter for the java.util.List property. */ - public void setStringList(int index, String value) { + public void setStringList(final int index, final String value) { stringList.add(index, value); } @@ -106,21 +106,21 @@ public class IndexedTestBean { /** * Setter for the java.util.ArrayList property. */ - public void setArrayList(ArrayList<Object> arrayList) { + public void setArrayList(final ArrayList<Object> arrayList) { this.arrayList = arrayList; } /** * Indexed Getter for the java.util.ArrayList property. */ - public Object getArrayList(int index) { + public Object getArrayList(final int index) { return arrayList.get(index); } /** * Indexed Setter for the java.util.ArrayList property. */ - public void setArrayList(int index, Object value) { + public void setArrayList(final int index, final Object value) { arrayList.add(index, value); } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaBeanTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaBeanTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaBeanTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaBeanTestCase.java Wed Oct 15 20:15:17 2014 @@ -51,7 +51,7 @@ public class LazyDynaBeanTestCase extend * * @param name Name of the test case */ - public LazyDynaBeanTestCase(String name) { + public LazyDynaBeanTestCase(final String name) { super(name); } @@ -60,7 +60,7 @@ public class LazyDynaBeanTestCase extend /** * Run thus Test */ - public static void main(String[] args) { + public static void main(final String[] args) { junit.textui.TestRunner.run(suite()); } @@ -113,7 +113,7 @@ public class LazyDynaBeanTestCase extend try { bean.set(testProperty, testString1); fail("expected ConversionException trying to set an Integer property to a String"); - } catch (ConversionException expected) { + } catch (final ConversionException expected) { // expected result } @@ -151,7 +151,7 @@ public class LazyDynaBeanTestCase extend try { bean.set(testProperty, testString1); fail("expected IllegalArgumentException trying to add new property to restricted DynaClass"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } @@ -222,13 +222,13 @@ public class LazyDynaBeanTestCase extend try { PropertyUtils.setProperty(bean, testProperty+"("+testKey+")", testString1); } - catch (NoSuchMethodException ex) { + catch (final NoSuchMethodException ex) { fail("testIndexedPropertyUtils threw "+ex); } - catch (InvocationTargetException ex) { + catch (final InvocationTargetException ex) { fail("testIndexedPropertyUtils threw "+ex); } - catch (IllegalAccessException ex) { + catch (final IllegalAccessException ex) { fail("testIndexedPropertyUtils threw "+ex); } @@ -254,7 +254,7 @@ public class LazyDynaBeanTestCase extend try { bean.set(testProperty, testKey, testInteger1); fail("expected IllegalArgumentException trying to add new property to restricted MutableDynaClass"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } @@ -269,7 +269,7 @@ public class LazyDynaBeanTestCase extend try { bean.set(testProperty, testKey, testInteger1); fail("set(property, key, value) should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } } @@ -336,7 +336,7 @@ public class LazyDynaBeanTestCase extend public void testIndexedPrimitiveArray() { int index = 3; - int[] primitiveArray = new int[0]; + final int[] primitiveArray = new int[0]; // Check the property & value doesn't exist assertNull("Check Indexed Property doesn't exist", dynaClass.getDynaProperty(testProperty)); @@ -370,7 +370,7 @@ public class LazyDynaBeanTestCase extend public void testIndexedObjectArray() { int index = 3; - Object objectArray = new String[0]; + final Object objectArray = new String[0]; // Check the property & value doesn't exist assertNull("Check Indexed Property doesn't exist", dynaClass.getDynaProperty(testProperty)); @@ -402,8 +402,8 @@ public class LazyDynaBeanTestCase extend */ public void testIndexedDynaBeanArray() { - int index = 3; - Object objectArray = new LazyDynaMap[0]; + final int index = 3; + final Object objectArray = new LazyDynaMap[0]; // Check the property & value doesn't exist assertNull("Check Indexed Property doesn't exist", dynaClass.getDynaProperty(testProperty)); @@ -420,7 +420,7 @@ public class LazyDynaBeanTestCase extend } dynaClass.add(testPropertyB, objectArray.getClass()); - LazyDynaMap newMap = new LazyDynaMap(); + final LazyDynaMap newMap = new LazyDynaMap(); newMap.set(testPropertyB, testString2); bean.set(testPropertyA, index, newMap); assertEquals("Check Indexed Value is correct(a)", testString2, ((DynaBean)bean.get(testPropertyA, index)).get(testPropertyB)); @@ -432,7 +432,7 @@ public class LazyDynaBeanTestCase extend */ public void testIndexedPropertyUtils() { - int index = 3; + final int index = 3; dynaClass.setReturnNull(false); // Check the property & value doesn't exist @@ -444,13 +444,13 @@ public class LazyDynaBeanTestCase extend try { PropertyUtils.setProperty(bean, testProperty+"["+index+"]", testString1); } - catch (NoSuchMethodException ex) { + catch (final NoSuchMethodException ex) { fail("testIndexedPropertyUtils threw "+ex); } - catch (InvocationTargetException ex) { + catch (final InvocationTargetException ex) { fail("testIndexedPropertyUtils threw "+ex); } - catch (IllegalAccessException ex) { + catch (final IllegalAccessException ex) { fail("testIndexedPropertyUtils threw "+ex); } @@ -464,7 +464,7 @@ public class LazyDynaBeanTestCase extend */ public void testIndexedPropertyRestricted() { - int index = 3; + final int index = 3; // Set the MutableDyanClass to 'restricted' (i.e. no new properties cab be added dynaClass.setRestricted(true); @@ -478,7 +478,7 @@ public class LazyDynaBeanTestCase extend try { bean.set(testProperty, index, testInteger1); fail("expected IllegalArgumentException trying to add new property to restricted MutableDynaClass"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } @@ -488,13 +488,13 @@ public class LazyDynaBeanTestCase extend * Test setting indexed property for type which is not List or Array */ public void testIndexedInvalidType() { - int index = 3; + final int index = 3; dynaClass.add(testProperty, String.class); assertFalse("Check Property is not indexed", dynaClass.getDynaProperty(testProperty).isIndexed()); try { bean.set(testProperty, index, testString1); fail("set(property, index, value) should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaClassTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaClassTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaClassTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaClassTestCase.java Wed Oct 15 20:15:17 2014 @@ -37,7 +37,7 @@ public class LazyDynaClassTestCase exten * * @param name Name of the test case */ - public LazyDynaClassTestCase(String name) { + public LazyDynaClassTestCase(final String name) { super(name); } @@ -46,7 +46,7 @@ public class LazyDynaClassTestCase exten /** * Run this Test */ - public static void main(String[] args) { + public static void main(final String[] args) { junit.textui.TestRunner.run(suite()); } @@ -80,7 +80,7 @@ public class LazyDynaClassTestCase exten */ public void testAddProperty1() { dynaClass.add(testProperty); - DynaProperty dynaProperty = dynaClass.getDynaProperty(testProperty); + final DynaProperty dynaProperty = dynaClass.getDynaProperty(testProperty); assertEquals("name is correct", testProperty, dynaProperty.getName()); assertEquals("type is correct", Object.class, dynaProperty.getType()); } @@ -90,7 +90,7 @@ public class LazyDynaClassTestCase exten */ public void testAddProperty2() { dynaClass.add(testProperty, String.class); - DynaProperty dynaProperty = dynaClass.getDynaProperty(testProperty); + final DynaProperty dynaProperty = dynaClass.getDynaProperty(testProperty); assertEquals("name is correct", testProperty, dynaProperty.getName()); assertEquals("type is correct", String.class, dynaProperty.getType()); } @@ -102,7 +102,7 @@ public class LazyDynaClassTestCase exten try { dynaClass.add(testProperty, String.class, true, true); fail("add(name, type, readable, writable) did not throw UnsupportedOperationException"); - } catch (UnsupportedOperationException expected) { + } catch (final UnsupportedOperationException expected) { // expected result } } @@ -114,7 +114,7 @@ public class LazyDynaClassTestCase exten try { dynaClass.add((String)null); fail("null property name not prevented"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } } @@ -126,7 +126,7 @@ public class LazyDynaClassTestCase exten try { dynaClass.add(null, String.class); fail("null property name not prevented"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } } @@ -138,7 +138,7 @@ public class LazyDynaClassTestCase exten try { dynaClass.add(null, String.class, true, true); fail("add(name, type, readable, writable) did not throw UnsupportedOperationException"); - } catch (UnsupportedOperationException expected) { + } catch (final UnsupportedOperationException expected) { // expected result } } @@ -152,7 +152,7 @@ public class LazyDynaClassTestCase exten try { dynaClass.add(testProperty); fail("add(name) did not throw IllegalStateException"); - } catch (IllegalStateException expected) { + } catch (final IllegalStateException expected) { // expected result } } @@ -166,7 +166,7 @@ public class LazyDynaClassTestCase exten try { dynaClass.add(testProperty, String.class); fail("add(name, type) did not throw IllegalStateException"); - } catch (IllegalStateException expected) { + } catch (final IllegalStateException expected) { // expected result } } @@ -180,7 +180,7 @@ public class LazyDynaClassTestCase exten try { dynaClass.add(testProperty, String.class, true, true); fail("add(name, type, readable, writable) did not throw UnsupportedOperationException"); - } catch (UnsupportedOperationException t) { + } catch (final UnsupportedOperationException t) { // expected result } } @@ -191,7 +191,7 @@ public class LazyDynaClassTestCase exten public void testGetPropertyDoesntExist1() { dynaClass.setReturnNull(false); assertFalse("returnNull is 'false'", dynaClass.isReturnNull()); - DynaProperty dynaProperty = dynaClass.getDynaProperty(testProperty); + final DynaProperty dynaProperty = dynaClass.getDynaProperty(testProperty); assertEquals("name is correct", testProperty, dynaProperty.getName()); assertEquals("type is correct", Object.class, dynaProperty.getType()); assertFalse("property doesnt exist", dynaClass.isDynaProperty(testProperty)); @@ -227,7 +227,7 @@ public class LazyDynaClassTestCase exten try { dynaClass.remove(null); fail("remove(null) did not throw IllegalArgumentException"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } } @@ -243,7 +243,7 @@ public class LazyDynaClassTestCase exten try { dynaClass.remove(testProperty); fail("remove property when MutableDynaClassis restricted did not throw IllegalStateException"); - } catch (IllegalStateException expected) { + } catch (final IllegalStateException expected) { // expected result } } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaListTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaListTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaListTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaListTestCase.java Wed Oct 15 20:15:17 2014 @@ -56,7 +56,7 @@ public class LazyDynaListTestCase extend * * @param name Name of the test case */ - public LazyDynaListTestCase(String name) { + public LazyDynaListTestCase(final String name) { super(name); } @@ -65,7 +65,7 @@ public class LazyDynaListTestCase extend /** * Run thus Test */ - public static void main(String[] args) { + public static void main(final String[] args) { junit.textui.TestRunner.run(suite()); } @@ -98,7 +98,7 @@ public class LazyDynaListTestCase extend public void testDynaBeanDynaClass() { // Create LazyArrayList for DynaBeans - LazyDynaList list = new LazyDynaList(basicDynaClass); + final LazyDynaList list = new LazyDynaList(basicDynaClass); // test dynaBeanTest(list, BasicDynaBean.class, basicDynaClass, new BenchBean()); @@ -110,10 +110,10 @@ public class LazyDynaListTestCase extend public void testDynaBeanType() { // Create LazyArrayList for DynaBeans - LazyDynaList list = new LazyDynaList(LazyDynaBean.class); + final LazyDynaList list = new LazyDynaList(LazyDynaBean.class); - LazyDynaBean bean = new LazyDynaBean(); + final LazyDynaBean bean = new LazyDynaBean(); bean.set("prop1", "val"); // test @@ -126,7 +126,7 @@ public class LazyDynaListTestCase extend public void testMapDynaClass() { // Create LazyArrayList for TreeMap's - LazyDynaList list = new LazyDynaList(treeMapDynaClass); + final LazyDynaList list = new LazyDynaList(treeMapDynaClass); // test mapTest(list, TreeMap.class, new BenchBean()); @@ -139,7 +139,7 @@ public class LazyDynaListTestCase extend public void testMapType() { // Create LazyArrayList for HashMap's - LazyDynaList list = new LazyDynaList(HashMap.class); + final LazyDynaList list = new LazyDynaList(HashMap.class); // test mapTest(list, HashMap.class, new BenchBean()); @@ -152,7 +152,7 @@ public class LazyDynaListTestCase extend public void testPojoDynaClass() { // Create LazyArrayList for POJO's - LazyDynaList list = new LazyDynaList(pojoDynaClass); + final LazyDynaList list = new LazyDynaList(pojoDynaClass); // test pojoTest(list, TestBean.class, new BenchBean()); @@ -165,7 +165,7 @@ public class LazyDynaListTestCase extend public void testPojoType() { // Create LazyArrayList for POJO's - LazyDynaList list = new LazyDynaList(TestBean.class); + final LazyDynaList list = new LazyDynaList(TestBean.class); // test pojoTest(list, TestBean.class, new BenchBean()); @@ -175,14 +175,14 @@ public class LazyDynaListTestCase extend /** * Test Collection */ - public void testCollection(LazyDynaList list, Class<?> testClass, DynaClass testDynaClass, Object wrongBean) { + public void testCollection(final LazyDynaList list, final Class<?> testClass, final DynaClass testDynaClass, final Object wrongBean) { // ----- Create Collection & Array of Maps ----- - int size = 5; - List<Object> testList = new ArrayList<Object>(size); - TreeMap<?, ?>[] testArray = new TreeMap[size]; + final int size = 5; + final List<Object> testList = new ArrayList<Object>(size); + final TreeMap<?, ?>[] testArray = new TreeMap[size]; for (int i = 0; i < size; i++) { - TreeMap<String, Object> map = new TreeMap<String, Object>(); + final TreeMap<String, Object> map = new TreeMap<String, Object>(); map.put("prop"+i, "val"+i); testArray[i] = map; testList.add(testArray[i]); @@ -227,14 +227,14 @@ public class LazyDynaListTestCase extend * Test adding a map to List with no type set. */ public void testNullType() { - LazyDynaList lazyList = new LazyDynaList(); + final LazyDynaList lazyList = new LazyDynaList(); lazyList.add(new HashMap<String, Object>()); } /** * Test DynaBean Create */ - private void dynaBeanTest(LazyDynaList list, Class<?> testClass, DynaClass testDynaClass, Object wrongBean) { + private void dynaBeanTest(final LazyDynaList list, final Class<?> testClass, final DynaClass testDynaClass, final Object wrongBean) { // Test get(index) created correct DynaBean - Second Object dynaBean = list.get(1); @@ -264,13 +264,13 @@ public class LazyDynaListTestCase extend try { list.add(2, wrongBean); fail("Expected IllegalArgumentException"); - } catch(IllegalArgumentException ignore) { + } catch(final IllegalArgumentException ignore) { // expected result } // find a String property to set - String testProperty = findStringProperty(testDynaClass); + final String testProperty = findStringProperty(testDynaClass); assertNotNull("Test Property Not Found", testProperty); dynaArray = list.toDynaBeanArray(); for (int i = 0; i < dynaArray.length; i++) { @@ -278,16 +278,16 @@ public class LazyDynaListTestCase extend } // Create Collection - List<Object> collection = new ArrayList<Object>(); + final List<Object> collection = new ArrayList<Object>(); try { collection.add(testDynaClass.newInstance()); collection.add(testDynaClass.newInstance()); collection.add(testDynaClass.newInstance()); - } catch(Exception ex) { + } catch(final Exception ex) { fail("1. FAILED: " + ex); } - int expectedSize = dynaArray.length + collection.size(); - String origValue = (String)((DynaBean)collection.get(0)).get(testProperty); + final int expectedSize = dynaArray.length + collection.size(); + final String origValue = (String)((DynaBean)collection.get(0)).get(testProperty); ((DynaBean)collection.get(0)).set(testProperty, origValue+"_updated_"+0); ((DynaBean)collection.get(1)).set(testProperty, origValue+"_updated_"+1); ((DynaBean)collection.get(2)).set(testProperty, origValue+"_updated_"+2); @@ -310,14 +310,14 @@ public class LazyDynaListTestCase extend // Test Insert - add(index, Object) try { - DynaBean extraElement = testDynaClass.newInstance(); + final DynaBean extraElement = testDynaClass.newInstance(); extraElement.set(testProperty, "extraOne"); list.add(2, extraElement); dynaArray = list.toDynaBeanArray(); assertEquals("17. Wrong Value", origValue+"_updated_"+0, dynaArray[1].get(testProperty)); assertEquals("18. Wrong Value", "extraOne", dynaArray[2].get(testProperty)); assertEquals("19. Wrong Value", origValue+"_updated_"+1, dynaArray[3].get(testProperty)); - } catch(Exception ex) { + } catch(final Exception ex) { fail("2. FAILED: " + ex); } @@ -326,8 +326,8 @@ public class LazyDynaListTestCase extend /** * Test Map Create */ - private String findStringProperty(DynaClass dynaClass) { - DynaProperty[] properties = dynaClass.getDynaProperties(); + private String findStringProperty(final DynaClass dynaClass) { + final DynaProperty[] properties = dynaClass.getDynaProperties(); for (int i = 0; i < properties.length; i++) { if (properties[i].getType() == String.class) { return properties[i].getName(); @@ -341,7 +341,7 @@ public class LazyDynaListTestCase extend /** * Test Map Create */ - private void mapTest(LazyDynaList list, Class<?> testClass, Object wrongBean) { + private void mapTest(final LazyDynaList list, final Class<?> testClass, final Object wrongBean) { // Test get(index) created correct DynaBean - First Object dynaBean = list.get(0); @@ -381,7 +381,7 @@ public class LazyDynaListTestCase extend try { list.add(2, wrongBean); fail("Expected IllegalArgumentException"); - } catch(IllegalArgumentException ignore) { + } catch(final IllegalArgumentException ignore) { // expected result } @@ -390,7 +390,7 @@ public class LazyDynaListTestCase extend /** * Test Pojo Create */ - private void pojoTest(LazyDynaList list, Class<?> testClass, Object wrongBean) { + private void pojoTest(final LazyDynaList list, final Class<?> testClass, final Object wrongBean) { // Test get(index) created correct DynaBean - First Object dynaBean = list.get(0); @@ -430,7 +430,7 @@ public class LazyDynaListTestCase extend try { list.add(2, wrongBean); fail("Expected IllegalArgumentException"); - } catch(IllegalArgumentException ignore) { + } catch(final IllegalArgumentException ignore) { // expected result } @@ -451,7 +451,7 @@ public class LazyDynaListTestCase extend assertEquals("post-set check", "value1", bean.get(BASIC_PROP1)); // Serialize/Deserialize - LazyDynaList result = (LazyDynaList)serializeDeserialize(target, "DynaBean"); + final LazyDynaList result = (LazyDynaList)serializeDeserialize(target, "DynaBean"); target = null; bean = null; @@ -476,7 +476,7 @@ public class LazyDynaListTestCase extend assertEquals("post-set check", "value1", bean.get(BASIC_PROP1)); // Serialize/Deserialize - LazyDynaList result = (LazyDynaList)serializeDeserialize(target, "DynaBean"); + final LazyDynaList result = (LazyDynaList)serializeDeserialize(target, "DynaBean"); target = null; bean = null; @@ -501,7 +501,7 @@ public class LazyDynaListTestCase extend assertEquals("post-set check", "value1", bean.get(BASIC_PROP1)); // Serialize/Deserialize - LazyDynaList result = (LazyDynaList)serializeDeserialize(target, "Map"); + final LazyDynaList result = (LazyDynaList)serializeDeserialize(target, "Map"); target = null; bean = null; @@ -526,7 +526,7 @@ public class LazyDynaListTestCase extend assertEquals("post-set check", "value1", bean.get("stringProperty")); // Serialize/Deserialize - LazyDynaList result = (LazyDynaList)serializeDeserialize(target, "POJO"); + final LazyDynaList result = (LazyDynaList)serializeDeserialize(target, "POJO"); target = null; bean = null; @@ -542,28 +542,28 @@ public class LazyDynaListTestCase extend /** * Do serialization and deserialization. */ - private Object serializeDeserialize(Object target, String text) { + private Object serializeDeserialize(final Object target, final String text) { // Serialize the test object - ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { - ObjectOutputStream oos = new ObjectOutputStream(baos); + final ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(target); oos.flush(); oos.close(); - } catch (Exception e) { + } catch (final Exception e) { fail(text + ": Exception during serialization: " + e); } // Deserialize the test object Object result = null; try { - ByteArrayInputStream bais = + final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - ObjectInputStream ois = new ObjectInputStream(bais); + final ObjectInputStream ois = new ObjectInputStream(bais); result = ois.readObject(); bais.close(); - } catch (Exception e) { + } catch (final Exception e) { fail(text + ": Exception during deserialization: " + e); } return result; @@ -574,10 +574,10 @@ public class LazyDynaListTestCase extend * Tests toArray() if the list contains DynaBean objects. */ public void testToArrayDynaBeans() { - LazyDynaList list = new LazyDynaList(LazyDynaBean.class); - LazyDynaBean elem = new LazyDynaBean(); + final LazyDynaList list = new LazyDynaList(LazyDynaBean.class); + final LazyDynaBean elem = new LazyDynaBean(); list.add(elem); - LazyDynaBean[] beans = new LazyDynaBean[1]; + final LazyDynaBean[] beans = new LazyDynaBean[1]; assertSame("Wrong array", beans, list.toArray(beans)); assertSame("Wrong element", elem, beans[0]); } @@ -586,10 +586,10 @@ public class LazyDynaListTestCase extend * Tests toArray() if the list contains maps. */ public void testToArrayMapType() { - LazyDynaList list = new LazyDynaList(HashMap.class); - HashMap<String, Object> elem = new HashMap<String, Object>(); + final LazyDynaList list = new LazyDynaList(HashMap.class); + final HashMap<String, Object> elem = new HashMap<String, Object>(); list.add(elem); - Map<?, ?>[] array = new Map[1]; + final Map<?, ?>[] array = new Map[1]; assertSame("Wrong array", array, list.toArray(array)); assertEquals("Wrong element", elem, array[0]); } @@ -598,10 +598,10 @@ public class LazyDynaListTestCase extend * Tests toArray() for other bean elements. */ public void testToArrayOtherType() { - LazyDynaList list = new LazyDynaList(TestBean.class); - TestBean elem = new TestBean(); + final LazyDynaList list = new LazyDynaList(TestBean.class); + final TestBean elem = new TestBean(); list.add(elem); - TestBean[] array = new TestBean[1]; + final TestBean[] array = new TestBean[1]; assertSame("Wrong array", array, list.toArray(array)); assertEquals("Wrong element", elem, array[0]); } @@ -610,10 +610,10 @@ public class LazyDynaListTestCase extend * Tests toArray() if the array's size does not fit the collection size. */ public void testToArrayUnsufficientSize() { - LazyDynaList list = new LazyDynaList(LazyDynaBean.class); - LazyDynaBean elem = new LazyDynaBean(); + final LazyDynaList list = new LazyDynaList(LazyDynaBean.class); + final LazyDynaBean elem = new LazyDynaBean(); list.add(elem); - LazyDynaBean[] array = (LazyDynaBean[]) list.toArray(new LazyDynaBean[0]); + final LazyDynaBean[] array = (LazyDynaBean[]) list.toArray(new LazyDynaBean[0]); assertEquals("Wrong array size", 1, array.length); assertEquals("Wrong element", elem, array[0]); } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaMapTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaMapTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaMapTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/LazyDynaMapTestCase.java Wed Oct 15 20:15:17 2014 @@ -52,7 +52,7 @@ public class LazyDynaMapTestCase extends * * @param name Name of the test case */ - public LazyDynaMapTestCase(String name) { + public LazyDynaMapTestCase(final String name) { super(name); } @@ -61,7 +61,7 @@ public class LazyDynaMapTestCase extends /** * Run thus Test */ - public static void main(String[] args) { + public static void main(final String[] args) { junit.textui.TestRunner.run(suite()); } @@ -141,7 +141,7 @@ public class LazyDynaMapTestCase extends try { dynaMap.set(testProperty, testString1); fail("expected IllegalArgumentException trying to add new property to restricted DynaClass"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } @@ -212,13 +212,13 @@ public class LazyDynaMapTestCase extends try { PropertyUtils.setProperty(dynaMap, testProperty+"("+testKey+")", testString1); } - catch (NoSuchMethodException ex) { + catch (final NoSuchMethodException ex) { fail("testIndexedPropertyUtils threw "+ex); } - catch (InvocationTargetException ex) { + catch (final InvocationTargetException ex) { fail("testIndexedPropertyUtils threw "+ex); } - catch (IllegalAccessException ex) { + catch (final IllegalAccessException ex) { fail("testIndexedPropertyUtils threw "+ex); } @@ -244,7 +244,7 @@ public class LazyDynaMapTestCase extends try { dynaMap.set(testProperty, testKey, testInteger1); fail("expected IllegalArgumentException trying to add new property to restricted MutableDynaClass"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } @@ -259,7 +259,7 @@ public class LazyDynaMapTestCase extends try { dynaMap.set(testProperty, testKey, testInteger1); fail("set(property, key, value) should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } } @@ -326,7 +326,7 @@ public class LazyDynaMapTestCase extends public void testIndexedPrimitiveArray() { int index = 3; - int[] primitiveArray = new int[0]; + final int[] primitiveArray = new int[0]; // Check the property & value doesn't exist assertNull("Check Indexed Property doesn't exist", dynaMap.getDynaProperty(testProperty)); @@ -360,7 +360,7 @@ public class LazyDynaMapTestCase extends public void testIndexedObjectArray() { int index = 3; - Object objectArray = new String[0]; + final Object objectArray = new String[0]; // Check the property & value doesn't exist assertNull("Check Indexed Property doesn't exist", dynaMap.getDynaProperty(testProperty)); @@ -392,8 +392,8 @@ public class LazyDynaMapTestCase extends */ public void testIndexedDynaBeanArray() { - int index = 3; - Object objectArray = new LazyDynaBean[0]; + final int index = 3; + final Object objectArray = new LazyDynaBean[0]; // Check the property & value doesn't exist assertNull("Check Indexed Property doesn't exist", dynaMap.getDynaProperty(testProperty)); @@ -410,7 +410,7 @@ public class LazyDynaMapTestCase extends } dynaMap.add(testPropertyB, objectArray.getClass()); - LazyDynaBean newBean = new LazyDynaBean(); + final LazyDynaBean newBean = new LazyDynaBean(); newBean.set(testPropertyB, testString2); dynaMap.set(testPropertyA, index, newBean); assertEquals("Check Indexed Value is correct(a)", testString2, ((DynaBean)dynaMap.get(testPropertyA, index)).get(testPropertyB)); @@ -422,7 +422,7 @@ public class LazyDynaMapTestCase extends */ public void testIndexedPropertyUtils() { - int index = 3; + final int index = 3; dynaMap.setReturnNull(false); // Check the property & value doesn't exist @@ -434,13 +434,13 @@ public class LazyDynaMapTestCase extends try { PropertyUtils.setProperty(dynaMap, testProperty+"["+index+"]", testString1); } - catch (NoSuchMethodException ex) { + catch (final NoSuchMethodException ex) { fail("testIndexedPropertyUtils threw "+ex); } - catch (InvocationTargetException ex) { + catch (final InvocationTargetException ex) { fail("testIndexedPropertyUtils threw "+ex); } - catch (IllegalAccessException ex) { + catch (final IllegalAccessException ex) { fail("testIndexedPropertyUtils threw "+ex); } @@ -454,7 +454,7 @@ public class LazyDynaMapTestCase extends */ public void testIndexedPropertyRestricted() { - int index = 3; + final int index = 3; // Set the MutableDyanClass to 'restricted' (i.e. no new properties cab be added dynaMap.setRestricted(true); @@ -468,7 +468,7 @@ public class LazyDynaMapTestCase extends try { dynaMap.set(testProperty, index, testInteger1); fail("expected IllegalArgumentException trying to add new property to restricted MutableDynaClass"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } @@ -478,13 +478,13 @@ public class LazyDynaMapTestCase extends * Test setting indexed property for type which is not List or Array */ public void testIndexedInvalidType() { - int index = 3; + final int index = 3; dynaMap.set(testProperty, "Test String"); assertFalse("Check Property is not indexed", dynaMap.getDynaProperty(testProperty).isIndexed()); try { dynaMap.set(testProperty, index, testString1); fail("set(property, index, value) should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException expected) { + } catch (final IllegalArgumentException expected) { // expected result } } @@ -496,16 +496,16 @@ public class LazyDynaMapTestCase extends // Create LazyDynaMap using TreeMap // containing some properties - LazyDynaMap orig = new LazyDynaMap(new TreeMap<String, Object>()); + final LazyDynaMap orig = new LazyDynaMap(new TreeMap<String, Object>()); orig.set("indexProp", 0, "indexVal0"); orig.set("indexProp", 1, "indexVal1"); assertEquals("Index prop size", 2, ((List<?>)orig.get("indexProp")).size()); - LazyDynaMap newOne = (LazyDynaMap)orig.newInstance(); - Map<String, Object> newMap = newOne.getMap(); + final LazyDynaMap newOne = (LazyDynaMap)orig.newInstance(); + final Map<String, Object> newMap = newOne.getMap(); assertEquals("Check Map type", TreeMap.class, newMap.getClass()); - ArrayList<?> indexProp = (ArrayList<?>)newMap.get("indexProp"); + final ArrayList<?> indexProp = (ArrayList<?>)newMap.get("indexProp"); assertNotNull("Indexed Prop missing", indexProp); assertEquals("Index prop size", 0, indexProp.size()); } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MappedPropertyTestBean.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MappedPropertyTestBean.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MappedPropertyTestBean.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MappedPropertyTestBean.java Wed Oct 15 20:15:17 2014 @@ -35,66 +35,66 @@ public class MappedPropertyTestBean { // -------------------------------------------------------------- Properties - public String getMapproperty(String key) { + public String getMapproperty(final String key) { return (String) map.get(key); } - public void setMapproperty(String key, String value) { + public void setMapproperty(final String key, final String value) { map.put(key, value); } - public boolean isMappedBoolean(String key) { + public boolean isMappedBoolean(final String key) { return ((Boolean)map.get(key)).booleanValue(); } - public void setMappedBoolean(String key, boolean value) { + public void setMappedBoolean(final String key, final boolean value) { map.put(key, (value ? Boolean.TRUE : Boolean.FALSE)); } - protected String getProtectedMapped(String key) { + protected String getProtectedMapped(final String key) { return (String) map.get(key); } - protected void setProtectedMapped(String key, String value) { + protected void setProtectedMapped(final String key, final String value) { map.put(key, value); } - public void setMappedPrimitive(int key, int value) { + public void setMappedPrimitive(final int key, final int value) { map.put(new Integer(key), new Integer(value)); } - public void setAnyMapped(MappedPropertyTestBean key, MappedPropertyTestBean value) { + public void setAnyMapped(final MappedPropertyTestBean key, final MappedPropertyTestBean value) { map.put(key, value); } - public void setMappedSetterOnly(String key, String value) { + public void setMappedSetterOnly(final String key, final String value) { map.put(key, value); } - public String getMappedGetterOnly(String key) { + public String getMappedGetterOnly(final String key) { return (String) map.get(key); } - public String getInvalidGetter(String key, String other) { + public String getInvalidGetter(final String key, final String other) { return (String) map.get(key); } public Map<Object, Object> getMyMap() { return myMap; } - public void setInvalidGetter(String key, String value) { + public void setInvalidGetter(final String key, final String value) { map.put(key, value); } - public String getInvalidSetter(String key) { + public String getInvalidSetter(final String key) { return (String) map.get(key); } - public void setInvalidSetter(String key, String value, String other) { + public void setInvalidSetter(final String key, final String value, final String other) { } - public Long getDifferentTypes(String key) { + public Long getDifferentTypes(final String key) { return new Long(((Number)map.get(key)).longValue()); } - public void setDifferentTypes(String key, Integer value) { + public void setDifferentTypes(final String key, final Integer value) { map.put(key, value); }
