You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2013/01/22 08:09:49 UTC
svn commit: r1436770 [12/16] - in /commons/proper/lang/trunk/src:
main/java/org/apache/commons/lang3/
main/java/org/apache/commons/lang3/builder/
main/java/org/apache/commons/lang3/concurrent/
main/java/org/apache/commons/lang3/event/ main/java/org/apa...
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java Tue Jan 22 07:09:45 2013
@@ -130,7 +130,7 @@ public class MutableFloatTest {
@Test
public void testPrimitiveValues() {
- MutableFloat mutNum = new MutableFloat(1.7F);
+ final MutableFloat mutNum = new MutableFloat(1.7F);
assertEquals( 1, mutNum.intValue() );
assertEquals( 1.7, mutNum.doubleValue(), 0.00001 );
@@ -148,7 +148,7 @@ public class MutableFloatTest {
@Test
public void testIncrement() {
- MutableFloat mutNum = new MutableFloat(1);
+ final MutableFloat mutNum = new MutableFloat(1);
mutNum.increment();
assertEquals(2, mutNum.intValue());
@@ -157,7 +157,7 @@ public class MutableFloatTest {
@Test
public void testDecrement() {
- MutableFloat mutNum = new MutableFloat(1);
+ final MutableFloat mutNum = new MutableFloat(1);
mutNum.decrement();
assertEquals(0, mutNum.intValue());
@@ -166,7 +166,7 @@ public class MutableFloatTest {
@Test
public void testAddValuePrimitive() {
- MutableFloat mutNum = new MutableFloat(1);
+ final MutableFloat mutNum = new MutableFloat(1);
mutNum.add(1.1f);
assertEquals(2.1f, mutNum.floatValue(), 0.01f);
@@ -174,7 +174,7 @@ public class MutableFloatTest {
@Test
public void testAddValueObject() {
- MutableFloat mutNum = new MutableFloat(1);
+ final MutableFloat mutNum = new MutableFloat(1);
mutNum.add(Float.valueOf(1.1f));
assertEquals(2.1f, mutNum.floatValue(), 0.01f);
@@ -182,7 +182,7 @@ public class MutableFloatTest {
@Test
public void testSubtractValuePrimitive() {
- MutableFloat mutNum = new MutableFloat(1);
+ final MutableFloat mutNum = new MutableFloat(1);
mutNum.subtract(0.9f);
assertEquals(0.1f, mutNum.floatValue(), 0.01f);
@@ -190,7 +190,7 @@ public class MutableFloatTest {
@Test
public void testSubtractValueObject() {
- MutableFloat mutNum = new MutableFloat(1);
+ final MutableFloat mutNum = new MutableFloat(1);
mutNum.subtract(Float.valueOf(0.9f));
assertEquals(0.1f, mutNum.floatValue(), 0.01f);
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java Tue Jan 22 07:09:45 2013
@@ -125,7 +125,7 @@ public class MutableIntTest {
@Test
public void testPrimitiveValues() {
- MutableInt mutNum = new MutableInt(1);
+ final MutableInt mutNum = new MutableInt(1);
assertEquals( (byte) 1, mutNum.byteValue() );
assertEquals( (short) 1, mutNum.shortValue() );
@@ -142,7 +142,7 @@ public class MutableIntTest {
@Test
public void testIncrement() {
- MutableInt mutNum = new MutableInt(1);
+ final MutableInt mutNum = new MutableInt(1);
mutNum.increment();
assertEquals(2, mutNum.intValue());
@@ -151,7 +151,7 @@ public class MutableIntTest {
@Test
public void testDecrement() {
- MutableInt mutNum = new MutableInt(1);
+ final MutableInt mutNum = new MutableInt(1);
mutNum.decrement();
assertEquals(0, mutNum.intValue());
@@ -160,7 +160,7 @@ public class MutableIntTest {
@Test
public void testAddValuePrimitive() {
- MutableInt mutNum = new MutableInt(1);
+ final MutableInt mutNum = new MutableInt(1);
mutNum.add(1);
assertEquals(2, mutNum.intValue());
@@ -169,7 +169,7 @@ public class MutableIntTest {
@Test
public void testAddValueObject() {
- MutableInt mutNum = new MutableInt(1);
+ final MutableInt mutNum = new MutableInt(1);
mutNum.add(Integer.valueOf(1));
assertEquals(2, mutNum.intValue());
@@ -178,7 +178,7 @@ public class MutableIntTest {
@Test
public void testSubtractValuePrimitive() {
- MutableInt mutNum = new MutableInt(1);
+ final MutableInt mutNum = new MutableInt(1);
mutNum.subtract(1);
assertEquals(0, mutNum.intValue());
@@ -187,7 +187,7 @@ public class MutableIntTest {
@Test
public void testSubtractValueObject() {
- MutableInt mutNum = new MutableInt(1);
+ final MutableInt mutNum = new MutableInt(1);
mutNum.subtract(Integer.valueOf(1));
assertEquals(0, mutNum.intValue());
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java Tue Jan 22 07:09:45 2013
@@ -118,7 +118,7 @@ public class MutableLongTest {
@Test
public void testPrimitiveValues() {
- MutableLong mutNum = new MutableLong(1L);
+ final MutableLong mutNum = new MutableLong(1L);
assertEquals( 1.0F, mutNum.floatValue(), 0 );
assertEquals( 1.0, mutNum.doubleValue(), 0 );
@@ -136,7 +136,7 @@ public class MutableLongTest {
@Test
public void testIncrement() {
- MutableLong mutNum = new MutableLong(1);
+ final MutableLong mutNum = new MutableLong(1);
mutNum.increment();
assertEquals(2, mutNum.intValue());
@@ -145,7 +145,7 @@ public class MutableLongTest {
@Test
public void testDecrement() {
- MutableLong mutNum = new MutableLong(1);
+ final MutableLong mutNum = new MutableLong(1);
mutNum.decrement();
assertEquals(0, mutNum.intValue());
@@ -154,7 +154,7 @@ public class MutableLongTest {
@Test
public void testAddValuePrimitive() {
- MutableLong mutNum = new MutableLong(1);
+ final MutableLong mutNum = new MutableLong(1);
mutNum.add(1);
assertEquals(2, mutNum.intValue());
@@ -163,7 +163,7 @@ public class MutableLongTest {
@Test
public void testAddValueObject() {
- MutableLong mutNum = new MutableLong(1);
+ final MutableLong mutNum = new MutableLong(1);
mutNum.add(Long.valueOf(1));
assertEquals(2, mutNum.intValue());
@@ -172,7 +172,7 @@ public class MutableLongTest {
@Test
public void testSubtractValuePrimitive() {
- MutableLong mutNum = new MutableLong(1);
+ final MutableLong mutNum = new MutableLong(1);
mutNum.subtract(1);
assertEquals(0, mutNum.intValue());
@@ -181,7 +181,7 @@ public class MutableLongTest {
@Test
public void testSubtractValueObject() {
- MutableLong mutNum = new MutableLong(1);
+ final MutableLong mutNum = new MutableLong(1);
mutNum.subtract(Long.valueOf(1));
assertEquals(0, mutNum.intValue());
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java Tue Jan 22 07:09:45 2013
@@ -32,7 +32,7 @@ public class MutableObjectTest {
public void testConstructors() {
assertEquals(null, new MutableObject<String>().getValue());
- Integer i = Integer.valueOf(6);
+ final Integer i = Integer.valueOf(6);
assertSame(i, new MutableObject<Integer>(i).getValue());
assertSame("HI", new MutableObject<String>("HI").getValue());
assertSame(null, new MutableObject<Object>(null).getValue());
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java Tue Jan 22 07:09:45 2013
@@ -42,7 +42,7 @@ public class MutableShortTest {
try {
new MutableShort((Number)null);
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
}
@Test
@@ -65,7 +65,7 @@ public class MutableShortTest {
try {
mutNum.setValue(null);
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
}
@Test
@@ -108,12 +108,12 @@ public class MutableShortTest {
try {
mutNum.compareTo(null);
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
}
@Test
public void testPrimitiveValues() {
- MutableShort mutNum = new MutableShort( (short) 1 );
+ final MutableShort mutNum = new MutableShort( (short) 1 );
assertEquals( 1.0F, mutNum.floatValue(), 0 );
assertEquals( 1.0, mutNum.doubleValue(), 0 );
@@ -131,7 +131,7 @@ public class MutableShortTest {
@Test
public void testIncrement() {
- MutableShort mutNum = new MutableShort((short) 1);
+ final MutableShort mutNum = new MutableShort((short) 1);
mutNum.increment();
assertEquals(2, mutNum.intValue());
@@ -140,7 +140,7 @@ public class MutableShortTest {
@Test
public void testDecrement() {
- MutableShort mutNum = new MutableShort((short) 1);
+ final MutableShort mutNum = new MutableShort((short) 1);
mutNum.decrement();
assertEquals(0, mutNum.intValue());
@@ -149,7 +149,7 @@ public class MutableShortTest {
@Test
public void testAddValuePrimitive() {
- MutableShort mutNum = new MutableShort((short) 1);
+ final MutableShort mutNum = new MutableShort((short) 1);
mutNum.add((short) 1);
assertEquals((short) 2, mutNum.shortValue());
@@ -157,7 +157,7 @@ public class MutableShortTest {
@Test
public void testAddValueObject() {
- MutableShort mutNum = new MutableShort((short) 1);
+ final MutableShort mutNum = new MutableShort((short) 1);
mutNum.add(Short.valueOf((short) 1));
assertEquals((short) 2, mutNum.shortValue());
@@ -165,7 +165,7 @@ public class MutableShortTest {
@Test
public void testSubtractValuePrimitive() {
- MutableShort mutNum = new MutableShort((short) 1);
+ final MutableShort mutNum = new MutableShort((short) 1);
mutNum.subtract((short) 1);
assertEquals((short) 0, mutNum.shortValue());
@@ -173,7 +173,7 @@ public class MutableShortTest {
@Test
public void testSubtractValueObject() {
- MutableShort mutNum = new MutableShort((short) 1);
+ final MutableShort mutNum = new MutableShort((short) 1);
mutNum.subtract(Short.valueOf((short) 1));
assertEquals((short) 0, mutNum.shortValue());
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java Tue Jan 22 07:09:45 2013
@@ -132,19 +132,19 @@ public class ConstructorUtilsTest {
ConstructorUtils.invokeExactConstructor(TestBean.class,
NumberUtils.BYTE_ONE);
fail("should throw NoSuchMethodException");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
}
try {
ConstructorUtils.invokeExactConstructor(TestBean.class,
NumberUtils.LONG_ONE);
fail("should throw NoSuchMethodException");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
}
try {
ConstructorUtils.invokeExactConstructor(TestBean.class,
Boolean.TRUE);
fail("should throw NoSuchMethodException");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
}
}
@@ -214,7 +214,7 @@ public class ConstructorUtilsTest {
private void expectMatchingAccessibleConstructorParameterTypes(final Class<?> cls,
final Class<?>[] requestTypes, final Class<?>[] actualTypes) {
- Constructor<?> c = ConstructorUtils.getMatchingAccessibleConstructor(cls,
+ final Constructor<?> c = ConstructorUtils.getMatchingAccessibleConstructor(cls,
requestTypes);
assertTrue(toString(c.getParameterTypes()) + " not equals "
+ toString(actualTypes), Arrays.equals(actualTypes, c
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java Tue Jan 22 07:09:45 2013
@@ -67,7 +67,7 @@ public class FieldUtilsTest {
@Test
public void testConstructor() {
assertNotNull(new FieldUtils());
- Constructor<?>[] cons = FieldUtils.class.getDeclaredConstructors();
+ final Constructor<?>[] cons = FieldUtils.class.getDeclaredConstructors();
assertEquals(1, cons.length);
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
assertTrue(Modifier.isPublic(FieldUtils.class.getModifiers()));
@@ -228,7 +228,7 @@ public class FieldUtilsTest {
@Test(expected=IllegalArgumentException.class)
public void testReadStaticFieldIllegalArgumentException2() throws Exception {
assertEquals(Foo.VALUE, FieldUtils.readStaticField(FieldUtils.getField(Foo.class, "VALUE")));
- Field nonStaticField = FieldUtils.getField(PublicChild.class, "s");
+ final Field nonStaticField = FieldUtils.getField(PublicChild.class, "s");
assumeNotNull(nonStaticField);
FieldUtils.readStaticField(nonStaticField);
}
@@ -246,7 +246,7 @@ public class FieldUtilsTest {
@Test(expected=IllegalArgumentException.class)
public void testReadStaticFieldForceAccessIllegalArgumentException2() throws Exception {
- Field nonStaticField = FieldUtils.getField(PublicChild.class, "s", true);
+ final Field nonStaticField = FieldUtils.getField(PublicChild.class, "s", true);
assumeNotNull(nonStaticField);
FieldUtils.readStaticField(nonStaticField);
}
@@ -261,28 +261,28 @@ public class FieldUtilsTest {
try {
FieldUtils.readStaticField(null, "none");
fail("null class should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
FieldUtils.readStaticField(Foo.class, null);
fail("null field name should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
FieldUtils.readStaticField(Foo.class, "does_not_exist");
fail("a field that doesn't exist should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
FieldUtils.readStaticField(PublicChild.class, "s");
fail("non-static field should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
}
@@ -297,28 +297,28 @@ public class FieldUtilsTest {
try {
FieldUtils.readStaticField(null, "none", true);
fail("null class should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
FieldUtils.readStaticField(Foo.class, null, true);
fail("null field name should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
FieldUtils.readStaticField(Foo.class, "does_not_exist", true);
fail("a field that doesn't exist should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
FieldUtils.readStaticField(PublicChild.class, "s", false);
fail("non-static field should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
}
@@ -329,19 +329,19 @@ public class FieldUtilsTest {
try {
assertEquals("child", FieldUtils.readDeclaredStaticField(PublicChild.class, "VALUE"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
assertEquals(Foo.VALUE, FieldUtils.readDeclaredStaticField(PubliclyShadowedChild.class, "VALUE"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
assertEquals(Foo.VALUE, FieldUtils.readDeclaredStaticField(PrivatelyShadowedChild.class, "VALUE"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
}
@@ -353,32 +353,32 @@ public class FieldUtilsTest {
try {
assertEquals(Foo.VALUE, FieldUtils.readDeclaredStaticField(PubliclyShadowedChild.class, "VALUE", true));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
assertEquals(Foo.VALUE, FieldUtils.readDeclaredStaticField(PrivatelyShadowedChild.class, "VALUE", true));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
}
@Test
public void testReadField() throws Exception {
- Field parentS = FieldUtils.getDeclaredField(parentClass, "s");
+ final Field parentS = FieldUtils.getDeclaredField(parentClass, "s");
assertEquals("s", FieldUtils.readField(parentS, publicChild));
assertEquals("s", FieldUtils.readField(parentS, publiclyShadowedChild));
assertEquals("s", FieldUtils.readField(parentS, privatelyShadowedChild));
- Field parentB = FieldUtils.getDeclaredField(parentClass, "b", true);
+ final Field parentB = FieldUtils.getDeclaredField(parentClass, "b", true);
assertEquals(Boolean.FALSE, FieldUtils.readField(parentB, publicChild));
assertEquals(Boolean.FALSE, FieldUtils.readField(parentB, publiclyShadowedChild));
assertEquals(Boolean.FALSE, FieldUtils.readField(parentB, privatelyShadowedChild));
- Field parentI = FieldUtils.getDeclaredField(parentClass, "i", true);
+ final Field parentI = FieldUtils.getDeclaredField(parentClass, "i", true);
assertEquals(I0, FieldUtils.readField(parentI, publicChild));
assertEquals(I0, FieldUtils.readField(parentI, publiclyShadowedChild));
assertEquals(I0, FieldUtils.readField(parentI, privatelyShadowedChild));
- Field parentD = FieldUtils.getDeclaredField(parentClass, "d", true);
+ final Field parentD = FieldUtils.getDeclaredField(parentClass, "d", true);
assertEquals(D0, FieldUtils.readField(parentD, publicChild));
assertEquals(D0, FieldUtils.readField(parentD, publiclyShadowedChild));
assertEquals(D0, FieldUtils.readField(parentD, privatelyShadowedChild));
@@ -386,29 +386,29 @@ public class FieldUtilsTest {
try {
FieldUtils.readField((Field)null, publicChild);
fail("a null field should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
}
@Test
public void testReadFieldForceAccess() throws Exception {
- Field parentS = FieldUtils.getDeclaredField(parentClass, "s");
+ final Field parentS = FieldUtils.getDeclaredField(parentClass, "s");
parentS.setAccessible(false);
assertEquals("s", FieldUtils.readField(parentS, publicChild, true));
assertEquals("s", FieldUtils.readField(parentS, publiclyShadowedChild, true));
assertEquals("s", FieldUtils.readField(parentS, privatelyShadowedChild, true));
- Field parentB = FieldUtils.getDeclaredField(parentClass, "b", true);
+ final Field parentB = FieldUtils.getDeclaredField(parentClass, "b", true);
parentB.setAccessible(false);
assertEquals(Boolean.FALSE, FieldUtils.readField(parentB, publicChild, true));
assertEquals(Boolean.FALSE, FieldUtils.readField(parentB, publiclyShadowedChild, true));
assertEquals(Boolean.FALSE, FieldUtils.readField(parentB, privatelyShadowedChild, true));
- Field parentI = FieldUtils.getDeclaredField(parentClass, "i", true);
+ final Field parentI = FieldUtils.getDeclaredField(parentClass, "i", true);
parentI.setAccessible(false);
assertEquals(I0, FieldUtils.readField(parentI, publicChild, true));
assertEquals(I0, FieldUtils.readField(parentI, publiclyShadowedChild, true));
assertEquals(I0, FieldUtils.readField(parentI, privatelyShadowedChild, true));
- Field parentD = FieldUtils.getDeclaredField(parentClass, "d", true);
+ final Field parentD = FieldUtils.getDeclaredField(parentClass, "d", true);
parentD.setAccessible(false);
assertEquals(D0, FieldUtils.readField(parentD, publicChild, true));
assertEquals(D0, FieldUtils.readField(parentD, publiclyShadowedChild, true));
@@ -417,7 +417,7 @@ public class FieldUtilsTest {
try {
FieldUtils.readField((Field)null, publicChild, true);
fail("a null field should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
}
@@ -431,54 +431,54 @@ public class FieldUtilsTest {
try {
FieldUtils.readField(publicChild, null);
fail("a null field name should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
FieldUtils.readField((Object)null, "none");
fail("a null target should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
assertEquals(Boolean.FALSE, FieldUtils.readField(publicChild, "b"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals(Boolean.TRUE, FieldUtils.readField(publiclyShadowedChild, "b"));
try {
assertEquals(Boolean.FALSE, FieldUtils.readField(privatelyShadowedChild, "b"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
assertEquals(I0, FieldUtils.readField(publicChild, "i"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals(I1, FieldUtils.readField(publiclyShadowedChild, "i"));
try {
assertEquals(I0, FieldUtils.readField(privatelyShadowedChild, "i"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
assertEquals(D0, FieldUtils.readField(publicChild, "d"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals(D1, FieldUtils.readField(publiclyShadowedChild, "d"));
try {
assertEquals(D0, FieldUtils.readField(privatelyShadowedChild, "d"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
}
@@ -501,14 +501,14 @@ public class FieldUtilsTest {
try {
FieldUtils.readField(publicChild, null, true);
fail("a null field name should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
FieldUtils.readField((Object)null, "none", true);
fail("a null target should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
}
@@ -518,67 +518,67 @@ public class FieldUtilsTest {
try {
FieldUtils.readDeclaredField(publicChild, null);
fail("a null field name should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
FieldUtils.readDeclaredField((Object)null, "none");
fail("a null target should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
assertEquals("s", FieldUtils.readDeclaredField(publicChild, "s"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals("ss", FieldUtils.readDeclaredField(publiclyShadowedChild, "s"));
try {
assertEquals("s", FieldUtils.readDeclaredField(privatelyShadowedChild, "s"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
assertEquals(Boolean.FALSE, FieldUtils.readDeclaredField(publicChild, "b"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals(Boolean.TRUE, FieldUtils.readDeclaredField(publiclyShadowedChild, "b"));
try {
assertEquals(Boolean.FALSE, FieldUtils.readDeclaredField(privatelyShadowedChild, "b"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
assertEquals(I0, FieldUtils.readDeclaredField(publicChild, "i"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals(I1, FieldUtils.readDeclaredField(publiclyShadowedChild, "i"));
try {
assertEquals(I0, FieldUtils.readDeclaredField(privatelyShadowedChild, "i"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
assertEquals(D0, FieldUtils.readDeclaredField(publicChild, "d"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals(D1, FieldUtils.readDeclaredField(publiclyShadowedChild, "d"));
try {
assertEquals(D0, FieldUtils.readDeclaredField(privatelyShadowedChild, "d"));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
}
@@ -588,21 +588,21 @@ public class FieldUtilsTest {
try {
FieldUtils.readDeclaredField(publicChild, null, true);
fail("a null field name should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
FieldUtils.readDeclaredField((Object)null, "none", true);
fail("a null target should cause an IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
assertEquals("s", FieldUtils.readDeclaredField(publicChild, "s", true));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals("ss", FieldUtils.readDeclaredField(publiclyShadowedChild, "s", true));
@@ -610,7 +610,7 @@ public class FieldUtilsTest {
try {
assertEquals(Boolean.FALSE, FieldUtils.readDeclaredField(publicChild, "b", true));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals(Boolean.TRUE, FieldUtils.readDeclaredField(publiclyShadowedChild, "b", true));
@@ -618,7 +618,7 @@ public class FieldUtilsTest {
try {
assertEquals(I0, FieldUtils.readDeclaredField(publicChild, "i", true));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals(I1, FieldUtils.readDeclaredField(publiclyShadowedChild, "i", true));
@@ -626,7 +626,7 @@ public class FieldUtilsTest {
try {
assertEquals(D0, FieldUtils.readDeclaredField(publicChild, "d", true));
fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
assertEquals(D1, FieldUtils.readDeclaredField(publiclyShadowedChild, "d", true));
@@ -642,49 +642,49 @@ public class FieldUtilsTest {
try {
FieldUtils.writeStaticField(field, "new");
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = StaticContainer.class.getDeclaredField("mutablePackage");
try {
FieldUtils.writeStaticField(field, "new");
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = StaticContainer.class.getDeclaredField("mutablePrivate");
try {
FieldUtils.writeStaticField(field, "new");
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = StaticContainer.class.getDeclaredField("IMMUTABLE_PUBLIC");
try {
FieldUtils.writeStaticField(field, "new");
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = StaticContainer.class.getDeclaredField("IMMUTABLE_PROTECTED");
try {
FieldUtils.writeStaticField(field, "new");
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = StaticContainer.class.getDeclaredField("IMMUTABLE_PACKAGE");
try {
FieldUtils.writeStaticField(field, "new");
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = StaticContainer.class.getDeclaredField("IMMUTABLE_PRIVATE");
try {
FieldUtils.writeStaticField(field, "new");
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
}
@@ -707,28 +707,28 @@ public class FieldUtilsTest {
try {
FieldUtils.writeStaticField(field, "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = StaticContainer.class.getDeclaredField("IMMUTABLE_PROTECTED");
try {
FieldUtils.writeStaticField(field, "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = StaticContainer.class.getDeclaredField("IMMUTABLE_PACKAGE");
try {
FieldUtils.writeStaticField(field, "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = StaticContainer.class.getDeclaredField("IMMUTABLE_PRIVATE");
try {
FieldUtils.writeStaticField(field, "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
}
@@ -740,43 +740,43 @@ public class FieldUtilsTest {
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "mutableProtected", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "mutablePackage", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "mutablePrivate", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "IMMUTABLE_PUBLIC", "new");
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "IMMUTABLE_PROTECTED", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "IMMUTABLE_PACKAGE", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "IMMUTABLE_PRIVATE", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
}
@@ -794,25 +794,25 @@ public class FieldUtilsTest {
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "IMMUTABLE_PUBLIC", "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "IMMUTABLE_PROTECTED", "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "IMMUTABLE_PACKAGE", "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
try {
FieldUtils.writeStaticField(StaticContainerChild.class, "IMMUTABLE_PRIVATE", "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
}
@@ -824,43 +824,43 @@ public class FieldUtilsTest {
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "mutableProtected", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "mutablePackage", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "mutablePrivate", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "IMMUTABLE_PUBLIC", "new");
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "IMMUTABLE_PROTECTED", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "IMMUTABLE_PACKAGE", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "IMMUTABLE_PRIVATE", "new");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
}
@@ -878,25 +878,25 @@ public class FieldUtilsTest {
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "IMMUTABLE_PUBLIC", "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "IMMUTABLE_PROTECTED", "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "IMMUTABLE_PACKAGE", "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
try {
FieldUtils.writeDeclaredStaticField(StaticContainer.class, "IMMUTABLE_PRIVATE", "new", true);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
}
@@ -910,19 +910,19 @@ public class FieldUtilsTest {
try {
FieldUtils.writeField(field, publicChild, Boolean.TRUE);
fail("Expected IllegalAccessException");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = parentClass.getDeclaredField("i");
try {
FieldUtils.writeField(field, publicChild, Integer.valueOf(Integer.MAX_VALUE));
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
field = parentClass.getDeclaredField("d");
try {
FieldUtils.writeField(field, publicChild, Double.valueOf(Double.MAX_VALUE));
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// pass
}
}
@@ -950,19 +950,19 @@ public class FieldUtilsTest {
try {
FieldUtils.writeField(publicChild, "b", Boolean.TRUE);
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeField(publicChild, "i", Integer.valueOf(1));
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeField(publicChild, "d", Double.valueOf(1.0));
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
@@ -980,19 +980,19 @@ public class FieldUtilsTest {
try {
FieldUtils.writeField(privatelyShadowedChild, "b", Boolean.TRUE);
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeField(privatelyShadowedChild, "i", Integer.valueOf(1));
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeField(privatelyShadowedChild, "d", Double.valueOf(1.0));
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
}
@@ -1032,25 +1032,25 @@ public class FieldUtilsTest {
try {
FieldUtils.writeDeclaredField(publicChild, "s", "S");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredField(publicChild, "b", Boolean.TRUE);
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredField(publicChild, "i", Integer.valueOf(1));
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredField(publicChild, "d", Double.valueOf(1.0));
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
@@ -1066,25 +1066,25 @@ public class FieldUtilsTest {
try {
FieldUtils.writeDeclaredField(privatelyShadowedChild, "s", "S");
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredField(privatelyShadowedChild, "b", Boolean.TRUE);
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredField(privatelyShadowedChild, "i", Integer.valueOf(1));
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredField(privatelyShadowedChild, "d", Double.valueOf(1.0));
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
}
@@ -1094,25 +1094,25 @@ public class FieldUtilsTest {
try {
FieldUtils.writeDeclaredField(publicChild, "s", "S", true);
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredField(publicChild, "b", Boolean.TRUE, true);
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredField(publicChild, "i", Integer.valueOf(1), true);
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
try {
FieldUtils.writeDeclaredField(publicChild, "d", Double.valueOf(1.0), true);
fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// pass
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java Tue Jan 22 07:09:45 2013
@@ -185,18 +185,18 @@ public class MethodUtilsTest {
MethodUtils
.invokeExactMethod(testBean, "foo", NumberUtils.BYTE_ONE);
fail("should throw NoSuchMethodException");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
}
try {
MethodUtils
.invokeExactMethod(testBean, "foo", NumberUtils.LONG_ONE);
fail("should throw NoSuchMethodException");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
}
try {
MethodUtils.invokeExactMethod(testBean, "foo", Boolean.TRUE);
fail("should throw NoSuchMethodException");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
}
}
@@ -226,7 +226,7 @@ public class MethodUtilsTest {
try {
MethodUtils.invokeStaticMethod(TestBean.class, "does_not_exist");
fail("should throw NoSuchMethodException");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
}
}
@@ -252,28 +252,28 @@ public class MethodUtilsTest {
MethodUtils.invokeExactStaticMethod(TestBean.class, "bar",
NumberUtils.BYTE_ONE);
fail("should throw NoSuchMethodException");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
}
try {
MethodUtils.invokeExactStaticMethod(TestBean.class, "bar",
NumberUtils.LONG_ONE);
fail("should throw NoSuchMethodException");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
}
try {
MethodUtils.invokeExactStaticMethod(TestBean.class, "bar",
Boolean.TRUE);
fail("should throw NoSuchMethodException");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
}
}
@Test
public void testGetAccessibleInterfaceMethod() throws Exception {
- Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null };
- for (Class<?>[] element : p) {
- Method method = TestMutable.class.getMethod("getValue", element);
- Method accessibleMethod = MethodUtils.getAccessibleMethod(method);
+ final Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null };
+ for (final Class<?>[] element : p) {
+ final Method method = TestMutable.class.getMethod("getValue", element);
+ final Method accessibleMethod = MethodUtils.getAccessibleMethod(method);
assertNotSame(accessibleMethod, method);
assertSame(Mutable.class, accessibleMethod.getDeclaringClass());
}
@@ -281,18 +281,18 @@ public class MethodUtilsTest {
@Test
public void testGetAccessibleMethodPrivateInterface() throws Exception {
- Method expected = TestBeanWithInterfaces.class.getMethod("foo");
+ final Method expected = TestBeanWithInterfaces.class.getMethod("foo");
assertNotNull(expected);
- Method actual = MethodUtils.getAccessibleMethod(TestBeanWithInterfaces.class, "foo");
+ final Method actual = MethodUtils.getAccessibleMethod(TestBeanWithInterfaces.class, "foo");
assertNull(actual);
}
@Test
public void testGetAccessibleInterfaceMethodFromDescription()
throws Exception {
- Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null };
- for (Class<?>[] element : p) {
- Method accessibleMethod = MethodUtils.getAccessibleMethod(
+ final Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null };
+ for (final Class<?>[] element : p) {
+ final Method accessibleMethod = MethodUtils.getAccessibleMethod(
TestMutable.class, "getValue", element);
assertSame(Mutable.class, accessibleMethod.getDeclaringClass());
}
@@ -314,8 +314,8 @@ public class MethodUtilsTest {
@Test
public void testGetAccessibleMethodInaccessible() throws Exception {
- Method expected = TestBean.class.getDeclaredMethod("privateStuff");
- Method actual = MethodUtils.getAccessibleMethod(expected);
+ final Method expected = TestBean.class.getDeclaredMethod("privateStuff");
+ final Method actual = MethodUtils.getAccessibleMethod(expected);
assertNull(actual);
}
@@ -379,7 +379,7 @@ public class MethodUtilsTest {
private void expectMatchingAccessibleMethodParameterTypes(final Class<?> cls,
final String methodName, final Class<?>[] requestTypes, final Class<?>[] actualTypes) {
- Method m = MethodUtils.getMatchingAccessibleMethod(cls, methodName,
+ final Method m = MethodUtils.getMatchingAccessibleMethod(cls, methodName,
requestTypes);
assertTrue(toString(m.getParameterTypes()) + " not equals "
+ toString(actualTypes), Arrays.equals(actualTypes, m
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java Tue Jan 22 07:09:45 2013
@@ -121,11 +121,11 @@ public class TypeUtilsTest<B> {
List<String>[] list11 = null;
List<? extends String>[] list12 = null;
List<? super String>[] list13;
- Class<?> clazz = getClass();
- Method method = clazz.getMethod("dummyMethod", List.class, List.class, List.class,
+ final Class<?> clazz = getClass();
+ final Method method = clazz.getMethod("dummyMethod", List.class, List.class, List.class,
List.class, List.class, List.class, List.class, List[].class, List[].class,
List[].class, List[].class, List[].class, List[].class, List[].class);
- Type[] types = method.getGenericParameterTypes();
+ final Type[] types = method.getGenericParameterTypes();
// list0 = list0;
delegateBooleanAssertion(types, 0, 0, true);
list1 = list0;
@@ -323,17 +323,17 @@ public class TypeUtilsTest<B> {
delegateBooleanAssertion(types, 13, 12, false);
// list13 = list13;
delegateBooleanAssertion(types, 13, 13, true);
- Type disType = getClass().getField("dis").getGenericType();
+ final Type disType = getClass().getField("dis").getGenericType();
// Reporter.log( ( ( ParameterizedType ) disType
// ).getOwnerType().getClass().toString() );
- Type datType = getClass().getField("dat").getGenericType();
- Type daType = getClass().getField("da").getGenericType();
- Type uhderType = getClass().getField("uhder").getGenericType();
- Type dingType = getClass().getField("ding").getGenericType();
- Type testerType = getClass().getField("tester").getGenericType();
- Type tester2Type = getClass().getField("tester2").getGenericType();
- Type dat2Type = getClass().getField("dat2").getGenericType();
- Type dat3Type = getClass().getField("dat3").getGenericType();
+ final Type datType = getClass().getField("dat").getGenericType();
+ final Type daType = getClass().getField("da").getGenericType();
+ final Type uhderType = getClass().getField("uhder").getGenericType();
+ final Type dingType = getClass().getField("ding").getGenericType();
+ final Type testerType = getClass().getField("tester").getGenericType();
+ final Type tester2Type = getClass().getField("tester2").getGenericType();
+ final Type dat2Type = getClass().getField("dat2").getGenericType();
+ final Type dat3Type = getClass().getField("dat3").getGenericType();
dis = dat;
Assert.assertTrue(TypeUtils.isAssignable(datType, disType));
// dis = da;
@@ -353,13 +353,13 @@ public class TypeUtilsTest<B> {
Assert.assertFalse(TypeUtils.isAssignable(datType, dat2Type));
// dat = dat3;
Assert.assertFalse(TypeUtils.isAssignable(dat3Type, datType));
- char ch = 0;
- boolean bo = false;
- byte by = 0;
- short sh = 0;
+ final char ch = 0;
+ final boolean bo = false;
+ final byte by = 0;
+ final short sh = 0;
int in = 0;
long lo = 0;
- float fl = 0;
+ final float fl = 0;
double du = 0;
du = ch;
Assert.assertTrue(TypeUtils.isAssignable(char.class, double.class));
@@ -383,17 +383,17 @@ public class TypeUtilsTest<B> {
Assert.assertFalse(TypeUtils.isAssignable(Integer.class, Long.class));
in = Integer.valueOf(0);
Assert.assertTrue(TypeUtils.isAssignable(Integer.class, int.class));
- Integer inte = in;
+ final Integer inte = in;
Assert.assertTrue(TypeUtils.isAssignable(int.class, Integer.class));
Assert.assertTrue(TypeUtils.isAssignable(int.class, Number.class));
Assert.assertTrue(TypeUtils.isAssignable(int.class, Object.class));
- Type intComparableType = getClass().getField("intComparable").getGenericType();
+ final Type intComparableType = getClass().getField("intComparable").getGenericType();
intComparable = 1;
Assert.assertTrue(TypeUtils.isAssignable(int.class, intComparableType));
Assert.assertTrue(TypeUtils.isAssignable(int.class, Comparable.class));
- Serializable ser = 1;
+ final Serializable ser = 1;
Assert.assertTrue(TypeUtils.isAssignable(int.class, Serializable.class));
- Type longComparableType = getClass().getField("longComparable").getGenericType();
+ final Type longComparableType = getClass().getField("longComparable").getGenericType();
// longComparable = 1;
Assert.assertFalse(TypeUtils.isAssignable(int.class, longComparableType));
// longComparable = Integer.valueOf( 0 );
@@ -401,24 +401,24 @@ public class TypeUtilsTest<B> {
// int[] ia;
// long[] la = ia;
Assert.assertFalse(TypeUtils.isAssignable(int[].class, long[].class));
- Integer[] ia = null;
- Type caType = getClass().getField("intWildcardComparable").getGenericType();
+ final Integer[] ia = null;
+ final Type caType = getClass().getField("intWildcardComparable").getGenericType();
intWildcardComparable = ia;
Assert.assertTrue(TypeUtils.isAssignable(Integer[].class, caType));
// int[] ina = ia;
Assert.assertFalse(TypeUtils.isAssignable(Integer[].class, int[].class));
- int[] ina = null;
+ final int[] ina = null;
Object[] oa;
// oa = ina;
Assert.assertFalse(TypeUtils.isAssignable(int[].class, Object[].class));
oa = new Integer[0];
Assert.assertTrue(TypeUtils.isAssignable(Integer[].class, Object[].class));
- Type bClassType = AClass.class.getField("bClass").getGenericType();
- Type cClassType = AClass.class.getField("cClass").getGenericType();
- Type dClassType = AClass.class.getField("dClass").getGenericType();
- Type eClassType = AClass.class.getField("eClass").getGenericType();
- Type fClassType = AClass.class.getField("fClass").getGenericType();
- AClass aClass = new AClass(new AAClass<String>());
+ final Type bClassType = AClass.class.getField("bClass").getGenericType();
+ final Type cClassType = AClass.class.getField("cClass").getGenericType();
+ final Type dClassType = AClass.class.getField("dClass").getGenericType();
+ final Type eClassType = AClass.class.getField("eClass").getGenericType();
+ final Type fClassType = AClass.class.getField("fClass").getGenericType();
+ final AClass aClass = new AClass(new AAClass<String>());
aClass.bClass = aClass.cClass;
Assert.assertTrue(TypeUtils.isAssignable(cClassType, bClassType));
aClass.bClass = aClass.dClass;
@@ -442,9 +442,9 @@ public class TypeUtilsTest<B> {
}
public void delegateBooleanAssertion(final Type[] types, final int i2, final int i1, final boolean expected) {
- Type type1 = types[i1];
- Type type2 = types[i2];
- boolean isAssignable = TypeUtils.isAssignable(type2, type1);
+ final Type type1 = types[i1];
+ final Type type2 = types[i2];
+ final boolean isAssignable = TypeUtils.isAssignable(type2, type1);
if (expected) {
Assert.assertTrue("[" + i1 + ", " + i2 + "]: From "
@@ -460,8 +460,8 @@ public class TypeUtilsTest<B> {
@SuppressWarnings("boxing") // boxing is deliberate here
@Test
public void testIsInstance() throws SecurityException, NoSuchFieldException {
- Type intComparableType = getClass().getField("intComparable").getGenericType();
- Type uriComparableType = getClass().getField("uriComparable").getGenericType();
+ final Type intComparableType = getClass().getField("intComparable").getGenericType();
+ final Type uriComparableType = getClass().getField("uriComparable").getGenericType();
intComparable = 1;
Assert.assertTrue(TypeUtils.isInstance(1, intComparableType));
// uriComparable = 1;
@@ -490,7 +490,7 @@ public class TypeUtilsTest<B> {
Assert.assertEquals("Type argument of Comparable from int: " + typeArg, Integer.class,
typeVarAssigns.get(treeSetTypeVar));
- Collection<Integer> col = Arrays.asList(new Integer[0]);
+ final Collection<Integer> col = Arrays.asList(new Integer[0]);
typeVarAssigns = TypeUtils.getTypeArguments(List.class, Collection.class);
treeSetTypeVar = Comparable.class.getTypeParameters()[0];
Assert.assertFalse("Type var assigns for Collection from List: " + typeVarAssigns,
@@ -510,8 +510,8 @@ public class TypeUtilsTest<B> {
@Test
public void testTypesSatisfyVariables() throws SecurityException, NoSuchFieldException,
NoSuchMethodException {
- Map<TypeVariable<?>, Type> typeVarAssigns = new HashMap<TypeVariable<?>, Type>();
- Integer max = TypeUtilsTest.stub();
+ final Map<TypeVariable<?>, Type> typeVarAssigns = new HashMap<TypeVariable<?>, Type>();
+ final Integer max = TypeUtilsTest.stub();
typeVarAssigns.put(getClass().getMethod("stub").getTypeParameters()[0], Integer.class);
Assert.assertTrue(TypeUtils.typesSatisfyVariables(typeVarAssigns));
typeVarAssigns.clear();
@@ -525,11 +525,11 @@ public class TypeUtilsTest<B> {
@Test
public void testDetermineTypeVariableAssignments() throws SecurityException,
NoSuchFieldException, NoSuchMethodException {
- ParameterizedType iterableType = (ParameterizedType) getClass().getField("iterable")
+ final ParameterizedType iterableType = (ParameterizedType) getClass().getField("iterable")
.getGenericType();
- Map<TypeVariable<?>, Type> typeVarAssigns = TypeUtils.determineTypeArguments(TreeSet.class,
+ final Map<TypeVariable<?>, Type> typeVarAssigns = TypeUtils.determineTypeArguments(TreeSet.class,
iterableType);
- TypeVariable<?> treeSetTypeVar = TreeSet.class.getTypeParameters()[0];
+ final TypeVariable<?> treeSetTypeVar = TreeSet.class.getTypeParameters()[0];
Assert.assertTrue(typeVarAssigns.containsKey(treeSetTypeVar));
Assert.assertEquals(iterableType.getActualTypeArguments()[0], typeVarAssigns
.get(treeSetTypeVar));
@@ -537,12 +537,12 @@ public class TypeUtilsTest<B> {
@Test
public void testGetRawType() throws SecurityException, NoSuchFieldException {
- Type stringParentFieldType = GenericTypeHolder.class.getDeclaredField("stringParent")
+ final Type stringParentFieldType = GenericTypeHolder.class.getDeclaredField("stringParent")
.getGenericType();
- Type integerParentFieldType = GenericTypeHolder.class.getDeclaredField("integerParent")
+ final Type integerParentFieldType = GenericTypeHolder.class.getDeclaredField("integerParent")
.getGenericType();
- Type foosFieldType = GenericTypeHolder.class.getDeclaredField("foos").getGenericType();
- Type genericParentT = GenericParent.class.getTypeParameters()[0];
+ final Type foosFieldType = GenericTypeHolder.class.getDeclaredField("foos").getGenericType();
+ final Type genericParentT = GenericParent.class.getTypeParameters()[0];
Assert.assertEquals(GenericParent.class, TypeUtils.getRawType(stringParentFieldType, null));
Assert
.assertEquals(GenericParent.class, TypeUtils.getRawType(integerParentFieldType,
@@ -588,11 +588,11 @@ public class TypeUtilsTest<B> {
@Test
public void testIsArrayGenericTypes() throws Exception {
- Method method = getClass().getMethod("dummyMethod", List.class, List.class, List.class,
+ final Method method = getClass().getMethod("dummyMethod", List.class, List.class, List.class,
List.class, List.class, List.class, List.class, List[].class, List[].class,
List[].class, List[].class, List[].class, List[].class, List[].class);
- Type[] types = method.getGenericParameterTypes();
+ final Type[] types = method.getGenericParameterTypes();
Assert.assertFalse(TypeUtils.isArrayType(types[0]));
Assert.assertFalse(TypeUtils.isArrayType(types[1]));
@@ -633,11 +633,11 @@ public class TypeUtilsTest<B> {
@Test
public void testGetArrayComponentType() throws Exception {
- Method method = getClass().getMethod("dummyMethod", List.class, List.class, List.class,
+ final Method method = getClass().getMethod("dummyMethod", List.class, List.class, List.class,
List.class, List.class, List.class, List.class, List[].class, List[].class,
List[].class, List[].class, List[].class, List[].class, List[].class);
- Type[] types = method.getGenericParameterTypes();
+ final Type[] types = method.getGenericParameterTypes();
Assert.assertNull(TypeUtils.getArrayComponentType(types[0]));
Assert.assertNull(TypeUtils.getArrayComponentType(types[1]));
@@ -657,8 +657,8 @@ public class TypeUtilsTest<B> {
@Test
public void testLang820() throws Exception {
- Type[] typeArray = {String.class, String.class};
- Type[] expectedArray = {String.class};
+ final Type[] typeArray = {String.class, String.class};
+ final Type[] expectedArray = {String.class};
Assert.assertArrayEquals(expectedArray, TypeUtils.normalizeUpperBounds(typeArray));
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/CompositeFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/CompositeFormatTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/CompositeFormatTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/CompositeFormatTest.java Tue Jan 22 07:09:45 2013
@@ -36,7 +36,7 @@ public class CompositeFormatTest {
@Test
public void testCompositeFormat() {
- Format parser = new Format() {
+ final Format parser = new Format() {
@Override
public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
throw new UnsupportedOperationException("Not implemented");
@@ -48,7 +48,7 @@ public class CompositeFormatTest {
}
};
- Format formatter = new Format() {
+ final Format formatter = new Format() {
@Override
public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
return null; // do nothing
@@ -60,7 +60,7 @@ public class CompositeFormatTest {
}
};
- CompositeFormat composite = new CompositeFormat(parser, formatter);
+ final CompositeFormat composite = new CompositeFormat(parser, formatter);
composite.parseObject("", null);
composite.format(new Object(), new StringBuffer(), null);
@@ -70,10 +70,10 @@ public class CompositeFormatTest {
@Test
public void testUsage() throws Exception {
- Format f1 = new SimpleDateFormat("MMddyyyy", Locale.ENGLISH);
- Format f2 = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH);
- CompositeFormat c = new CompositeFormat(f1, f2);
- String testString = "January 3, 2005";
+ final Format f1 = new SimpleDateFormat("MMddyyyy", Locale.ENGLISH);
+ final Format f2 = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH);
+ final CompositeFormat c = new CompositeFormat(f1, f2);
+ final String testString = "January 3, 2005";
assertEquals(testString, c.format(c.parseObject("01032005")));
assertEquals(testString, c.reformat("01032005"));
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java Tue Jan 22 07:09:45 2013
@@ -59,8 +59,8 @@ public class ExtendedMessageFormatTest {
*/
@Test
public void testExtendedFormats() {
- String pattern = "Lower: {0,lower} Upper: {1,upper}";
- ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, registry);
+ final String pattern = "Lower: {0,lower} Upper: {1,upper}";
+ final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, registry);
assertPatternsEqual("TOPATTERN", pattern, emf.toPattern());
assertEquals("Lower: foo Upper: BAR", emf.format(new Object[] {"foo", "bar"}));
assertEquals("Lower: foo Upper: BAR", emf.format(new Object[] {"Foo", "Bar"}));
@@ -74,8 +74,8 @@ public class ExtendedMessageFormatTest {
*/
@Test
public void testEscapedQuote_LANG_477() {
- String pattern = "it''s a {0,lower} 'test'!";
- ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, registry);
+ final String pattern = "it''s a {0,lower} 'test'!";
+ final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, registry);
assertEquals("it's a dummy test!", emf.format(new Object[] {"DUMMY"}));
}
@@ -84,21 +84,21 @@ public class ExtendedMessageFormatTest {
*/
@Test
public void testExtendedAndBuiltInFormats() {
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.set(2007, Calendar.JANUARY, 23, 18, 33, 05);
- Object[] args = new Object[] {"John Doe", cal.getTime(), Double.valueOf("12345.67")};
- String builtinsPattern = "DOB: {1,date,short} Salary: {2,number,currency}";
- String extendedPattern = "Name: {0,upper} ";
- String pattern = extendedPattern + builtinsPattern;
+ final Object[] args = new Object[] {"John Doe", cal.getTime(), Double.valueOf("12345.67")};
+ final String builtinsPattern = "DOB: {1,date,short} Salary: {2,number,currency}";
+ final String extendedPattern = "Name: {0,upper} ";
+ final String pattern = extendedPattern + builtinsPattern;
- HashSet<Locale> testLocales = new HashSet<Locale>();
+ final HashSet<Locale> testLocales = new HashSet<Locale>();
testLocales.addAll(Arrays.asList(DateFormat.getAvailableLocales()));
testLocales.retainAll(Arrays.asList(NumberFormat.getAvailableLocales()));
testLocales.add(null);
- for (Locale locale : testLocales) {
- MessageFormat builtins = createMessageFormat(builtinsPattern, locale);
- String expectedPattern = extendedPattern + builtins.toPattern();
+ for (final Locale locale : testLocales) {
+ final MessageFormat builtins = createMessageFormat(builtinsPattern, locale);
+ final String expectedPattern = extendedPattern + builtins.toPattern();
DateFormat df = null;
NumberFormat nf = null;
ExtendedMessageFormat emf = null;
@@ -111,7 +111,7 @@ public class ExtendedMessageFormatTest {
nf = NumberFormat.getCurrencyInstance(locale);
emf = new ExtendedMessageFormat(pattern, locale, registry);
}
- StringBuilder expected = new StringBuilder();
+ final StringBuilder expected = new StringBuilder();
expected.append("Name: ");
expected.append(args[0].toString().toUpperCase());
expected.append(" DOB: ");
@@ -183,17 +183,17 @@ public class ExtendedMessageFormatTest {
*/
@Test
public void testBuiltInChoiceFormat() {
- Object[] values = new Number[] {Integer.valueOf(1), Double.valueOf("2.2"), Double.valueOf("1234.5")};
+ final Object[] values = new Number[] {Integer.valueOf(1), Double.valueOf("2.2"), Double.valueOf("1234.5")};
String choicePattern = null;
- Locale[] availableLocales = ChoiceFormat.getAvailableLocales();
+ final Locale[] availableLocales = ChoiceFormat.getAvailableLocales();
choicePattern = "{0,choice,1#One|2#Two|3#Many {0,number}}";
- for (Object value : values) {
+ for (final Object value : values) {
checkBuiltInFormat(value + ": " + choicePattern, new Object[] {value}, availableLocales);
}
choicePattern = "{0,choice,1#''One''|2#\"Two\"|3#''{Many}'' {0,number}}";
- for (Object value : values) {
+ for (final Object value : values) {
checkBuiltInFormat(value + ": " + choicePattern, new Object[] {value}, availableLocales);
}
}
@@ -203,10 +203,10 @@ public class ExtendedMessageFormatTest {
*/
@Test
public void testBuiltInDateTimeFormat() {
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.set(2007, Calendar.JANUARY, 23, 18, 33, 05);
- Object[] args = new Object[] {cal.getTime()};
- Locale[] availableLocales = DateFormat.getAvailableLocales();
+ final Object[] args = new Object[] {cal.getTime()};
+ final Locale[] availableLocales = DateFormat.getAvailableLocales();
checkBuiltInFormat("1: {0,date,short}", args, availableLocales);
checkBuiltInFormat("2: {0,date,medium}", args, availableLocales);
@@ -224,11 +224,11 @@ public class ExtendedMessageFormatTest {
@Test
public void testOverriddenBuiltinFormat() {
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.set(2007, Calendar.JANUARY, 23);
- Object[] args = new Object[] {cal.getTime()};
- Locale[] availableLocales = DateFormat.getAvailableLocales();
- Map<String, ? extends FormatFactory> registry = Collections.singletonMap("date", new OverrideShortDateFormatFactory());
+ final Object[] args = new Object[] {cal.getTime()};
+ final Locale[] availableLocales = DateFormat.getAvailableLocales();
+ final Map<String, ? extends FormatFactory> registry = Collections.singletonMap("date", new OverrideShortDateFormatFactory());
//check the non-overridden builtins:
checkBuiltInFormat("1: {0,date}", registry, args, availableLocales);
@@ -239,10 +239,10 @@ public class ExtendedMessageFormatTest {
//check the overridden format:
for (int i = -1; i < availableLocales.length; i++) {
- Locale locale = i < 0 ? null : availableLocales[i];
- MessageFormat dateDefault = createMessageFormat("{0,date}", locale);
- String pattern = "{0,date,short}";
- ExtendedMessageFormat dateShort = new ExtendedMessageFormat(pattern, locale, registry);
+ final Locale locale = i < 0 ? null : availableLocales[i];
+ final MessageFormat dateDefault = createMessageFormat("{0,date}", locale);
+ final String pattern = "{0,date,short}";
+ final ExtendedMessageFormat dateShort = new ExtendedMessageFormat(pattern, locale, registry);
assertEquals("overridden date,short format", dateDefault.format(args), dateShort.format(args));
assertEquals("overridden date,short pattern", pattern, dateShort.toPattern());
}
@@ -253,8 +253,8 @@ public class ExtendedMessageFormatTest {
*/
@Test
public void testBuiltInNumberFormat() {
- Object[] args = new Object[] {Double.valueOf("6543.21")};
- Locale[] availableLocales = NumberFormat.getAvailableLocales();
+ final Object[] args = new Object[] {Double.valueOf("6543.21")};
+ final Locale[] availableLocales = NumberFormat.getAvailableLocales();
checkBuiltInFormat("1: {0,number}", args, availableLocales);
checkBuiltInFormat("2: {0,number,integer}", args, availableLocales);
checkBuiltInFormat("3: {0,number,currency}", args, availableLocales);
@@ -267,11 +267,11 @@ public class ExtendedMessageFormatTest {
*/
@Test
public void testEqualsHashcode() {
- Map<String, ? extends FormatFactory> registry = Collections.singletonMap("testfmt", new LowerCaseFormatFactory());
- Map<String, ? extends FormatFactory> otherRegitry = Collections.singletonMap("testfmt", new UpperCaseFormatFactory());
+ final Map<String, ? extends FormatFactory> registry = Collections.singletonMap("testfmt", new LowerCaseFormatFactory());
+ final Map<String, ? extends FormatFactory> otherRegitry = Collections.singletonMap("testfmt", new UpperCaseFormatFactory());
- String pattern = "Pattern: {0,testfmt}";
- ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, Locale.US, registry);
+ final String pattern = "Pattern: {0,testfmt}";
+ final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, Locale.US, registry);
ExtendedMessageFormat other = null;
@@ -324,7 +324,7 @@ public class ExtendedMessageFormatTest {
*/
private void checkBuiltInFormat(final String pattern, final Map<String, ?> registry, final Object[] args, final Locale[] locales) {
checkBuiltInFormat(pattern, registry, args, (Locale) null);
- for (Locale locale : locales) {
+ for (final Locale locale : locales) {
checkBuiltInFormat(pattern, registry, args, locale);
}
}
@@ -338,13 +338,13 @@ public class ExtendedMessageFormatTest {
* @param locale Locale
*/
private void checkBuiltInFormat(final String pattern, final Map<String, ?> registry, final Object[] args, final Locale locale) {
- StringBuilder buffer = new StringBuilder();
+ final StringBuilder buffer = new StringBuilder();
buffer.append("Pattern=[");
buffer.append(pattern);
buffer.append("], locale=[");
buffer.append(locale);
buffer.append("]");
- MessageFormat mf = createMessageFormat(pattern, locale);
+ final MessageFormat mf = createMessageFormat(pattern, locale);
// System.out.println(buffer + ", result=[" + mf.format(args) +"]");
ExtendedMessageFormat emf = null;
if (locale == null) {
@@ -370,7 +370,7 @@ public class ExtendedMessageFormatTest {
* @return MessageFormat
*/
private MessageFormat createMessageFormat(final String pattern, final Locale locale) {
- MessageFormat result = new MessageFormat(pattern);
+ final MessageFormat result = new MessageFormat(pattern);
if (locale != null) {
result.setLocale(locale);
result.applyPattern(pattern);
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/FormattableUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/FormattableUtilsTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/FormattableUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/FormattableUtilsTest.java Tue Jan 22 07:09:45 2013
@@ -46,7 +46,7 @@ public class FormattableUtilsTest {
@Test
public void testAlternatePadCharacter() {
- char pad='_';
+ final char pad='_';
assertEquals("foo", FormattableUtils.append("foo", new Formatter(), 0, -1, -1, pad).toString());
assertEquals("fo", FormattableUtils.append("foo", new Formatter(), 0, -1, 2, pad).toString());
assertEquals("_foo", FormattableUtils.append("foo", new Formatter(), 0, 4, -1, pad).toString());