Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanUtilsTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanUtilsTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanUtilsTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanUtilsTestCase.java Wed Oct 15 20:15:17 2014 @@ -114,7 +114,7 @@ public class BeanUtilsTestCase extends T * * @param name Name of the test case */ - public BeanUtilsTestCase(String name) { + public BeanUtilsTestCase(final String name) { super(name); } @@ -138,12 +138,12 @@ public class BeanUtilsTestCase extends T protected void setUpShared() { bean = new TestBean(); - DateConverter dateConverter = new DateConverter(null); + final DateConverter dateConverter = new DateConverter(null); dateConverter.setLocale(Locale.US); dateConverter.setPattern("dd.MM.yyyy"); ConvertUtils.register(dateConverter, java.util.Date.class); - ArrayConverter dateArrayConverter = + final ArrayConverter dateArrayConverter = new ArrayConverter(java.util.Date[].class, dateConverter, 0); ConvertUtils.register(dateArrayConverter, java.util.Date[].class); @@ -180,11 +180,11 @@ public class BeanUtilsTestCase extends T public void testCopyPropertiesDynaBean() { // Set up an origin bean with customized properties - DynaClass dynaClass = DynaBeanUtilsTestCase.createDynaClass(); + final DynaClass dynaClass = DynaBeanUtilsTestCase.createDynaClass(); DynaBean orig = null; try { orig = dynaClass.newInstance(); - } catch (Exception e) { + } catch (final Exception e) { fail("newInstance(): " + e); } orig.set("booleanProperty", Boolean.FALSE); @@ -202,7 +202,7 @@ public class BeanUtilsTestCase extends T // Copy the origin bean to our destination test bean try { BeanUtils.copyProperties(bean, orig); - } catch (Exception e) { + } catch (final Exception e) { fail("Threw exception: " + e); } @@ -231,19 +231,19 @@ public class BeanUtilsTestCase extends T bean.getStringProperty()); // Validate the results for array properties - String dupProperty[] = bean.getDupProperty(); + final String dupProperty[] = bean.getDupProperty(); assertNotNull("dupProperty present", dupProperty); assertEquals("dupProperty length", 3, dupProperty.length); assertEquals("dupProperty[0]", "New 0", dupProperty[0]); assertEquals("dupProperty[1]", "New 1", dupProperty[1]); assertEquals("dupProperty[2]", "New 2", dupProperty[2]); - int intArray[] = bean.getIntArray(); + final int intArray[] = bean.getIntArray(); assertNotNull("intArray present", intArray); assertEquals("intArray length", 3, intArray.length); assertEquals("intArray[0]", 100, intArray[0]); assertEquals("intArray[1]", 200, intArray[1]); assertEquals("intArray[2]", 300, intArray[2]); - String stringArray[] = bean.getStringArray(); + final String stringArray[] = bean.getStringArray(); assertNotNull("stringArray present", stringArray); assertEquals("stringArray length", 2, stringArray.length); assertEquals("stringArray[0]", "New 0", stringArray[0]); @@ -257,7 +257,7 @@ public class BeanUtilsTestCase extends T */ public void testCopyPropertiesMap() { - Map<String, Object> map = new HashMap<String, Object>(); + final Map<String, Object> map = new HashMap<String, Object>(); map.put("booleanProperty", "false"); map.put("byteProperty", "111"); map.put("doubleProperty", "333.0"); @@ -271,7 +271,7 @@ public class BeanUtilsTestCase extends T try { BeanUtils.copyProperties(bean, map); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t.toString()); } @@ -294,13 +294,13 @@ public class BeanUtilsTestCase extends T bean.getStringProperty()); // Indexed Properties - String dupProperty[] = bean.getDupProperty(); + final String dupProperty[] = bean.getDupProperty(); assertNotNull("dupProperty present", dupProperty); assertEquals("dupProperty length", 3, dupProperty.length); assertEquals("dupProperty[0]", "New 0", dupProperty[0]); assertEquals("dupProperty[1]", "New 1", dupProperty[1]); assertEquals("dupProperty[2]", "New 2", dupProperty[2]); - int intArray[] = bean.getIntArray(); + final int intArray[] = bean.getIntArray(); assertNotNull("intArray present", intArray); assertEquals("intArray length", 3, intArray.length); assertEquals("intArray[0]", 0, intArray[0]); @@ -316,7 +316,7 @@ public class BeanUtilsTestCase extends T public void testCopyPropertiesStandard() { // Set up an origin bean with customized properties - TestBean orig = new TestBean(); + final TestBean orig = new TestBean(); orig.setBooleanProperty(false); orig.setByteProperty((byte) 111); orig.setDoubleProperty(333.33); @@ -331,7 +331,7 @@ public class BeanUtilsTestCase extends T // Copy the origin bean to our destination test bean try { BeanUtils.copyProperties(bean, orig); - } catch (Exception e) { + } catch (final Exception e) { fail("Threw exception: " + e); } @@ -360,19 +360,19 @@ public class BeanUtilsTestCase extends T bean.getStringProperty()); // Validate the results for array properties - String dupProperty[] = bean.getDupProperty(); + final String dupProperty[] = bean.getDupProperty(); assertNotNull("dupProperty present", dupProperty); assertEquals("dupProperty length", 3, dupProperty.length); assertEquals("dupProperty[0]", "New 0", dupProperty[0]); assertEquals("dupProperty[1]", "New 1", dupProperty[1]); assertEquals("dupProperty[2]", "New 2", dupProperty[2]); - int intArray[] = bean.getIntArray(); + final int intArray[] = bean.getIntArray(); assertNotNull("intArray present", intArray); assertEquals("intArray length", 3, intArray.length); assertEquals("intArray[0]", 100, intArray[0]); assertEquals("intArray[1]", 200, intArray[1]); assertEquals("intArray[2]", 300, intArray[2]); - String stringArray[] = bean.getStringArray(); + final String stringArray[] = bean.getStringArray(); assertNotNull("stringArray present", stringArray); assertEquals("stringArray length", 2, stringArray.length); assertEquals("stringArray[0]", "New 0", stringArray[0]); @@ -389,7 +389,7 @@ public class BeanUtilsTestCase extends T Map<String, String> map = null; try { map = BeanUtils.describe(bean); - } catch (Exception e) { + } catch (final Exception e) { fail("Threw exception " + e); } @@ -436,13 +436,13 @@ public class BeanUtilsTestCase extends T public void testGetArrayProperty() { try { String arr[] = BeanUtils.getArrayProperty(bean, "stringArray"); - String comp[] = bean.getStringArray(); + final String comp[] = bean.getStringArray(); assertTrue("String array length = " + comp.length, (comp.length == arr.length)); arr = BeanUtils.getArrayProperty(bean, "intArray"); - int iarr[] = bean.getIntArray(); + final int iarr[] = bean.getIntArray(); assertTrue("String array length = " + iarr.length, (iarr.length == arr.length)); @@ -450,7 +450,7 @@ public class BeanUtilsTestCase extends T // Test property which isn't array or collection arr = BeanUtils.getArrayProperty(bean, "shortProperty"); - String shortAsString = "" + bean.getShortProperty(); + final String shortAsString = "" + bean.getShortProperty(); assertEquals("Short List Test lth", 1, arr.length); assertEquals("Short Test value", shortAsString, arr[0]); @@ -461,11 +461,11 @@ public class BeanUtilsTestCase extends T assertEquals("Delimited List Test lth", 1, arr.length); assertEquals("Delimited List Test value1", "ABC", arr[0]); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); - } catch (NoSuchMethodException e) { + } catch (final NoSuchMethodException e) { fail("NoSuchMethodException"); } @@ -479,7 +479,7 @@ public class BeanUtilsTestCase extends T try { bean.setDateArrayProperty(new java.util.Date[] {testUtilDate}); value = BeanUtils.getArrayProperty(bean, "dateArrayProperty"); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("java.util.Date[] --> String[] length", 1, value.length); @@ -498,11 +498,11 @@ public class BeanUtilsTestCase extends T val = BeanUtils.getIndexedProperty(bean, "stringIndexed[3]"); comp = bean.getStringIndexed(3); assertTrue("stringIndexed[3] == " + comp, val.equals(comp)); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); - } catch (NoSuchMethodException e) { + } catch (final NoSuchMethodException e) { fail("NoSuchMethodException"); } } @@ -515,7 +515,7 @@ public class BeanUtilsTestCase extends T try { bean.setDateArrayProperty(new java.util.Date[] {testUtilDate}); value = BeanUtils.getIndexedProperty(bean, "dateArrayProperty[0]"); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("java.util.Date[0] --> String", testUtilDate.toString(), value); @@ -536,11 +536,11 @@ public class BeanUtilsTestCase extends T assertTrue("stringIndexed,3 == " + comp, val.equals(comp)); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); - } catch (NoSuchMethodException e) { + } catch (final NoSuchMethodException e) { fail("NoSuchMethodException"); } } @@ -551,15 +551,15 @@ public class BeanUtilsTestCase extends T */ public void testGetNestedProperty() { try { - String val = BeanUtils.getNestedProperty(bean, "nested.stringProperty"); - String comp = bean.getNested().getStringProperty(); + final String val = BeanUtils.getNestedProperty(bean, "nested.stringProperty"); + final String comp = bean.getNested().getStringProperty(); assertTrue("nested.StringProperty == " + comp, val.equals(comp)); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); - } catch (NoSuchMethodException e) { + } catch (final NoSuchMethodException e) { fail("NoSuchMethodException"); } } @@ -570,16 +570,16 @@ public class BeanUtilsTestCase extends T */ public void testGetGeneralProperty() { try { - String val = BeanUtils.getProperty(bean, "nested.intIndexed[2]"); - String comp = String.valueOf(bean.getIntIndexed(2)); + final String val = BeanUtils.getProperty(bean, "nested.intIndexed[2]"); + final String comp = String.valueOf(bean.getIntIndexed(2)); assertTrue("nested.intIndexed[2] == " + comp, val.equals(comp)); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); - } catch (NoSuchMethodException e) { + } catch (final NoSuchMethodException e) { fail("NoSuchMethodException"); } } @@ -590,16 +590,16 @@ public class BeanUtilsTestCase extends T */ public void testGetSimpleProperty() { try { - String val = BeanUtils.getSimpleProperty(bean, "shortProperty"); - String comp = String.valueOf(bean.getShortProperty()); + final String val = BeanUtils.getSimpleProperty(bean, "shortProperty"); + final String comp = String.valueOf(bean.getShortProperty()); assertTrue("shortProperty == " + comp, val.equals(comp)); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); - } catch (NoSuchMethodException e) { + } catch (final NoSuchMethodException e) { fail("NoSuchMethodException"); } } @@ -612,7 +612,7 @@ public class BeanUtilsTestCase extends T try { bean.setDateProperty(testUtilDate); value = BeanUtils.getSimpleProperty(bean, "dateProperty"); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("java.util.Date --> String", testUtilDate.toString(), value); @@ -625,7 +625,7 @@ public class BeanUtilsTestCase extends T try { - HashMap<String, Object> map = new HashMap<String, Object>(); + final HashMap<String, Object> map = new HashMap<String, Object>(); map.put("intIndexed[0]", "100"); map.put("intIndexed[2]", "120"); map.put("intIndexed[4]", "140"); @@ -660,9 +660,9 @@ public class BeanUtilsTestCase extends T assertEquals("stringIndexed[4] is \"String 4\"", "String 4", bean.getStringIndexed(4)); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); } @@ -676,7 +676,7 @@ public class BeanUtilsTestCase extends T try { - HashMap<String, Object> map = new HashMap<String, Object>(); + final HashMap<String, Object> map = new HashMap<String, Object>(); int intArray[] = new int[] { 123, 456, 789 }; map.put("intArray", intArray); String stringArray[] = new String[] @@ -698,9 +698,9 @@ public class BeanUtilsTestCase extends T assertEquals("stringArray[0]", "New String 0", stringArray[0]); assertEquals("stringArray[1]", "New String 1", stringArray[1]); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); } @@ -714,7 +714,7 @@ public class BeanUtilsTestCase extends T try { - HashMap<String, Object> map = new HashMap<String, Object>(); + final HashMap<String, Object> map = new HashMap<String, Object>(); map.put("mappedProperty(First Key)", "New First Value"); map.put("mappedProperty(Third Key)", "New Third Value"); @@ -732,9 +732,9 @@ public class BeanUtilsTestCase extends T assertNull("mappedProperty(Fourth Key", bean.getMappedProperty("Fourth Key")); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); } @@ -748,7 +748,7 @@ public class BeanUtilsTestCase extends T try { - HashMap<String, Object> map = new HashMap<String, Object>(); + final HashMap<String, Object> map = new HashMap<String, Object>(); map.put("nested.booleanProperty", "false"); // booleanSecond is left at true map.put("nested.doubleProperty", "432.0"); @@ -786,9 +786,9 @@ public class BeanUtilsTestCase extends T "New writeOnlyProperty value", bean.getNested().getWriteOnlyPropertyValue()); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); } @@ -804,7 +804,7 @@ public class BeanUtilsTestCase extends T bean.setNullProperty("Non-null value"); - HashMap<String, Object> map = new HashMap<String, Object>(); + final HashMap<String, Object> map = new HashMap<String, Object>(); map.put("booleanProperty", "false"); // booleanSecond is left at true map.put("byteProperty", "111"); @@ -847,9 +847,9 @@ public class BeanUtilsTestCase extends T "Read Only String Property", bean.getReadOnlyProperty()); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { fail("IllegalAccessException"); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { fail("InvocationTargetException"); } @@ -937,7 +937,7 @@ public class BeanUtilsTestCase extends T public void testSetPropertyConvert() { try { BeanUtils.setProperty(bean, "dateProperty", testCalendar); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("Calendar --> java.util.Date", testUtilDate, bean.getDateProperty()); @@ -949,7 +949,7 @@ public class BeanUtilsTestCase extends T public void testSetPropertyConvertFromString() { try { BeanUtils.setProperty(bean, "dateProperty", testStringDate); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("String --> java.util.Date", testUtilDate, bean.getDateProperty()); @@ -961,7 +961,7 @@ public class BeanUtilsTestCase extends T public void testSetPropertyConvertToString() { try { BeanUtils.setProperty(bean, "stringProperty", testUtilDate); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("java.util.Date --> String", testUtilDate.toString(), bean.getStringProperty()); @@ -974,7 +974,7 @@ public class BeanUtilsTestCase extends T try { bean.setStringArray(null); BeanUtils.setProperty(bean, "stringArray", new java.util.Date[] {testUtilDate}); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("java.util.Date[] --> String[] length", 1, bean.getStringArray().length); @@ -988,7 +988,7 @@ public class BeanUtilsTestCase extends T try { bean.setStringArray(new String[1]); BeanUtils.setProperty(bean, "stringArray[0]", testUtilDate); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("java.util.Date --> String[]", testUtilDate.toString(), bean.getStringArray()[0]); @@ -1121,14 +1121,14 @@ public class BeanUtilsTestCase extends T */ public void testSetPropertyStringToArray() throws Exception { BeanUtils.setProperty(bean, "stringArray", "ABC,DEF,GHI"); - String[] strArray = bean.getStringArray(); + final String[] strArray = bean.getStringArray(); assertEquals("length", 3, strArray.length); assertEquals("value[0]", "ABC", strArray[0]); assertEquals("value[1]", "DEF", strArray[1]); assertEquals("value[2]", "GHI", strArray[2]); BeanUtils.setProperty(bean, "intArray", "0, 10, 20, 30, 40"); - int[] intArray = bean.getIntArray(); + final int[] intArray = bean.getIntArray(); assertEquals("length", 5, intArray.length); assertEquals("value[0]", 0, intArray[0]); assertEquals("value[1]", 10, intArray[1]); @@ -1164,7 +1164,7 @@ public class BeanUtilsTestCase extends T public void testCopyPropertyConvert() { try { BeanUtils.copyProperty(bean, "dateProperty", testCalendar); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("Calendar --> java.util.Date", testUtilDate, bean.getDateProperty()); @@ -1176,7 +1176,7 @@ public class BeanUtilsTestCase extends T public void testCopyPropertyConvertFromString() { try { BeanUtils.copyProperty(bean, "dateProperty", testStringDate); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("String --> java.util.Date", testUtilDate, bean.getDateProperty()); @@ -1188,7 +1188,7 @@ public class BeanUtilsTestCase extends T public void testCopyPropertyConvertToString() { try { BeanUtils.copyProperty(bean, "stringProperty", testUtilDate); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("java.util.Date --> String", testUtilDate.toString(), bean.getStringProperty()); @@ -1201,7 +1201,7 @@ public class BeanUtilsTestCase extends T try { bean.setStringArray(null); BeanUtils.copyProperty(bean, "stringArray", new java.util.Date[] {testUtilDate}); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("java.util.Date[] --> String[] length", 1, bean.getStringArray().length); @@ -1215,7 +1215,7 @@ public class BeanUtilsTestCase extends T try { bean.setStringArray(new String[1]); BeanUtils.copyProperty(bean, "stringArray[0]", testUtilDate); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t); } assertEquals("java.util.Date --> String[]", testUtilDate.toString(), bean.getStringArray()[0]); @@ -1332,10 +1332,10 @@ public class BeanUtilsTestCase extends T */ public void testCopyPropertyNestedIndexedArray() throws Exception { - int origArray[] = { 0, 10, 20, 30, 40 }; - int intArray[] = { 0, 0, 0 }; + final int origArray[] = { 0, 10, 20, 30, 40 }; + final int intArray[] = { 0, 0, 0 }; bean.getNested().setIntArray(intArray); - int intChanged[] = { 0, 0, 0 }; + final int intChanged[] = { 0, 0, 0 }; // No conversion required BeanUtils.copyProperty(bean, "nested.intArray[1]", new Integer(1)); @@ -1369,10 +1369,10 @@ public class BeanUtilsTestCase extends T */ public void testCopyPropertyNestedMappedMap() throws Exception { - Map<String, Object> origMap = new HashMap<String, Object>(); + final Map<String, Object> origMap = new HashMap<String, Object>(); origMap.put("First Key", "First Value"); origMap.put("Second Key", "Second Value"); - Map<String, Object> changedMap = new HashMap<String, Object>(); + final Map<String, Object> changedMap = new HashMap<String, Object>(); changedMap.put("First Key", "First Value"); changedMap.put("Second Key", "Second Value"); @@ -1475,8 +1475,8 @@ public class BeanUtilsTestCase extends T * Test setting a value out of a mapped Map */ public void testSetMappedMap() { - TestBean bean = new TestBean(); - Map<String, Object> map = new HashMap<String, Object>(); + final TestBean bean = new TestBean(); + final Map<String, Object> map = new HashMap<String, Object>(); map.put("sub-key-1", "sub-value-1"); map.put("sub-key-2", "sub-value-2"); map.put("sub-key-3", "sub-value-3"); @@ -1485,7 +1485,7 @@ public class BeanUtilsTestCase extends T assertEquals("BEFORE", "sub-value-3", ((Map<?, ?>)bean.getMapProperty().get("mappedMap")).get("sub-key-3")); try { BeanUtils.setProperty(bean, "mapProperty(mappedMap)(sub-key-3)", "SUB-KEY-3-UPDATED"); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Threw " + t + ""); } assertEquals("AFTER", "SUB-KEY-3-UPDATED", ((Map<?, ?>)bean.getMapProperty().get("mappedMap")).get("sub-key-3")); @@ -1493,15 +1493,15 @@ public class BeanUtilsTestCase extends T /** Tests that separate instances can register separate instances */ public void testSeparateInstances() throws Exception { - BeanUtilsBean utilsOne = new BeanUtilsBean( + final BeanUtilsBean utilsOne = new BeanUtilsBean( new ConvertUtilsBean(), new PropertyUtilsBean()); - BeanUtilsBean utilsTwo = new BeanUtilsBean( + final BeanUtilsBean utilsTwo = new BeanUtilsBean( new ConvertUtilsBean(), new PropertyUtilsBean()); - TestBean bean = new TestBean(); + final TestBean bean = new TestBean(); // Make sure what we're testing works bean.setBooleanProperty(false); @@ -1521,7 +1521,7 @@ public class BeanUtilsTestCase extends T utilsOne.setProperty(bean, "booleanProperty", "true"); fail("Registered conversion not used."); - } catch (PassTestException e) { /* Do nothing */ } + } catch (final PassTestException e) { /* Do nothing */ } // make sure that this conversion has no been registered in the other instance try { @@ -1530,20 +1530,20 @@ public class BeanUtilsTestCase extends T utilsTwo.setProperty(bean, "booleanProperty", "true"); assertEquals("Set property failed (3)", bean.getBooleanProperty(), true); - } catch (PassTestException e) { + } catch (final PassTestException e) { fail("Registed converter is used by other instances"); } } public void testArrayPropertyConversion() throws Exception { - BeanUtilsBean beanUtils = new BeanUtilsBean( + final BeanUtilsBean beanUtils = new BeanUtilsBean( new ConvertUtilsBean(), new PropertyUtilsBean()); - TestBean bean = new TestBean(); - String [] results = beanUtils.getArrayProperty(bean, "intArray"); + final TestBean bean = new TestBean(); + final String [] results = beanUtils.getArrayProperty(bean, "intArray"); - int[] values = bean.getIntArray(); + final int[] values = bean.getIntArray(); assertEquals( "Converted array size not equal to property array size.", results.length, @@ -1557,7 +1557,7 @@ public class BeanUtilsTestCase extends T } // Ensure that the actual int[] matches the expected int[] - protected void checkIntArray(int actual[], int expected[]) { + protected void checkIntArray(final int actual[], final int expected[]) { assertNotNull("actual array not null", actual); assertEquals("actual array length", expected.length, actual.length); for (int i = 0; i < actual.length; i++) { @@ -1568,19 +1568,19 @@ public class BeanUtilsTestCase extends T // Ensure that the actual Map matches the expected Map - protected void checkMap(Map<?, ?> actual, Map<?, ?> expected) { + protected void checkMap(final Map<?, ?> actual, final Map<?, ?> expected) { assertNotNull("actual map not null", actual); assertEquals("actual map size", expected.size(), actual.size()); - Iterator<?> keys = expected.keySet().iterator(); + final Iterator<?> keys = expected.keySet().iterator(); while (keys.hasNext()) { - Object key = keys.next(); + final Object key = keys.next(); assertEquals("actual map value(" + key + ")", expected.get(key), actual.get(key)); } } public void testMappedProperty() throws Exception { - MappedPropertyTestBean bean = new MappedPropertyTestBean(); + final MappedPropertyTestBean bean = new MappedPropertyTestBean(); BeanUtils.setProperty(bean, "mapproperty(this.that.the-other)", "some.dotty.value"); @@ -1597,18 +1597,18 @@ public class BeanUtilsTestCase extends T if (isPre14JVM()) { return; } - String parentMsg = "PARENT-THROWABLE"; - String causeMsg = "THROWABLE-CAUSE"; + final String parentMsg = "PARENT-THROWABLE"; + final String causeMsg = "THROWABLE-CAUSE"; try { initCauseAndThrowException(parentMsg, causeMsg); - } catch (Throwable thrownParent) { + } catch (final Throwable thrownParent) { assertEquals("Parent", parentMsg, thrownParent.getMessage()); try { assertEquals("Parent", parentMsg, thrownParent.getMessage()); - Throwable thrownCause = getCause(thrownParent); + final Throwable thrownCause = getCause(thrownParent); assertNotNull("Cause Null", thrownCause); assertEquals("Cause", causeMsg, thrownCause.getMessage()); - } catch (Throwable testError) { + } catch (final Throwable testError) { fail("If you're running JDK 1.3 then don't worry this should fail," + " if not then needs checking out: " + testError); } @@ -1618,18 +1618,18 @@ public class BeanUtilsTestCase extends T /** * Use reflection to get the cause */ - private Throwable getCause(Throwable t) throws Throwable { + private Throwable getCause(final Throwable t) throws Throwable { return (Throwable)PropertyUtils.getProperty(t, "cause"); } /** * Catch a cause, initialize using BeanUtils.initCause() and throw new exception */ - private void initCauseAndThrowException(String parent, String cause) throws Throwable { + private void initCauseAndThrowException(final String parent, final String cause) throws Throwable { try { throwException(cause); - } catch (Throwable e) { - Throwable t = new Exception(parent); + } catch (final Throwable e) { + final Throwable t = new Exception(parent); BeanUtils.initCause(t, e); throw t; } @@ -1638,7 +1638,7 @@ public class BeanUtilsTestCase extends T /** * Throw an exception with the specified message. */ - private void throwException(String msg) throws Throwable { + private void throwException(final String msg) throws Throwable { throw new Exception(msg); } @@ -1646,10 +1646,10 @@ public class BeanUtilsTestCase extends T * Test for JDK 1.4 */ public static boolean isPre14JVM() { - String version = System.getProperty("java.specification.version"); - StringTokenizer tokenizer = new StringTokenizer(version,"."); + final String version = System.getProperty("java.specification.version"); + final StringTokenizer tokenizer = new StringTokenizer(version,"."); if (tokenizer.nextToken().equals("1")) { - String minorVersion = tokenizer.nextToken(); + final String minorVersion = tokenizer.nextToken(); if (minorVersion.equals("0")) { return true; }
Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanWithInnerBean.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanWithInnerBean.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanWithInnerBean.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanWithInnerBean.java Wed Oct 15 20:15:17 2014 @@ -35,10 +35,10 @@ public class BeanWithInnerBean { public class InnerBean { private final Properties fish = new Properties(); - public String getFish(String key){ + public String getFish(final String key){ return fish.getProperty(key); } - public void setFish(String key, String value){ + public void setFish(final String key, final String value){ fish.setProperty(key, value); } } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java Wed Oct 15 20:15:17 2014 @@ -54,7 +54,7 @@ public class BeanificationTestCase exten * * @param name Name of the test case */ - public BeanificationTestCase(String name) { + public BeanificationTestCase(final String name) { super(name); } @@ -97,7 +97,7 @@ public class BeanificationTestCase exten // test methodology // many thanks to Juozas Baliuka for suggesting this method ClassLoader loader = new ClassLoader(this.getClass().getClassLoader()) {}; - WeakReference<ClassLoader> reference = new WeakReference<ClassLoader>(loader); + final WeakReference<ClassLoader> reference = new WeakReference<ClassLoader>(loader); @SuppressWarnings("unused") Class<?> myClass = loader.loadClass("org.apache.commons.beanutils.BetaBean"); @@ -120,6 +120,7 @@ public class BeanificationTestCase exten } else { // create garbage: @SuppressWarnings("unused") + final byte[] b = new byte[bytz]; bytz = bytz * 2; } @@ -137,13 +138,13 @@ public class BeanificationTestCase exten // many thanks to Juozas Baliuka for suggesting this methodology TestClassLoader loader = new TestClassLoader(); - ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); - WeakReference<ClassLoader> loaderReference = new WeakReference<ClassLoader>(loader, queue); + final ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); + final WeakReference<ClassLoader> loaderReference = new WeakReference<ClassLoader>(loader, queue); Integer test = new Integer(1); - WeakReference<Integer> testReference = new WeakReference<Integer>(test, queue); + final WeakReference<Integer> testReference = new WeakReference<Integer>(test, queue); //Map map = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.HARD, true); - Map<Object, Object> map = new WeakHashMap<Object, Object>(); + final Map<Object, Object> map = new WeakHashMap<Object, Object>(); map.put(loader, test); assertEquals("In map", test, map.get(loader)); @@ -171,6 +172,7 @@ public class BeanificationTestCase exten } else { // create garbage: @SuppressWarnings("unused") + final byte[] b = new byte[bytz]; bytz = bytz * 2; } @@ -186,7 +188,7 @@ public class BeanificationTestCase exten // many thanks to Juozas Baliuka for suggesting this methodology TestClassLoader loader = new TestClassLoader(); - WeakReference<ClassLoader> loaderReference = new WeakReference<ClassLoader>(loader); + final WeakReference<ClassLoader> loaderReference = new WeakReference<ClassLoader>(loader); BeanUtilsBean.getInstance(); class GetBeanUtilsBeanThread extends Thread { @@ -215,15 +217,16 @@ public class BeanificationTestCase exten GetBeanUtilsBeanThread thread = new GetBeanUtilsBeanThread(); @SuppressWarnings("unused") + final WeakReference<Thread> threadWeakReference = new WeakReference<Thread>(thread); thread.setContextClassLoader(loader); thread.start(); thread.join(); - WeakReference<BeanUtilsBean> beanUtilsReference = new WeakReference<BeanUtilsBean>(thread.beanUtils); - WeakReference<PropertyUtilsBean> propertyUtilsReference = new WeakReference<PropertyUtilsBean>(thread.propertyUtils); - WeakReference<ConvertUtilsBean> convertUtilsReference = new WeakReference<ConvertUtilsBean>(thread.convertUtils); + final WeakReference<BeanUtilsBean> beanUtilsReference = new WeakReference<BeanUtilsBean>(thread.beanUtils); + final WeakReference<PropertyUtilsBean> propertyUtilsReference = new WeakReference<PropertyUtilsBean>(thread.propertyUtils); + final WeakReference<ConvertUtilsBean> convertUtilsReference = new WeakReference<ConvertUtilsBean>(thread.convertUtils); assertNotNull("Weak reference released early (1)", loaderReference.get()); assertNotNull("Weak reference released early (2)", beanUtilsReference.get()); @@ -254,6 +257,7 @@ public class BeanificationTestCase exten } else { // create garbage: @SuppressWarnings("unused") + final byte[] b = new byte[bytz]; bytz = bytz * 2; } @@ -270,7 +274,7 @@ public class BeanificationTestCase exten private final Signal signal; - GetBeanUtilsBeanThread(Signal signal) { + GetBeanUtilsBeanThread(final Signal signal) { this.signal = signal; } @@ -288,10 +292,10 @@ public class BeanificationTestCase exten } } - Signal signal = new Signal(); + final Signal signal = new Signal(); signal.setSignal(1); - GetBeanUtilsBeanThread thread = new GetBeanUtilsBeanThread(signal); + final GetBeanUtilsBeanThread thread = new GetBeanUtilsBeanThread(signal); thread.setContextClassLoader(new TestClassLoader()); thread.start(); @@ -321,7 +325,7 @@ public class BeanificationTestCase exten private final Signal signal; private final ContextClassLoaderLocal<Integer> ccll; - CCLLTesterThread(Signal signal, ContextClassLoaderLocal<Integer> ccll) { + CCLLTesterThread(final Signal signal, final ContextClassLoaderLocal<Integer> ccll) { this.signal = signal; this.ccll = ccll; } @@ -339,14 +343,14 @@ public class BeanificationTestCase exten } } - ContextClassLoaderLocal<Integer> ccll = new ContextClassLoaderLocal<Integer>(); + final ContextClassLoaderLocal<Integer> ccll = new ContextClassLoaderLocal<Integer>(); ccll.set(new Integer(1776)); assertEquals("Start thread sets value", new Integer(1776), ccll.get()); - Signal signal = new Signal(); + final Signal signal = new Signal(); signal.setSignal(1); - CCLLTesterThread thread = new CCLLTesterThread(signal, ccll); + final CCLLTesterThread thread = new CCLLTesterThread(signal, ccll); thread.setContextClassLoader(new TestClassLoader()); thread.start(); @@ -364,7 +368,7 @@ public class BeanificationTestCase exten private final Signal signal; private final PrimitiveBean bean; - TestIndependenceThread(Signal signal, PrimitiveBean bean) { + TestIndependenceThread(final Signal signal, final PrimitiveBean bean) { this.signal = signal; this.bean = bean; } @@ -374,12 +378,12 @@ public class BeanificationTestCase exten try { signal.setSignal(3); ConvertUtils.register(new Converter() { - public <T> T convert(Class<T> type, Object value) { + public <T> T convert(final Class<T> type, final Object value) { return ConvertUtils.primitiveToWrapper(type).cast(new Integer(9)); } }, Integer.TYPE); BeanUtils.setProperty(bean, "int", new Integer(1)); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); signal.setException(e); } @@ -391,21 +395,21 @@ public class BeanificationTestCase exten } } - PrimitiveBean bean = new PrimitiveBean(); + final PrimitiveBean bean = new PrimitiveBean(); BeanUtils.setProperty(bean, "int", new Integer(1)); assertEquals("Wrong property value (1)", 1, bean.getInt()); ConvertUtils.register(new Converter() { - public <T> T convert(Class<T> type, Object value) { + public <T> T convert(final Class<T> type, final Object value) { return ConvertUtils.primitiveToWrapper(type).cast(new Integer(5)); } }, Integer.TYPE); BeanUtils.setProperty(bean, "int", new Integer(1)); assertEquals("Wrong property value(2)", 5, bean.getInt()); - Signal signal = new Signal(); + final Signal signal = new Signal(); signal.setSignal(1); - TestIndependenceThread thread = new TestIndependenceThread(signal, bean); + final TestIndependenceThread thread = new TestIndependenceThread(signal, bean); thread.setContextClassLoader(new TestClassLoader()); thread.start(); @@ -425,7 +429,7 @@ public class BeanificationTestCase exten private final Signal signal; private final BeanUtilsBean bean; - SetInstanceTesterThread(Signal signal, BeanUtilsBean bean) { + SetInstanceTesterThread(final Signal signal, final BeanUtilsBean bean) { this.signal = signal; this.bean = bean; } @@ -443,13 +447,13 @@ public class BeanificationTestCase exten } } - Signal signal = new Signal(); + final Signal signal = new Signal(); signal.setSignal(1); - BeanUtilsBean beanOne = new BeanUtilsBean(); - BeanUtilsBean beanTwo = new BeanUtilsBean(); + final BeanUtilsBean beanOne = new BeanUtilsBean(); + final BeanUtilsBean beanTwo = new BeanUtilsBean(); - SetInstanceTesterThread thread = new SetInstanceTesterThread(signal, beanTwo); + final SetInstanceTesterThread thread = new SetInstanceTesterThread(signal, beanTwo); thread.setContextClassLoader(new TestClassLoader()); BeanUtilsBean.setInstance(beanOne); @@ -465,8 +469,8 @@ public class BeanificationTestCase exten /** Tests whether the unset method works*/ public void testContextClassLoaderUnset() throws Exception { - BeanUtilsBean beanOne = new BeanUtilsBean(); - ContextClassLoaderLocal<BeanUtilsBean> ccll = new ContextClassLoaderLocal<BeanUtilsBean>(); + final BeanUtilsBean beanOne = new BeanUtilsBean(); + final ContextClassLoaderLocal<BeanUtilsBean> ccll = new ContextClassLoaderLocal<BeanUtilsBean>(); ccll.set(beanOne); assertEquals("Start thread gets right instance", beanOne, ccll.get()); ccll.unset(); @@ -494,7 +498,7 @@ public class BeanificationTestCase exten return e; } - public void setException(Exception e) { + public void setException(final Exception e) { this.e = e; } @@ -502,7 +506,7 @@ public class BeanificationTestCase exten return signal; } - public void setSignal(int signal) { + public void setSignal(final int signal) { this.signal = signal; } @@ -510,7 +514,7 @@ public class BeanificationTestCase exten return marker; } - public void setMarkerObject(Object marker) { + public void setMarkerObject(final Object marker) { this.marker = marker; } @@ -518,7 +522,7 @@ public class BeanificationTestCase exten return bean; } - public void setBean(BeanUtilsBean bean) { + public void setBean(final BeanUtilsBean bean) { this.bean = bean; } @@ -526,7 +530,7 @@ public class BeanificationTestCase exten return propertyUtils; } - public void setPropertyUtils(PropertyUtilsBean propertyUtils) { + public void setPropertyUtils(final PropertyUtilsBean propertyUtils) { this.propertyUtils = propertyUtils; } @@ -534,7 +538,7 @@ public class BeanificationTestCase exten return convertUtils; } - public void setConvertUtils(ConvertUtilsBean convertUtils) { + public void setConvertUtils(final ConvertUtilsBean convertUtils) { this.convertUtils = convertUtils; } } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BenchBean.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BenchBean.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BenchBean.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BenchBean.java Wed Oct 15 20:15:17 2014 @@ -40,7 +40,7 @@ public class BenchBean { return (booleanProperty); } - public void setBooleanProperty(boolean booleanProperty) { + public void setBooleanProperty(final boolean booleanProperty) { this.booleanProperty = booleanProperty; } @@ -54,7 +54,7 @@ public class BenchBean { return (this.byteProperty); } - public void setByteProperty(byte byteProperty) { + public void setByteProperty(final byte byteProperty) { this.byteProperty = byteProperty; } @@ -68,7 +68,7 @@ public class BenchBean { return (this.doubleProperty); } - public void setDoubleProperty(double doubleProperty) { + public void setDoubleProperty(final double doubleProperty) { this.doubleProperty = doubleProperty; } @@ -82,7 +82,7 @@ public class BenchBean { return (this.floatProperty); } - public void setFloatProperty(float floatProperty) { + public void setFloatProperty(final float floatProperty) { this.floatProperty = floatProperty; } @@ -96,7 +96,7 @@ public class BenchBean { return (this.intProperty); } - public void setIntProperty(int intProperty) { + public void setIntProperty(final int intProperty) { this.intProperty = intProperty; } @@ -110,7 +110,7 @@ public class BenchBean { return (this.longProperty); } - public void setLongProperty(long longProperty) { + public void setLongProperty(final long longProperty) { this.longProperty = longProperty; } @@ -124,7 +124,7 @@ public class BenchBean { return (this.shortProperty); } - public void setShortProperty(short shortProperty) { + public void setShortProperty(final short shortProperty) { this.shortProperty = shortProperty; } @@ -138,7 +138,7 @@ public class BenchBean { return (this.stringProperty); } - public void setStringProperty(String stringProperty) { + public void setStringProperty(final String stringProperty) { this.stringProperty = stringProperty; } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BetaBean.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BetaBean.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BetaBean.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BetaBean.java Wed Oct 15 20:15:17 2014 @@ -28,15 +28,15 @@ public class BetaBean extends AbstractCh return secret; } - public void setNoGetterProperty(String secret) { + public void setNoGetterProperty(final String secret) { this.secret = secret; } - public void setNoGetterMappedProperty(String secret, String key) { + public void setNoGetterMappedProperty(final String secret, final String key) { this.secret = "MAP:" + secret; } - public BetaBean(String name) { + public BetaBean(final String name) { setName(name); } } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ConstructorUtilsTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ConstructorUtilsTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ConstructorUtilsTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ConstructorUtilsTestCase.java Wed Oct 15 20:15:17 2014 @@ -41,7 +41,7 @@ public class ConstructorUtilsTestCase ex * * @param name Name of the test case */ - public ConstructorUtilsTestCase(String name) { + public ConstructorUtilsTestCase(final String name) { super(name); } @@ -78,13 +78,13 @@ public class ConstructorUtilsTestCase ex public void testInvokeConstructor() throws Exception { { - Object obj = ConstructorUtils.invokeConstructor(TestBean.class,"TEST"); + final Object obj = ConstructorUtils.invokeConstructor(TestBean.class,"TEST"); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals("TEST",((TestBean)obj).getStringProperty()); } { - Object obj = ConstructorUtils.invokeConstructor(TestBean.class,new Float(17.3f)); + final Object obj = ConstructorUtils.invokeConstructor(TestBean.class,new Float(17.3f)); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals(17.3f,((TestBean)obj).getFloatProperty(),0.0f); @@ -92,14 +92,14 @@ public class ConstructorUtilsTestCase ex } public void testInvokeConstructorNull() throws Exception { - Object obj = ConstructorUtils.invokeConstructor(TestBean.class, (Object) null); + final Object obj = ConstructorUtils.invokeConstructor(TestBean.class, (Object) null); assertNotNull(obj); assertTrue(obj instanceof TestBean); } public void testInvokeConstructorWithArgArray() throws Exception { - Object[] args = { new Float(17.3f), "TEST" }; - Object obj = ConstructorUtils.invokeConstructor(TestBean.class,args); + final Object[] args = { new Float(17.3f), "TEST" }; + final Object obj = ConstructorUtils.invokeConstructor(TestBean.class,args); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals(17.3f,((TestBean)obj).getFloatProperty(),0.0f); @@ -108,18 +108,18 @@ public class ConstructorUtilsTestCase ex public void testInvokeConstructorWithTypeArray() throws Exception { { - Object[] args = { Boolean.TRUE, "TEST" }; - Class<?>[] types = { Boolean.TYPE, String.class }; - Object obj = ConstructorUtils.invokeConstructor(TestBean.class,args,types); + final Object[] args = { Boolean.TRUE, "TEST" }; + final Class<?>[] types = { Boolean.TYPE, String.class }; + final Object obj = ConstructorUtils.invokeConstructor(TestBean.class,args,types); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals(true,((TestBean)obj).getBooleanProperty()); assertEquals("TEST",((TestBean)obj).getStringProperty()); } { - Object[] args = { Boolean.TRUE, "TEST" }; - Class<?>[] types = { Boolean.class, String.class }; - Object obj = ConstructorUtils.invokeConstructor(TestBean.class,args,types); + final Object[] args = { Boolean.TRUE, "TEST" }; + final Class<?>[] types = { Boolean.class, String.class }; + final Object obj = ConstructorUtils.invokeConstructor(TestBean.class,args,types); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals(true,((TestBean)obj).isBooleanSecond()); @@ -129,7 +129,7 @@ public class ConstructorUtilsTestCase ex public void testInvokeExactConstructor() throws Exception { { - Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,"TEST"); + final Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,"TEST"); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals("TEST",((TestBean)obj).getStringProperty()); @@ -138,12 +138,12 @@ public class ConstructorUtilsTestCase ex try { ConstructorUtils.invokeExactConstructor(TestBean.class,new Float(17.3f)); fail("Expected NoSuchMethodException"); - } catch(NoSuchMethodException e) { + } catch(final NoSuchMethodException e) { // expected } } { - Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,Boolean.TRUE); + final Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,Boolean.TRUE); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals(true,((TestBean)obj).isBooleanSecond()); @@ -151,24 +151,24 @@ public class ConstructorUtilsTestCase ex } public void testInvokeExactConstructorWithNull() throws Exception { - Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class, (Object) null); + final Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class, (Object) null); assertNotNull(obj); assertTrue(obj instanceof TestBean); } public void testInvokeExactConstructorWithArgArray() throws Exception { { - Object[] args = { new Float(17.3f), "TEST" }; + final Object[] args = { new Float(17.3f), "TEST" }; try { ConstructorUtils.invokeExactConstructor(TestBean.class,args); fail("Expected NoSuchMethodException"); - } catch(NoSuchMethodException e) { + } catch(final NoSuchMethodException e) { // expected } } { - Object[] args = { Boolean.TRUE, "TEST" }; - Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,args); + final Object[] args = { Boolean.TRUE, "TEST" }; + final Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,args); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals(true,((TestBean)obj).isBooleanSecond()); @@ -178,39 +178,39 @@ public class ConstructorUtilsTestCase ex public void testInvokeExactConstructorWithTypeArray() throws Exception { { - Object[] args = { Boolean.TRUE, "TEST" }; - Class<?>[] types = { Boolean.TYPE, String.class }; - Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,args,types); + final Object[] args = { Boolean.TRUE, "TEST" }; + final Class<?>[] types = { Boolean.TYPE, String.class }; + final Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,args,types); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals(true,((TestBean)obj).getBooleanProperty()); assertEquals("TEST",((TestBean)obj).getStringProperty()); } { - Object[] args = { Boolean.TRUE, "TEST" }; - Class<?>[] types = { Boolean.class, String.class }; - Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,args,types); + final Object[] args = { Boolean.TRUE, "TEST" }; + final Class<?>[] types = { Boolean.class, String.class }; + final Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,args,types); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals(true,((TestBean)obj).isBooleanSecond()); assertEquals("TEST",((TestBean)obj).getStringProperty()); } { - Object[] args = { new Float(17.3f), "TEST" }; - Class<?>[] types = { Float.TYPE, String.class }; - Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,args,types); + final Object[] args = { new Float(17.3f), "TEST" }; + final Class<?>[] types = { Float.TYPE, String.class }; + final Object obj = ConstructorUtils.invokeExactConstructor(TestBean.class,args,types); assertNotNull(obj); assertTrue(obj instanceof TestBean); assertEquals(17.3f,((TestBean)obj).getFloatProperty(),0.0f); assertEquals("TEST",((TestBean)obj).getStringProperty()); } { - Object[] args = { new Float(17.3f), "TEST" }; - Class<?>[] types = { Float.class, String.class }; + final Object[] args = { new Float(17.3f), "TEST" }; + final Class<?>[] types = { Float.class, String.class }; try { ConstructorUtils.invokeExactConstructor(TestBean.class,args,types); fail("Expected NoSuchMethodException"); - } catch(NoSuchMethodException e) { + } catch(final NoSuchMethodException e) { // expected } } @@ -218,54 +218,54 @@ public class ConstructorUtilsTestCase ex public void testGetAccessibleConstructor() throws Exception { { - Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(TestBean.class,String.class); + final Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(TestBean.class,String.class); assertNotNull(ctor); assertTrue(Modifier.isPublic(ctor.getModifiers())); } { - Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(TestBean.class,Integer.class); + final Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(TestBean.class,Integer.class); assertNotNull(ctor); assertTrue(Modifier.isPublic(ctor.getModifiers())); } { - Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(TestBean.class,Integer.TYPE); + final Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(TestBean.class,Integer.TYPE); assertNull(ctor); } } public void testGetAccessibleConstructorWithTypeArray() throws Exception { { - Class<?>[] types = { Boolean.TYPE, String.class }; - Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(TestBean.class,types); + final Class<?>[] types = { Boolean.TYPE, String.class }; + final Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(TestBean.class,types); assertNotNull(ctor); assertTrue(Modifier.isPublic(ctor.getModifiers())); } { - Class<?>[] types = { Boolean.TYPE, Boolean.TYPE, String.class }; - Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(TestBean.class,types); + final Class<?>[] types = { Boolean.TYPE, Boolean.TYPE, String.class }; + final Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(TestBean.class,types); assertNull(ctor); } } public void testGetAccessibleConstructorWithConstructorArg() throws Exception { { - Class<?>[] types = { Integer.class }; - Constructor<?> c1 = TestBean.class.getConstructor(types); - Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(c1); + final Class<?>[] types = { Integer.class }; + final Constructor<?> c1 = TestBean.class.getConstructor(types); + final Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(c1); assertNotNull(ctor); assertTrue(Modifier.isPublic(ctor.getModifiers())); } { - Class<?>[] types = { Integer.class }; - Constructor<?> c1 = TestBean.class.getDeclaredConstructor(types); - Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(c1); + final Class<?>[] types = { Integer.class }; + final Constructor<?> c1 = TestBean.class.getDeclaredConstructor(types); + final Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(c1); assertNotNull(ctor); assertTrue(Modifier.isPublic(ctor.getModifiers())); } { - Class<?>[] types = { Integer.TYPE }; - Constructor<?> c1 = TestBean.class.getDeclaredConstructor(types); - Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(c1); + final Class<?>[] types = { Integer.TYPE }; + final Constructor<?> c1 = TestBean.class.getDeclaredConstructor(types); + final Constructor<?> ctor = ConstructorUtils.getAccessibleConstructor(c1); assertNull(ctor); } } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ConvertUtilsTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ConvertUtilsTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ConvertUtilsTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/ConvertUtilsTestCase.java Wed Oct 15 20:15:17 2014 @@ -53,7 +53,7 @@ public class ConvertUtilsTestCase extend * * @param name Name of the test case */ - public ConvertUtilsTestCase(String name) { + public ConvertUtilsTestCase(final String name) { super(name); } @@ -98,7 +98,7 @@ public class ConvertUtilsTestCase extend public void testNegativeIntegerArray() { Object value = null; - int intArray[] = new int[0]; + final int intArray[] = new int[0]; value = ConvertUtils.convert((String) null, intArray.getClass()); checkIntegerArray(value, intArray); @@ -147,7 +147,7 @@ public class ConvertUtilsTestCase extend value = ConvertUtils.convert ("org.apache.commons.beanutils.Undefined", Class.class); fail("Should have thrown conversion exception"); - } catch (ConversionException e) { + } catch (final ConversionException e) { // Expected result } @@ -203,7 +203,7 @@ public class ConvertUtilsTestCase extend public void testNegativeStringArray() { Object value = null; - String stringArray[] = new String[0]; + final String stringArray[] = new String[0]; value = ConvertUtils.convert((String) null, stringArray.getClass()); checkStringArray(value, stringArray); @@ -216,12 +216,12 @@ public class ConvertUtilsTestCase extend */ public void testObjectToStringArray() { - int intArray0[] = new int[0]; - int intArray1[] = { 123 }; - int intArray2[] = { 123, 456 }; - String stringArray0[] = new String[0]; - String stringArray1[] = { "abc" }; - String stringArray2[] = { "abc", "def" }; + final int intArray0[] = new int[0]; + final int intArray1[] = { 123 }; + final int intArray2[] = { 123, 456 }; + final String stringArray0[] = new String[0]; + final String stringArray1[] = { "abc" }; + final String stringArray2[] = { "abc", "def" }; assertEquals("intArray0", null, ConvertUtils.convert(intArray0)); @@ -276,19 +276,19 @@ public class ConvertUtilsTestCase extend */ public void testPositiveArray() { - String values1[] = { "10", "20", "30" }; + final String values1[] = { "10", "20", "30" }; Object value = ConvertUtils.convert(values1, Integer.TYPE); - int shape[] = new int[0]; + final int shape[] = new int[0]; assertEquals(shape.getClass(), value.getClass()); - int results1[] = (int[]) value; + final int results1[] = (int[]) value; assertEquals(results1[0], 10); assertEquals(results1[1], 20); assertEquals(results1[2], 30); - String values2[] = { "100", "200", "300" }; + final String values2[] = { "100", "200", "300" }; value = ConvertUtils.convert(values2, shape.getClass()); assertEquals(shape.getClass(), value.getClass()); - int results2[] = (int[]) value; + final int results2[] = (int[]) value; assertEquals(results2[0], 100); assertEquals(results2[1], 200); assertEquals(results2[2], 300); @@ -302,9 +302,9 @@ public class ConvertUtilsTestCase extend public void testPositiveIntegerArray() { Object value = null; - int intArray[] = new int[0]; - int intArray1[] = new int[] { 0 }; - int intArray2[] = new int[] { 0, 10 }; + final int intArray[] = new int[0]; + final int intArray1[] = new int[] { 0 }; + final int intArray2[] = new int[] { 0, 10 }; value = ConvertUtils.convert("{ }", intArray.getClass()); checkIntegerArray(value, intArray); @@ -491,10 +491,10 @@ public class ConvertUtilsTestCase extend public void testPositiveStringArray() { Object value = null; - String stringArray[] = new String[0]; - String stringArray1[] = new String[] + final String stringArray[] = new String[0]; + final String stringArray1[] = new String[] { "abc" }; - String stringArray2[] = new String[] + final String stringArray2[] = new String[] { "abc", "de,f" }; value = ConvertUtils.convert("", stringArray.getClass()); @@ -542,8 +542,8 @@ public class ConvertUtilsTestCase extend } public void testSeparateConvertInstances() throws Exception { - ConvertUtilsBean utilsOne = new ConvertUtilsBean(); - ConvertUtilsBean utilsTwo = new ConvertUtilsBean(); + final ConvertUtilsBean utilsOne = new ConvertUtilsBean(); + final ConvertUtilsBean utilsTwo = new ConvertUtilsBean(); // make sure that the test work ok before anything's changed Object @@ -569,7 +569,7 @@ public class ConvertUtilsTestCase extend utilsOne.convert("true", Boolean.TYPE); fail("Register converter failed."); - } catch (PassTestException e) { /* This shows that the registration has worked */ } + } catch (final PassTestException e) { /* This shows that the registration has worked */ } try { // nothing should have changed @@ -580,7 +580,7 @@ public class ConvertUtilsTestCase extend ((Boolean) value).booleanValue(), true); - } catch (PassTestException e) { + } catch (final PassTestException e) { // This is a failure since utilsTwo should still have // standard converters registered fail("Registering a converter for an instance should not effect another instance."); @@ -602,7 +602,7 @@ public class ConvertUtilsTestCase extend public void testDeregisteringSingleConverter() throws Exception { // make sure that the test work ok before anything's changed - Object + final Object value = ConvertUtils.convert("true", Boolean.TYPE); assertTrue(value instanceof Boolean); assertEquals( @@ -619,29 +619,29 @@ public class ConvertUtilsTestCase extend @SuppressWarnings({ "unchecked", "rawtypes" }) // We need to use raw types in order to test legacy converters public void testConvertToString() throws Exception { - Converter dummyConverter = new Converter() { - public Object convert(Class type, Object value) { + final Converter dummyConverter = new Converter() { + public Object convert(final Class type, final Object value) { return value; } }; - Converter fooConverter = new Converter() { - public Object convert(Class type, Object value) { + final Converter fooConverter = new Converter() { + public Object convert(final Class type, final Object value) { return "Foo-Converter"; } }; - DateConverter dateConverter = new DateConverter(); + final DateConverter dateConverter = new DateConverter(); dateConverter.setLocale(Locale.US); - ConvertUtilsBean utils = new ConvertUtilsBean(); + final ConvertUtilsBean utils = new ConvertUtilsBean(); utils.register(dateConverter, java.util.Date.class); utils.register(fooConverter, String.class); // Convert using registerd DateConverter - java.util.Date today = new java.util.Date(); - DateFormat fmt = new SimpleDateFormat("M/d/yy"); /* US Short Format */ - String expected = fmt.format(today); + final java.util.Date today = new java.util.Date(); + final DateFormat fmt = new SimpleDateFormat("M/d/yy"); /* US Short Format */ + final String expected = fmt.format(today); assertEquals("DateConverter M/d/yy", expected, utils.convert(today, String.class)); // Date converter doesn't do String conversion - use String Converter @@ -666,8 +666,8 @@ public class ConvertUtilsTestCase extend * Tests a conversion to an unsupported target type. */ public void testConvertUnsupportedTargetType() { - ConvertUtilsBean utils = new ConvertUtilsBean(); - Object value = "A test value"; + final ConvertUtilsBean utils = new ConvertUtilsBean(); + final Object value = "A test value"; assertSame("Got different object", value, utils.convert(value, getClass())); } @@ -675,12 +675,12 @@ public class ConvertUtilsTestCase extend // -------------------------------------------------------- Private Methods - private void checkIntegerArray(Object value, int intArray[]) { + private void checkIntegerArray(final Object value, final int intArray[]) { assertNotNull("Returned value is not null", value); assertEquals("Returned value is int[]", intArray.getClass(), value.getClass()); - int results[] = (int[]) value; + final int results[] = (int[]) value; assertEquals("Returned array length", intArray.length, results.length); for (int i = 0; i < intArray.length; i++) { assertEquals("Returned array value " + i, @@ -690,12 +690,12 @@ public class ConvertUtilsTestCase extend } - private void checkStringArray(Object value, String stringArray[]) { + private void checkStringArray(final Object value, final String stringArray[]) { assertNotNull("Returned value is not null", value); assertEquals("Returned value is String[]", stringArray.getClass(), value.getClass()); - String results[] = (String[]) value; + final String results[] = (String[]) value; assertEquals("Returned array length", stringArray.length, results.length); for (int i = 0; i < stringArray.length; i++) { Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DefaultIntrospectionContextTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DefaultIntrospectionContextTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DefaultIntrospectionContextTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DefaultIntrospectionContextTestCase.java Wed Oct 15 20:15:17 2014 @@ -47,11 +47,11 @@ public class DefaultIntrospectionContext * @param propName the property name * @return the descriptor for this property */ - private static PropertyDescriptor createDescriptor(String propName) { + private static PropertyDescriptor createDescriptor(final String propName) { try { return new PropertyDescriptor(propName, DefaultIntrospectionContextTestCase.class, null, null); - } catch (IntrospectionException e) { + } catch (final IntrospectionException e) { throw new IllegalStateException("Unexpected exception: " + e); } } @@ -69,7 +69,7 @@ public class DefaultIntrospectionContext * Tests whether a property descriptor can be added. */ public void testAddPropertyDescriptor() { - PropertyDescriptor desc = createDescriptor(PROP); + final PropertyDescriptor desc = createDescriptor(PROP); context.addPropertyDescriptor(desc); assertTrue("Property not found", context.hasProperty(PROP)); assertSame("Wrong descriptor", desc, @@ -83,7 +83,7 @@ public class DefaultIntrospectionContext try { context.addPropertyDescriptor(null); fail("Could add null descriptor!"); - } catch (IllegalArgumentException iex) { + } catch (final IllegalArgumentException iex) { // ok } } @@ -93,27 +93,27 @@ public class DefaultIntrospectionContext */ public void testAddPropertyDescriptors() { final int count = 4; - PropertyDescriptor[] descs = new PropertyDescriptor[count]; - Set<PropertyDescriptor> descSet = new HashSet<PropertyDescriptor>(); + final PropertyDescriptor[] descs = new PropertyDescriptor[count]; + final Set<PropertyDescriptor> descSet = new HashSet<PropertyDescriptor>(); for (int i = 0; i < count; i++) { descs[i] = createDescriptor(PROP + i); descSet.add(descs[i]); } context.addPropertyDescriptors(descs); - PropertyDescriptor d = createDescriptor(PROP); + final PropertyDescriptor d = createDescriptor(PROP); context.addPropertyDescriptor(d); descSet.add(d); - Set<String> names = context.propertyNames(); + final Set<String> names = context.propertyNames(); assertEquals("Wrong number of property names", count + 1, names.size()); assertTrue("Property not found: " + PROP, names.contains(PROP)); for (int i = 0; i < count; i++) { assertTrue("Property not found: " + (PROP + i), names.contains(PROP + i)); } - PropertyDescriptor[] addedDescs = context.getPropertyDescriptors(); + final PropertyDescriptor[] addedDescs = context.getPropertyDescriptors(); assertEquals("Wrong number of added descriptors", count + 1, addedDescs.length); - for (PropertyDescriptor pd : addedDescs) { + for (final PropertyDescriptor pd : addedDescs) { assertTrue("Unexpected descriptor: " + pd, descSet.remove(pd)); } } @@ -125,7 +125,7 @@ public class DefaultIntrospectionContext try { context.addPropertyDescriptors(null); fail("Could add a null array with descriptors!"); - } catch (IllegalArgumentException iex) { + } catch (final IllegalArgumentException iex) { // ok } } @@ -152,11 +152,11 @@ public class DefaultIntrospectionContext * Tests that the set with property names cannot be changed. */ public void testPropertyNamesModify() { - Set<String> names = context.propertyNames(); + final Set<String> names = context.propertyNames(); try { names.add(PROP); fail("Could modify property names set!"); - } catch (UnsupportedOperationException uex) { + } catch (final UnsupportedOperationException uex) { // ok } } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaBeanMapDecoratorTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaBeanMapDecoratorTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaBeanMapDecoratorTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/DynaBeanMapDecoratorTestCase.java Wed Oct 15 20:15:17 2014 @@ -65,7 +65,7 @@ public class DynaBeanMapDecoratorTestCas * * @param name Name of the test case */ - public DynaBeanMapDecoratorTestCase(String name) { + public DynaBeanMapDecoratorTestCase(final String name) { super(name); } @@ -74,7 +74,7 @@ public class DynaBeanMapDecoratorTestCas /** * Run thus Test */ - public static void main(String[] args) { + public static void main(final String[] args) { junit.textui.TestRunner.run(suite()); } @@ -134,13 +134,13 @@ public class DynaBeanMapDecoratorTestCas try { decoratedMap.clear(); fail("decoratedMap.clear()"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } try { modifiableMap.clear(); fail("modifiableMap.clear()"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } } @@ -165,28 +165,28 @@ public class DynaBeanMapDecoratorTestCas * Test entrySet() method */ public void testEntrySet() { - Set<Map.Entry<Object, Object>> set = modifiableMap.entrySet(); + final Set<Map.Entry<Object, Object>> set = modifiableMap.entrySet(); // Check the Set can't be modified - Map<Object, Object> m = new HashMap<Object, Object>(); + final Map<Object, Object> m = new HashMap<Object, Object>(); m.put("key", "value"); checkUnmodifiable("entrySet()", set, m.entrySet().iterator().next()); assertEquals("entrySet size", properties.length, set.size()); - Iterator<Map.Entry<Object, Object>> iterator = set.iterator(); - List<String> namesList = new ArrayList<String>(); + final Iterator<Map.Entry<Object, Object>> iterator = set.iterator(); + final List<String> namesList = new ArrayList<String>(); int i = 0; while (iterator.hasNext()) { - Map.Entry<Object, Object> entry = iterator.next(); - String name = (String)entry.getKey(); + final Map.Entry<Object, Object> entry = iterator.next(); + final String name = (String)entry.getKey(); namesList.add(name); - Object expectValue = decoratedMap.get(name); + final Object expectValue = decoratedMap.get(name); assertEquals("entrySet("+i+") val", expectValue, entry.getValue()); i++; } for (int j = 0; j < properties.length; j++) { - String name = properties[j].getName(); + final String name = properties[j].getName(); assertTrue("Check property[" + j + "]", namesList.contains(name)); } } @@ -203,7 +203,7 @@ public class DynaBeanMapDecoratorTestCas try { decoratedMap.get("xyz"); fail("decoratedMap invalid"); - } catch(IllegalArgumentException ignore) { + } catch(final IllegalArgumentException ignore) { // expected result } } @@ -220,7 +220,7 @@ public class DynaBeanMapDecoratorTestCas * Test keySet() method */ public void testKeySet() { - Set<Object> set = modifiableMap.keySet(); + final Set<Object> set = modifiableMap.keySet(); // Check the Set can't be modified checkUnmodifiable("keySet()", set, "xyz"); @@ -228,7 +228,7 @@ public class DynaBeanMapDecoratorTestCas assertEquals("keySet size", properties.length, set.size()); for (int i = 0; i < properties.length; i++) { - String name = properties[i].getName(); + final String name = properties[i].getName(); assertTrue("Check property[" + i + "]", set.contains(name)); } } @@ -238,13 +238,13 @@ public class DynaBeanMapDecoratorTestCas */ public void testPut() { - String newValue = "ABC"; + final String newValue = "ABC"; // Test read only try { decoratedMap.put(stringProp.getName(), newValue); fail("Not read only"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } @@ -259,15 +259,15 @@ public class DynaBeanMapDecoratorTestCas */ public void testPutAll() { - String newValue = "ABC"; - Map<Object, Object> newMap = new HashMap<Object, Object>(); + final String newValue = "ABC"; + final Map<Object, Object> newMap = new HashMap<Object, Object>(); newMap.put(stringProp.getName(), newValue); // Test read only try { decoratedMap.putAll(newMap); fail("Not read only"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } @@ -284,13 +284,13 @@ public class DynaBeanMapDecoratorTestCas try { decoratedMap.remove(stringProp.getName()); fail("decoratedMap.remove()"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } try { modifiableMap.remove(stringProp.getName()); fail("modifiableMap.remove()"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } } @@ -307,7 +307,7 @@ public class DynaBeanMapDecoratorTestCas * Test values() method */ public void testValues() { - Collection<Object> collection = modifiableMap.values(); + final Collection<Object> collection = modifiableMap.values(); // Check the Collection can't be modified checkUnmodifiable("values()", collection, "xyz"); @@ -315,7 +315,7 @@ public class DynaBeanMapDecoratorTestCas assertEquals("values size", values.length, collection.size()); // Collection should be ordered in same sequence as properties - Iterator<Object> iterator = collection.iterator(); + final Iterator<Object> iterator = collection.iterator(); int i = 0; while (iterator.hasNext()) { assertEquals("values("+i+")", values[i], iterator.next()); @@ -326,22 +326,22 @@ public class DynaBeanMapDecoratorTestCas /** * Check that a Collection is not modifiable */ - private <E> void checkUnmodifiable(String desc, Collection<E> collection, E addElem) { + private <E> void checkUnmodifiable(final String desc, final Collection<E> collection, final E addElem) { // Check can't add() try { collection.add(addElem); fail(desc + ".add()"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } // Check can't addAll() - List<E> list = new ArrayList<E>(1); + final List<E> list = new ArrayList<E>(1); list.add(addElem); try { collection.addAll(list); fail(desc + ".addAll()"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } @@ -349,7 +349,7 @@ public class DynaBeanMapDecoratorTestCas try { collection.clear(); fail(desc + ".clear()"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } @@ -357,7 +357,7 @@ public class DynaBeanMapDecoratorTestCas try { collection.remove("abc"); fail(desc + ".remove()"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } @@ -365,7 +365,7 @@ public class DynaBeanMapDecoratorTestCas try { collection.removeAll(list); fail(desc + ".removeAll()"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } @@ -373,7 +373,7 @@ public class DynaBeanMapDecoratorTestCas try { collection.retainAll(list); fail(desc + ".retainAll()"); - } catch(UnsupportedOperationException ignore) { + } catch(final UnsupportedOperationException ignore) { // expected result } }
