Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MappedPropertyTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MappedPropertyTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MappedPropertyTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MappedPropertyTestCase.java Wed Oct 15 20:15:17 2014 @@ -34,7 +34,7 @@ public class MappedPropertyTestCase exte * * @param name Name of the test case */ - public MappedPropertyTestCase(String name) { + public MappedPropertyTestCase(final String name) { super(name); } @@ -43,7 +43,7 @@ public class MappedPropertyTestCase exte /** * Run this Test */ - public static void main(String[] args) { + public static void main(final String[] args) { junit.textui.TestRunner.run(suite()); } @@ -74,14 +74,14 @@ public class MappedPropertyTestCase exte * Test valid method name */ public void testFound() { - String property = "mapproperty"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "mapproperty"; + final Class<?> clazz = MappedPropertyTestBean.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNotNull("Getter is missing", desc.getMappedReadMethod()); assertNotNull("Setter is missing", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -90,14 +90,14 @@ public class MappedPropertyTestCase exte * Test boolean "is" method name */ public void testBooleanMapped() { - String property = "mappedBoolean"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "mappedBoolean"; + final Class<?> clazz = MappedPropertyTestBean.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNotNull("Getter is missing", desc.getMappedReadMethod()); assertNotNull("Setter is missing", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -106,12 +106,12 @@ public class MappedPropertyTestCase exte * Test invalid method name */ public void testNotFound() { - String property = "xxxxxxx"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "xxxxxxx"; + final Class<?> clazz = MappedPropertyTestBean.class; try { new MappedPropertyDescriptor(property, clazz); fail("Property '" + property + "' found in " + clazz.getName()); - } catch (Exception ex) { + } catch (final Exception ex) { // expected result } } @@ -120,14 +120,14 @@ public class MappedPropertyTestCase exte * Test Mapped Property - Getter only */ public void testMappedGetterOnly() { - String property = "mappedGetterOnly"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "mappedGetterOnly"; + final Class<?> clazz = MappedPropertyTestBean.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNotNull("Getter is missing", desc.getMappedReadMethod()); assertNull("Setter is found", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -136,14 +136,14 @@ public class MappedPropertyTestCase exte * Test Mapped Property - Setter Only */ public void testMappedSetterOnly() { - String property = "mappedSetterOnly"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "mappedSetterOnly"; + final Class<?> clazz = MappedPropertyTestBean.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNull("Getter is found", desc.getMappedReadMethod()); assertNotNull("Setter is missing", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -152,14 +152,14 @@ public class MappedPropertyTestCase exte * Test Mapped Property - Invalid Setter */ public void testInvalidSetter() { - String property = "invalidSetter"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "invalidSetter"; + final Class<?> clazz = MappedPropertyTestBean.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNotNull("Getter is missing", desc.getMappedReadMethod()); assertNull("Setter is found", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -168,14 +168,14 @@ public class MappedPropertyTestCase exte * Test Mapped Property - Invalid Getter */ public void testInvalidGetter() { - String property = "invalidGetter"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "invalidGetter"; + final Class<?> clazz = MappedPropertyTestBean.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNull("Getter is found", desc.getMappedReadMethod()); assertNotNull("Setter is missing", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -188,14 +188,14 @@ public class MappedPropertyTestCase exte * sets and Integer, while getDifferentTypes() returns a Long. */ public void testDifferentTypes() { - String property = "differentTypes"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "differentTypes"; + final Class<?> clazz = MappedPropertyTestBean.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNotNull("Getter is missing", desc.getMappedReadMethod()); assertNull("Setter is found", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -204,13 +204,13 @@ public class MappedPropertyTestCase exte * Test Map getter */ public void testMapGetter() { - MappedPropertyTestBean bean = new MappedPropertyTestBean(); + final MappedPropertyTestBean bean = new MappedPropertyTestBean(); try { - String testValue = "test value"; - String testKey = "testKey"; + final String testValue = "test value"; + final String testKey = "testKey"; BeanUtils.setProperty(bean, "myMap("+testKey+")", "test value"); assertEquals("Map getter", testValue, bean.getMyMap().get(testKey)); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Test set mapped property failed: " + ex); } } @@ -220,14 +220,14 @@ public class MappedPropertyTestCase exte * Test property with any two args */ public void testAnyArgsProperty() { - String property = "anyMapped"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "anyMapped"; + final Class<?> clazz = MappedPropertyTestBean.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNull("Getter is found", desc.getMappedReadMethod()); assertNotNull("Setter is missing", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -236,14 +236,14 @@ public class MappedPropertyTestCase exte * Test property with two primitive args */ public void testPrimitiveArgsProperty() { - String property = "mappedPrimitive"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "mappedPrimitive"; + final Class<?> clazz = MappedPropertyTestBean.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNull("Getter is found", desc.getMappedReadMethod()); assertNotNull("Setter is missing", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -252,12 +252,12 @@ public class MappedPropertyTestCase exte * Test 'protected' mapped property */ public void testProtected() { - String property = "protectedProperty"; - Class<?> clazz = MappedPropertyTestBean.class; + final String property = "protectedProperty"; + final Class<?> clazz = MappedPropertyTestBean.class; try { new MappedPropertyDescriptor(property, clazz); fail("Property '" + property + "' found in " + clazz.getName()); - } catch (Exception ex) { + } catch (final Exception ex) { // expected result } } @@ -267,14 +267,14 @@ public class MappedPropertyTestCase exte * Test 'public' method in parent */ public void testPublicParentMethod() { - String property = "mapproperty"; - Class<?> clazz = MappedPropertyChildBean.class; + final String property = "mapproperty"; + final Class<?> clazz = MappedPropertyChildBean.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNotNull("Getter is missing", desc.getMappedReadMethod()); assertNotNull("Setter is missing", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -283,12 +283,12 @@ public class MappedPropertyTestCase exte * Test 'protected' method in parent */ public void testProtectedParentMethod() { - String property = "protectedMapped"; - Class<?> clazz = MappedPropertyChildBean.class; + final String property = "protectedMapped"; + final Class<?> clazz = MappedPropertyChildBean.class; try { new MappedPropertyDescriptor(property, clazz); fail("Property '" + property + "' found in " + clazz.getName()); - } catch (Exception ex) { + } catch (final Exception ex) { } } @@ -297,14 +297,14 @@ public class MappedPropertyTestCase exte * Test Interface with mapped property */ public void testInterfaceMapped() { - String property = "mapproperty"; - Class<?> clazz = MappedPropertyTestInterface.class; + final String property = "mapproperty"; + final Class<?> clazz = MappedPropertyTestInterface.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNotNull("Getter is missing", desc.getMappedReadMethod()); assertNotNull("Setter is missing", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } } @@ -313,12 +313,12 @@ public class MappedPropertyTestCase exte * Test property not found in interface */ public void testInterfaceNotFound() { - String property = "XXXXXX"; - Class<?> clazz = MappedPropertyTestInterface.class; + final String property = "XXXXXX"; + final Class<?> clazz = MappedPropertyTestInterface.class; try { new MappedPropertyDescriptor(property, clazz); fail("Property '" + property + "' found in " + clazz.getName()); - } catch (Exception ex) { + } catch (final Exception ex) { } } @@ -326,14 +326,14 @@ public class MappedPropertyTestCase exte * Test Interface Inherited mapped property */ public void testChildInterfaceMapped() { - String property = "mapproperty"; - Class<?> clazz = MappedPropertyChildInterface.class; + final String property = "mapproperty"; + final Class<?> clazz = MappedPropertyChildInterface.class; try { - MappedPropertyDescriptor desc + final MappedPropertyDescriptor desc = new MappedPropertyDescriptor(property, clazz); assertNotNull("Getter is missing", desc.getMappedReadMethod()); assertNotNull("Setter is missing", desc.getMappedWriteMethod()); - } catch (Exception ex) { + } catch (final Exception ex) { fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex); } }
Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MethodUtilsTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MethodUtilsTestCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MethodUtilsTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/MethodUtilsTestCase.java Wed Oct 15 20:15:17 2014 @@ -42,7 +42,7 @@ public class MethodUtilsTestCase extends * * @param name Name of the test case */ - public MethodUtilsTestCase(String name) { + public MethodUtilsTestCase(final String name) { super(name); } @@ -80,7 +80,7 @@ public class MethodUtilsTestCase extends */ public void testGetAccessibleMethod() { // easy bit first - find a public method - Method method = MethodUtils.getAccessibleMethod + final Method method = MethodUtils.getAccessibleMethod (TestBean.class, "setStringProperty", String.class); assertMethod(method, "setStringProperty"); @@ -109,7 +109,7 @@ public class MethodUtilsTestCase extends assertMethod(method, "methodBaz"); } - private static void assertMethod(Method method, String methodName) { + private static void assertMethod(final Method method, final String methodName) { assertNotNull(method); assertEquals("Method is not named correctly", methodName, method.getName()); @@ -121,15 +121,15 @@ public class MethodUtilsTestCase extends * <p> Test <code>invokeExactMethod</code>. */ public void testInvokeExactMethod() throws Exception { - TestBean bean = new TestBean(); - Object ret = MethodUtils.invokeExactMethod(bean, "setStringProperty", "TEST"); + final TestBean bean = new TestBean(); + final Object ret = MethodUtils.invokeExactMethod(bean, "setStringProperty", "TEST"); assertNull(ret); assertEquals("Method ONE was invoked", "TEST", bean.getStringProperty()); } public void testInvokeExactMethodFromInterface() throws Exception { - Object ret = MethodUtils.invokeExactMethod( + final Object ret = MethodUtils.invokeExactMethod( PrivateBeanFactory.create(), "methodBar", "ANOTHER TEST"); @@ -138,7 +138,7 @@ public class MethodUtilsTestCase extends } public void testInvokeExactMethodIndirectInterface() throws Exception { - Object ret = MethodUtils.invokeExactMethod( + final Object ret = MethodUtils.invokeExactMethod( PrivateBeanFactory.createSubclass(), "methodBaz", "YET ANOTHER TEST"); @@ -148,7 +148,7 @@ public class MethodUtilsTestCase extends public void testInvokeExactMethodNullArray() throws Exception { - Object result = MethodUtils.invokeExactMethod( + final Object result = MethodUtils.invokeExactMethod( new AlphaBean("parent"), "getName", null); @@ -156,7 +156,7 @@ public class MethodUtilsTestCase extends } public void testInvokeExactMethodNullArrayNullArray() throws Exception { - Object result = MethodUtils.invokeExactMethod( + final Object result = MethodUtils.invokeExactMethod( new AlphaBean("parent"), "getName", null, @@ -166,8 +166,8 @@ public class MethodUtilsTestCase extends } public void testInvokeExactMethodNull() throws Exception { - Object object = new Object(); - Object result = MethodUtils.invokeExactMethod(object, "toString", (Object) null); + final Object object = new Object(); + final Object result = MethodUtils.invokeExactMethod(object, "toString", (Object) null); assertEquals(object.toString(), result); } @@ -175,8 +175,8 @@ public class MethodUtilsTestCase extends * <p> Test <code>invokeMethod</code>. */ public void testInvokeMethod() throws Exception { - AbstractParent parent = new AlphaBean("parent"); - BetaBean childOne = new BetaBean("ChildOne"); + final AbstractParent parent = new AlphaBean("parent"); + final BetaBean childOne = new BetaBean("ChildOne"); assertEquals( "Cannot invoke through abstract class (1)", @@ -185,8 +185,8 @@ public class MethodUtilsTestCase extends } public void testInvokeMethodObject() throws Exception { - AbstractParent parent = new AlphaBean("parent"); - Child childTwo = new AlphaBean("ChildTwo"); + final AbstractParent parent = new AlphaBean("parent"); + final Child childTwo = new AlphaBean("ChildTwo"); assertEquals("Cannot invoke through interface (1)", "ChildTwo", @@ -194,10 +194,10 @@ public class MethodUtilsTestCase extends } public void testInvokeMethodArray() throws Exception { - AbstractParent parent = new AlphaBean("parent"); - AlphaBean childTwo = new AlphaBean("ChildTwo"); + final AbstractParent parent = new AlphaBean("parent"); + final AlphaBean childTwo = new AlphaBean("ChildTwo"); - Object[] params = new Object[2]; + final Object[] params = new Object[2]; params[0] = "parameter"; params[1] = childTwo; @@ -210,18 +210,18 @@ public class MethodUtilsTestCase extends public void testInvokeMethodUnknown() throws Exception { // test that exception is correctly thrown when a method cannot be found with matching params try { - AbstractParent parent = new AlphaBean("parent"); - BetaBean childOne = new BetaBean("ChildOne"); + final AbstractParent parent = new AlphaBean("parent"); + final BetaBean childOne = new BetaBean("ChildOne"); MethodUtils.invokeMethod(parent, "bogus", childOne); fail("No exception thrown when no appropriate method exists"); - } catch (NoSuchMethodException expected) { + } catch (final NoSuchMethodException expected) { // this is what we're expecting! } } public void testInvokeMethodNullArray() throws Exception { - Object result = MethodUtils.invokeMethod( + final Object result = MethodUtils.invokeMethod( new AlphaBean("parent"), "getName", null); @@ -230,7 +230,7 @@ public class MethodUtilsTestCase extends } public void testInvokeMethodNullArrayNullArray() throws Exception { - Object result = MethodUtils.invokeMethod( + final Object result = MethodUtils.invokeMethod( new AlphaBean("parent"), "getName", null, @@ -240,37 +240,37 @@ public class MethodUtilsTestCase extends } public void testInvokeMethodNull() throws Exception { - Object object = new Object(); - Object result = MethodUtils.invokeMethod(object, "toString", (Object) null); + final Object object = new Object(); + final Object result = MethodUtils.invokeMethod(object, "toString", (Object) null); assertEquals(object.toString(), result); } public void testInvokeMethodPrimitiveBoolean() throws Exception { - PrimitiveBean bean = new PrimitiveBean(); + final PrimitiveBean bean = new PrimitiveBean(); MethodUtils.invokeMethod(bean, "setBoolean", Boolean.FALSE); assertEquals("Call boolean property using invokeMethod", false, bean.getBoolean()); } public void testInvokeMethodPrimitiveFloat() throws Exception { - PrimitiveBean bean = new PrimitiveBean(); + final PrimitiveBean bean = new PrimitiveBean(); MethodUtils.invokeMethod(bean, "setFloat", Float.valueOf(20.0f)); assertEquals("Call float property using invokeMethod", 20.0f, bean.getFloat(), 0.01f); } public void testInvokeMethodPrimitiveLong() throws Exception { - PrimitiveBean bean = new PrimitiveBean(); + final PrimitiveBean bean = new PrimitiveBean(); MethodUtils.invokeMethod(bean, "setLong", Long.valueOf(10)); assertEquals("Call long property using invokeMethod", 10, bean.getLong()); } public void testInvokeMethodPrimitiveInt() throws Exception { - PrimitiveBean bean = new PrimitiveBean(); + final PrimitiveBean bean = new PrimitiveBean(); MethodUtils.invokeMethod(bean, "setInt", Integer.valueOf(12)); assertEquals("Set int property using invokeMethod", 12, bean.getInt()); } public void testInvokeMethodPrimitiveDouble() throws Exception { - PrimitiveBean bean = new PrimitiveBean(); + final PrimitiveBean bean = new PrimitiveBean(); MethodUtils.invokeMethod(bean, "setDouble", Double.valueOf(25.5d)); assertEquals("Set double property using invokeMethod", 25.5d, bean.getDouble(), 0.01d); } @@ -304,14 +304,14 @@ public class MethodUtilsTestCase extends } public void testInvokeStaticMethodNull() throws Exception { - int current = TestBean.currentCounter(); - Object value = MethodUtils.invokeStaticMethod(TestBean.class, "currentCounter", (Object) null); + final int current = TestBean.currentCounter(); + final Object value = MethodUtils.invokeStaticMethod(TestBean.class, "currentCounter", (Object) null); assertEquals("currentCounter value", current, ((Integer) value).intValue()); } public void testInvokeExactStaticMethodNull() throws Exception { - int current = TestBean.currentCounter(); - Object value = MethodUtils.invokeExactStaticMethod(TestBean.class, "currentCounter", (Object) null); + final int current = TestBean.currentCounter(); + final Object value = MethodUtils.invokeExactStaticMethod(TestBean.class, "currentCounter", (Object) null); assertEquals("currentCounter value", current, ((Integer) value).intValue()); } @@ -320,7 +320,7 @@ public class MethodUtilsTestCase extends */ public void testSimpleStatic1() { - TestBean bean = new TestBean(); + final TestBean bean = new TestBean(); Object value = null; int current = TestBean.currentCounter(); @@ -368,7 +368,7 @@ public class MethodUtilsTestCase extends current, ((Integer) value).intValue()); - } catch (Exception e) { + } catch (final Exception e) { fail("Threw exception" + e); } @@ -380,7 +380,7 @@ public class MethodUtilsTestCase extends */ public void testSimpleStatic2() { - TestBean bean = new TestBean(); + final TestBean bean = new TestBean(); Object value = null; int current = TestBean.currentCounter(); @@ -428,7 +428,7 @@ public class MethodUtilsTestCase extends current, ((Integer) value).intValue()); - } catch (Exception e) { + } catch (final Exception e) { fail("Threw exception" + e); } @@ -445,7 +445,7 @@ public class MethodUtilsTestCase extends try { // Acquire the methods we need - Method currentCounterMethod = MethodUtils.getAccessibleMethod + final Method currentCounterMethod = MethodUtils.getAccessibleMethod (TestBean.class, "currentCounter", new Class[0]); assertNotNull("currentCounterMethod exists", @@ -460,7 +460,7 @@ public class MethodUtilsTestCase extends Modifier.isPublic(currentCounterMethod.getModifiers())); assertTrue("currentCounterMethod static", Modifier.isStatic(currentCounterMethod.getModifiers())); - Method incrementCounterMethod1 = MethodUtils.getAccessibleMethod + final Method incrementCounterMethod1 = MethodUtils.getAccessibleMethod (TestBean.class, "incrementCounter", new Class[0]); assertNotNull("incrementCounterMethod1 exists", @@ -475,7 +475,7 @@ public class MethodUtilsTestCase extends Modifier.isPublic(incrementCounterMethod1.getModifiers())); assertTrue("incrementCounterMethod1 static", Modifier.isStatic(incrementCounterMethod1.getModifiers())); - Method incrementCounterMethod2 = MethodUtils.getAccessibleMethod + final Method incrementCounterMethod2 = MethodUtils.getAccessibleMethod (TestBean.class, "incrementCounter", new Class[] { Integer.TYPE }); assertNotNull("incrementCounterMethod2 exists", @@ -527,7 +527,7 @@ public class MethodUtilsTestCase extends current, ((Integer) value).intValue()); - } catch (Exception e) { + } catch (final Exception e) { fail("Threw exception" + e); } @@ -535,7 +535,7 @@ public class MethodUtilsTestCase extends public void testPublicSub() throws Exception { // make sure that bean does what it should - PublicSubBean bean = new PublicSubBean(); + final PublicSubBean bean = new PublicSubBean(); assertEquals("Start value (foo)", bean.getFoo(), "This is foo"); assertEquals("Start value (bar)", bean.getBar(), "This is bar"); bean.setFoo("new foo"); @@ -553,26 +553,26 @@ public class MethodUtilsTestCase extends Method method = null; try { method = MethodUtils.getAccessibleMethod(PublicSubBean.class, "setFoo", String.class); - } catch (Throwable t) { + } catch (final Throwable t) { fail("getAccessibleMethod() setFoo threw " + t); } assertNotNull("getAccessibleMethod() setFoo is Null", method); try { method.invoke(bean, new Object[] {"1111"}); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Invoking setFoo threw " + t); } assertEquals("Set value (foo:3)", "1111", bean.getFoo()); try { method = MethodUtils.getAccessibleMethod(PublicSubBean.class, "setBar", String.class); - } catch (Throwable t) { + } catch (final Throwable t) { fail("getAccessibleMethod() setBar threw " + t); } assertNotNull("getAccessibleMethod() setBar is Null", method); try { method.invoke(bean, new Object[] {"2222"}); - } catch (Throwable t) { + } catch (final Throwable t) { fail("Invoking setBar threw " + t); } assertEquals("Set value (bar:3)", "2222", bean.getBar()); @@ -580,8 +580,8 @@ public class MethodUtilsTestCase extends } public void testParentMethod() throws Exception { - OutputStream os = new PrintStream(System.out); - PrintStream ps = new PrintStream(System.out); + final OutputStream os = new PrintStream(System.out); + final PrintStream ps = new PrintStream(System.out); A a = new A(); MethodUtils.invokeMethod(a, "foo", os); @@ -597,7 +597,7 @@ public class MethodUtilsTestCase extends */ public void testClearCache() throws Exception { MethodUtils.clearCache(); // make sure it starts empty - PublicSubBean bean = new PublicSubBean(); + final PublicSubBean bean = new PublicSubBean(); MethodUtils.invokeMethod(bean, "setFoo", "alpha"); assertEquals(1, MethodUtils.clearCache()); assertEquals(0, MethodUtils.clearCache()); @@ -610,7 +610,7 @@ public class MethodUtilsTestCase extends MethodUtils.setCacheMethods(true); MethodUtils.clearCache(); // make sure it starts empty - PublicSubBean bean = new PublicSubBean(); + final PublicSubBean bean = new PublicSubBean(); MethodUtils.invokeMethod(bean, "setFoo", "alpha"); assertEquals(1, MethodUtils.clearCache()); assertEquals(0, MethodUtils.clearCache()); @@ -620,7 +620,7 @@ public class MethodUtilsTestCase extends // no caching MethodUtils.setCacheMethods(false); - PublicSubBean bean = new PublicSubBean(); + final PublicSubBean bean = new PublicSubBean(); MethodUtils.invokeMethod(bean, "setFoo", "alpha"); assertEquals(0, MethodUtils.clearCache()); Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/NestedTestBean.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/NestedTestBean.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/NestedTestBean.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/NestedTestBean.java Wed Oct 15 20:15:17 2014 @@ -30,7 +30,7 @@ public class NestedTestBean { // ------------------------------------------------------------- Constructors - public NestedTestBean(String name) { + public NestedTestBean(final String name) { setName(name); } @@ -43,7 +43,7 @@ public class NestedTestBean { return name; } - public void setName(String name) { + public void setName(final String name) { this.name = name; } @@ -54,7 +54,7 @@ public class NestedTestBean { return testString; } - public void setTestString(String testString) { + public void setTestString(final String testString) { this.testString = testString; } @@ -65,7 +65,7 @@ public class NestedTestBean { return testBoolean; } - public void setTestBoolean(boolean testBoolean) { + public void setTestBoolean(final boolean testBoolean) { this.testBoolean = testBoolean; } @@ -83,11 +83,11 @@ public class NestedTestBean { simpleBean = new NestedTestBean("Simple Property Bean"); } - public NestedTestBean getIndexedProperty(int index) { + public NestedTestBean getIndexedProperty(final int index) { return (this.indexedBeans[index]); } - public void setIndexedProperty(int index, NestedTestBean value) { + public void setIndexedProperty(final int index, final NestedTestBean value) { this.indexedBeans[index] = value; } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PrimitiveBean.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PrimitiveBean.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PrimitiveBean.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PrimitiveBean.java Wed Oct 15 20:15:17 2014 @@ -34,7 +34,7 @@ public class PrimitiveBean { return _float; } - public void setFloat(float _float) { + public void setFloat(final float _float) { this._float = _float; } @@ -42,7 +42,7 @@ public class PrimitiveBean { return _double; } - public void setDouble(double _double) { + public void setDouble(final double _double) { this._double = _double; } @@ -50,7 +50,7 @@ public class PrimitiveBean { return _boolean; } - public void setBoolean(boolean _boolean) { + public void setBoolean(final boolean _boolean) { this._boolean = _boolean; } @@ -58,7 +58,7 @@ public class PrimitiveBean { return _long; } - public void setLong(long _long) { + public void setLong(final long _long) { this._long = _long; } @@ -66,7 +66,7 @@ public class PrimitiveBean { return _int; } - public void setInt(int _int) { + public void setInt(final int _int) { this._int = _int; } } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PropertyUtilsBenchCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PropertyUtilsBenchCase.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PropertyUtilsBenchCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PropertyUtilsBenchCase.java Wed Oct 15 20:15:17 2014 @@ -44,7 +44,7 @@ public class PropertyUtilsBenchCase exte * * @param name Name of the test case */ - public PropertyUtilsBenchCase(String name) { + public PropertyUtilsBenchCase(final String name) { super(name); @@ -83,7 +83,7 @@ public class PropertyUtilsBenchCase exte public void setUp() throws Exception { // Set up loop counter (if property specified) - String prop = System.getProperty("counter"); + final String prop = System.getProperty("counter"); if (prop != null) { counter = Long.parseLong(prop); } @@ -114,7 +114,7 @@ public class PropertyUtilsBenchCase exte inMap.put("shortProperty", new Short(inBean.getShortProperty())); inMap.put("stringProperty", inBean.getStringProperty()); inDyna = dynaClass.newInstance(); - for (Map.Entry<String, Object> e : inMap.entrySet()) { + for (final Map.Entry<String, Object> e : inMap.entrySet()) { inDyna.set(e.getKey(), e.getValue()); } @@ -122,7 +122,7 @@ public class PropertyUtilsBenchCase exte outBean = new BenchBean(); outDyna = dynaClass.newInstance(); inDyna = dynaClass.newInstance(); - for (Map.Entry<String, Object> e : inMap.entrySet()) { + for (final Map.Entry<String, Object> e : inMap.entrySet()) { outDyna.set(e.getKey(), e.getValue()); }
