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 [9/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/apac...
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java Tue Jan 22 07:09:45 2013
@@ -45,7 +45,7 @@ public class CompareToBuilderTest {
if (!(o instanceof TestObject)) {
return false;
}
- TestObject rhs = (TestObject) o;
+ final TestObject rhs = (TestObject) o;
return a == rhs.a;
}
@@ -84,7 +84,7 @@ public class CompareToBuilderTest {
if (!(o instanceof TestSubObject)) {
return false;
}
- TestSubObject rhs = (TestSubObject) o;
+ final TestSubObject rhs = (TestSubObject) o;
return super.equals(o) && b == rhs.b;
}
}
@@ -100,8 +100,8 @@ public class CompareToBuilderTest {
@Test
public void testReflectionCompare() {
- TestObject o1 = new TestObject(4);
- TestObject o2 = new TestObject(4);
+ final TestObject o1 = new TestObject(4);
+ final TestObject o2 = new TestObject(4);
assertTrue(CompareToBuilder.reflectionCompare(o1, o1) == 0);
assertTrue(CompareToBuilder.reflectionCompare(o1, o2) == 0);
o2.setA(5);
@@ -111,14 +111,14 @@ public class CompareToBuilderTest {
@Test(expected=NullPointerException.class)
public void testReflectionCompareEx1() {
- TestObject o1 = new TestObject(4);
+ final TestObject o1 = new TestObject(4);
CompareToBuilder.reflectionCompare(o1, null);
}
@Test(expected=ClassCastException.class)
public void testReflectionCompareEx2() {
- TestObject o1 = new TestObject(4);
- Object o2 = new Object();
+ final TestObject o1 = new TestObject(4);
+ final Object o2 = new Object();
CompareToBuilder.reflectionCompare(o1, o2);
}
@@ -129,7 +129,7 @@ public class CompareToBuilderTest {
@Test
public void testReflectionHierarchyCompareExcludeFields() {
- String[] excludeFields = new String[] { "b" };
+ final String[] excludeFields = new String[] { "b" };
testReflectionHierarchyCompare(true, excludeFields);
TestSubObject x;
@@ -181,12 +181,12 @@ public class CompareToBuilderTest {
}
private void testReflectionHierarchyCompare(final boolean testTransients, final String[] excludeFields) {
- TestObject to1 = new TestObject(1);
- TestObject to2 = new TestObject(2);
- TestObject to3 = new TestObject(3);
- TestSubObject tso1 = new TestSubObject(1, 1);
- TestSubObject tso2 = new TestSubObject(2, 2);
- TestSubObject tso3 = new TestSubObject(3, 3);
+ final TestObject to1 = new TestObject(1);
+ final TestObject to2 = new TestObject(2);
+ final TestObject to3 = new TestObject(3);
+ final TestSubObject tso1 = new TestSubObject(1, 1);
+ final TestSubObject tso2 = new TestSubObject(2, 2);
+ final TestSubObject tso3 = new TestSubObject(3, 3);
assertReflectionCompareContract(to1, to1, to1, false, excludeFields);
assertReflectionCompareContract(to1, to2, to3, false, excludeFields);
@@ -248,8 +248,8 @@ public class CompareToBuilderTest {
@Test
public void testAppendSuper() {
- TestObject o1 = new TestObject(4);
- TestObject o2 = new TestObject(5);
+ final TestObject o1 = new TestObject(4);
+ final TestObject o2 = new TestObject(5);
assertTrue(new CompareToBuilder().appendSuper(0).append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().appendSuper(0).append(o1, o2).toComparison() < 0);
assertTrue(new CompareToBuilder().appendSuper(0).append(o2, o1).toComparison() > 0);
@@ -263,8 +263,8 @@ public class CompareToBuilderTest {
@Test
public void testObject() {
- TestObject o1 = new TestObject(4);
- TestObject o2 = new TestObject(4);
+ final TestObject o1 = new TestObject(4);
+ final TestObject o2 = new TestObject(4);
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() == 0);
o2.setA(5);
@@ -278,8 +278,8 @@ public class CompareToBuilderTest {
@Test
public void testObjectBuild() {
- TestObject o1 = new TestObject(4);
- TestObject o2 = new TestObject(4);
+ final TestObject o1 = new TestObject(4);
+ final TestObject o2 = new TestObject(4);
assertEquals(Integer.valueOf(0), new CompareToBuilder().append(o1, o1).build());
assertEquals(Integer.valueOf(0), new CompareToBuilder().append(o1, o2).build());
o2.setA(5);
@@ -293,14 +293,14 @@ public class CompareToBuilderTest {
@Test(expected=ClassCastException.class)
public void testObjectEx2() {
- TestObject o1 = new TestObject(4);
- Object o2 = new Object();
+ final TestObject o1 = new TestObject(4);
+ final Object o2 = new Object();
new CompareToBuilder().append(o1, o2);
}
@Test
public void testObjectComparator() {
- String o1 = "Fred";
+ final String o1 = "Fred";
String o2 = "Fred";
assertTrue(new CompareToBuilder().append(o1, o1, String.CASE_INSENSITIVE_ORDER).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2, String.CASE_INSENSITIVE_ORDER).toComparison() == 0);
@@ -318,7 +318,7 @@ public class CompareToBuilderTest {
@Test
public void testObjectComparatorNull() {
- String o1 = "Fred";
+ final String o1 = "Fred";
String o2 = "Fred";
assertTrue(new CompareToBuilder().append(o1, o1, null).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2, null).toComparison() == 0);
@@ -333,8 +333,8 @@ public class CompareToBuilderTest {
@Test
public void testLong() {
- long o1 = 1L;
- long o2 = 2L;
+ final long o1 = 1L;
+ final long o2 = 2L;
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
@@ -346,8 +346,8 @@ public class CompareToBuilderTest {
@Test
public void testInt() {
- int o1 = 1;
- int o2 = 2;
+ final int o1 = 1;
+ final int o2 = 2;
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
@@ -359,8 +359,8 @@ public class CompareToBuilderTest {
@Test
public void testShort() {
- short o1 = 1;
- short o2 = 2;
+ final short o1 = 1;
+ final short o2 = 2;
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
@@ -372,8 +372,8 @@ public class CompareToBuilderTest {
@Test
public void testChar() {
- char o1 = 1;
- char o2 = 2;
+ final char o1 = 1;
+ final char o2 = 2;
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
@@ -385,8 +385,8 @@ public class CompareToBuilderTest {
@Test
public void testByte() {
- byte o1 = 1;
- byte o2 = 2;
+ final byte o1 = 1;
+ final byte o2 = 2;
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
@@ -398,8 +398,8 @@ public class CompareToBuilderTest {
@Test
public void testDouble() {
- double o1 = 1;
- double o2 = 2;
+ final double o1 = 1;
+ final double o2 = 2;
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
@@ -419,8 +419,8 @@ public class CompareToBuilderTest {
@Test
public void testFloat() {
- float o1 = 1;
- float o2 = 2;
+ final float o1 = 1;
+ final float o2 = 2;
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
@@ -440,8 +440,8 @@ public class CompareToBuilderTest {
@Test
public void testBoolean() {
- boolean o1 = true;
- boolean o2 = false;
+ final boolean o1 = true;
+ final boolean o2 = false;
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o2, o2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() > 0);
@@ -450,13 +450,13 @@ public class CompareToBuilderTest {
@Test
public void testObjectArray() {
- TestObject[] obj1 = new TestObject[2];
+ final TestObject[] obj1 = new TestObject[2];
obj1[0] = new TestObject(4);
obj1[1] = new TestObject(5);
- TestObject[] obj2 = new TestObject[2];
+ final TestObject[] obj2 = new TestObject[2];
obj2[0] = new TestObject(4);
obj2[1] = new TestObject(5);
- TestObject[] obj3 = new TestObject[3];
+ final TestObject[] obj3 = new TestObject[3];
obj3[0] = new TestObject(4);
obj3[1] = new TestObject(5);
obj3[2] = new TestObject(6);
@@ -477,13 +477,13 @@ public class CompareToBuilderTest {
@Test
public void testLongArray() {
- long[] obj1 = new long[2];
+ final long[] obj1 = new long[2];
obj1[0] = 5L;
obj1[1] = 6L;
- long[] obj2 = new long[2];
+ final long[] obj2 = new long[2];
obj2[0] = 5L;
obj2[1] = 6L;
- long[] obj3 = new long[3];
+ final long[] obj3 = new long[3];
obj3[0] = 5L;
obj3[1] = 6L;
obj3[2] = 7L;
@@ -504,13 +504,13 @@ public class CompareToBuilderTest {
@Test
public void testIntArray() {
- int[] obj1 = new int[2];
+ final int[] obj1 = new int[2];
obj1[0] = 5;
obj1[1] = 6;
- int[] obj2 = new int[2];
+ final int[] obj2 = new int[2];
obj2[0] = 5;
obj2[1] = 6;
- int[] obj3 = new int[3];
+ final int[] obj3 = new int[3];
obj3[0] = 5;
obj3[1] = 6;
obj3[2] = 7;
@@ -531,13 +531,13 @@ public class CompareToBuilderTest {
@Test
public void testShortArray() {
- short[] obj1 = new short[2];
+ final short[] obj1 = new short[2];
obj1[0] = 5;
obj1[1] = 6;
- short[] obj2 = new short[2];
+ final short[] obj2 = new short[2];
obj2[0] = 5;
obj2[1] = 6;
- short[] obj3 = new short[3];
+ final short[] obj3 = new short[3];
obj3[0] = 5;
obj3[1] = 6;
obj3[2] = 7;
@@ -558,13 +558,13 @@ public class CompareToBuilderTest {
@Test
public void testCharArray() {
- char[] obj1 = new char[2];
+ final char[] obj1 = new char[2];
obj1[0] = 5;
obj1[1] = 6;
- char[] obj2 = new char[2];
+ final char[] obj2 = new char[2];
obj2[0] = 5;
obj2[1] = 6;
- char[] obj3 = new char[3];
+ final char[] obj3 = new char[3];
obj3[0] = 5;
obj3[1] = 6;
obj3[2] = 7;
@@ -585,13 +585,13 @@ public class CompareToBuilderTest {
@Test
public void testByteArray() {
- byte[] obj1 = new byte[2];
+ final byte[] obj1 = new byte[2];
obj1[0] = 5;
obj1[1] = 6;
- byte[] obj2 = new byte[2];
+ final byte[] obj2 = new byte[2];
obj2[0] = 5;
obj2[1] = 6;
- byte[] obj3 = new byte[3];
+ final byte[] obj3 = new byte[3];
obj3[0] = 5;
obj3[1] = 6;
obj3[2] = 7;
@@ -612,13 +612,13 @@ public class CompareToBuilderTest {
@Test
public void testDoubleArray() {
- double[] obj1 = new double[2];
+ final double[] obj1 = new double[2];
obj1[0] = 5;
obj1[1] = 6;
- double[] obj2 = new double[2];
+ final double[] obj2 = new double[2];
obj2[0] = 5;
obj2[1] = 6;
- double[] obj3 = new double[3];
+ final double[] obj3 = new double[3];
obj3[0] = 5;
obj3[1] = 6;
obj3[2] = 7;
@@ -639,13 +639,13 @@ public class CompareToBuilderTest {
@Test
public void testFloatArray() {
- float[] obj1 = new float[2];
+ final float[] obj1 = new float[2];
obj1[0] = 5;
obj1[1] = 6;
- float[] obj2 = new float[2];
+ final float[] obj2 = new float[2];
obj2[0] = 5;
obj2[1] = 6;
- float[] obj3 = new float[3];
+ final float[] obj3 = new float[3];
obj3[0] = 5;
obj3[1] = 6;
obj3[2] = 7;
@@ -666,13 +666,13 @@ public class CompareToBuilderTest {
@Test
public void testBooleanArray() {
- boolean[] obj1 = new boolean[2];
+ final boolean[] obj1 = new boolean[2];
obj1[0] = true;
obj1[1] = false;
- boolean[] obj2 = new boolean[2];
+ final boolean[] obj2 = new boolean[2];
obj2[0] = true;
obj2[1] = false;
- boolean[] obj3 = new boolean[3];
+ final boolean[] obj3 = new boolean[3];
obj3[0] = true;
obj3[1] = false;
obj3[2] = true;
@@ -693,9 +693,9 @@ public class CompareToBuilderTest {
@Test
public void testMultiLongArray() {
- long[][] array1 = new long[2][2];
- long[][] array2 = new long[2][2];
- long[][] array3 = new long[2][3];
+ final long[][] array1 = new long[2][2];
+ final long[][] array2 = new long[2][2];
+ final long[][] array3 = new long[2][3];
for (int i = 0; i < array1.length; ++i) {
for (int j = 0; j < array1[0].length; j++) {
array1[i][j] = (i + 1) * (j + 1);
@@ -717,9 +717,9 @@ public class CompareToBuilderTest {
@Test
public void testMultiIntArray() {
- int[][] array1 = new int[2][2];
- int[][] array2 = new int[2][2];
- int[][] array3 = new int[2][3];
+ final int[][] array1 = new int[2][2];
+ final int[][] array2 = new int[2][2];
+ final int[][] array3 = new int[2][3];
for (int i = 0; i < array1.length; ++i) {
for (int j = 0; j < array1[0].length; j++) {
array1[i][j] = (i + 1) * (j + 1);
@@ -741,9 +741,9 @@ public class CompareToBuilderTest {
@Test
public void testMultiShortArray() {
- short[][] array1 = new short[2][2];
- short[][] array2 = new short[2][2];
- short[][] array3 = new short[2][3];
+ final short[][] array1 = new short[2][2];
+ final short[][] array2 = new short[2][2];
+ final short[][] array3 = new short[2][3];
for (short i = 0; i < array1.length; ++i) {
for (short j = 0; j < array1[0].length; j++) {
array1[i][j] = (short)((i + 1) * (j + 1));
@@ -765,9 +765,9 @@ public class CompareToBuilderTest {
@Test
public void testMultiCharArray() {
- char[][] array1 = new char[2][2];
- char[][] array2 = new char[2][2];
- char[][] array3 = new char[2][3];
+ final char[][] array1 = new char[2][2];
+ final char[][] array2 = new char[2][2];
+ final char[][] array3 = new char[2][3];
for (short i = 0; i < array1.length; ++i) {
for (short j = 0; j < array1[0].length; j++) {
array1[i][j] = (char)((i + 1) * (j + 1));
@@ -789,9 +789,9 @@ public class CompareToBuilderTest {
@Test
public void testMultiByteArray() {
- byte[][] array1 = new byte[2][2];
- byte[][] array2 = new byte[2][2];
- byte[][] array3 = new byte[2][3];
+ final byte[][] array1 = new byte[2][2];
+ final byte[][] array2 = new byte[2][2];
+ final byte[][] array3 = new byte[2][3];
for (byte i = 0; i < array1.length; ++i) {
for (byte j = 0; j < array1[0].length; j++) {
array1[i][j] = (byte)((i + 1) * (j + 1));
@@ -813,9 +813,9 @@ public class CompareToBuilderTest {
@Test
public void testMultiFloatArray() {
- float[][] array1 = new float[2][2];
- float[][] array2 = new float[2][2];
- float[][] array3 = new float[2][3];
+ final float[][] array1 = new float[2][2];
+ final float[][] array2 = new float[2][2];
+ final float[][] array3 = new float[2][3];
for (int i = 0; i < array1.length; ++i) {
for (int j = 0; j < array1[0].length; j++) {
array1[i][j] = (i + 1) * (j + 1);
@@ -837,9 +837,9 @@ public class CompareToBuilderTest {
@Test
public void testMultiDoubleArray() {
- double[][] array1 = new double[2][2];
- double[][] array2 = new double[2][2];
- double[][] array3 = new double[2][3];
+ final double[][] array1 = new double[2][2];
+ final double[][] array2 = new double[2][2];
+ final double[][] array3 = new double[2][3];
for (int i = 0; i < array1.length; ++i) {
for (int j = 0; j < array1[0].length; j++) {
array1[i][j] = (i + 1) * (j + 1);
@@ -861,9 +861,9 @@ public class CompareToBuilderTest {
@Test
public void testMultiBooleanArray() {
- boolean[][] array1 = new boolean[2][2];
- boolean[][] array2 = new boolean[2][2];
- boolean[][] array3 = new boolean[2][3];
+ final boolean[][] array1 = new boolean[2][2];
+ final boolean[][] array2 = new boolean[2][2];
+ final boolean[][] array3 = new boolean[2][3];
for (int i = 0; i < array1.length; ++i) {
for (int j = 0; j < array1[0].length; j++) {
array1[i][j] = i == 1 ^ j == 1;
@@ -885,9 +885,9 @@ public class CompareToBuilderTest {
@Test
public void testRaggedArray() {
- long array1[][] = new long[2][];
- long array2[][] = new long[2][];
- long array3[][] = new long[3][];
+ final long array1[][] = new long[2][];
+ final long array2[][] = new long[2][];
+ final long array3[][] = new long[3][];
for (int i = 0; i < array1.length; ++i) {
array1[i] = new long[2];
array2[i] = new long[2];
@@ -913,9 +913,9 @@ public class CompareToBuilderTest {
@Test
public void testMixedArray() {
- Object array1[] = new Object[2];
- Object array2[] = new Object[2];
- Object array3[] = new Object[2];
+ final Object array1[] = new Object[2];
+ final Object array2[] = new Object[2];
+ final Object array3[] = new Object[2];
for (int i = 0; i < array1.length; ++i) {
array1[i] = new long[2];
array2[i] = new long[2];
@@ -939,20 +939,20 @@ public class CompareToBuilderTest {
@Test
public void testObjectArrayHiddenByObject() {
- TestObject[] array1 = new TestObject[2];
+ final TestObject[] array1 = new TestObject[2];
array1[0] = new TestObject(4);
array1[1] = new TestObject(5);
- TestObject[] array2 = new TestObject[2];
+ final TestObject[] array2 = new TestObject[2];
array2[0] = new TestObject(4);
array2[1] = new TestObject(5);
- TestObject[] array3 = new TestObject[3];
+ final TestObject[] array3 = new TestObject[3];
array3[0] = new TestObject(4);
array3[1] = new TestObject(5);
array3[2] = new TestObject(6);
- Object obj1 = array1;
- Object obj2 = array2;
- Object obj3 = array3;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
+ final Object obj3 = array3;
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
@@ -966,19 +966,19 @@ public class CompareToBuilderTest {
@Test
public void testLongArrayHiddenByObject() {
- long[] array1 = new long[2];
+ final long[] array1 = new long[2];
array1[0] = 5L;
array1[1] = 6L;
- long[] array2 = new long[2];
+ final long[] array2 = new long[2];
array2[0] = 5L;
array2[1] = 6L;
- long[] array3 = new long[3];
+ final long[] array3 = new long[3];
array3[0] = 5L;
array3[1] = 6L;
array3[2] = 7L;
- Object obj1 = array1;
- Object obj2 = array2;
- Object obj3 = array3;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
+ final Object obj3 = array3;
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
@@ -991,19 +991,19 @@ public class CompareToBuilderTest {
@Test
public void testIntArrayHiddenByObject() {
- int[] array1 = new int[2];
+ final int[] array1 = new int[2];
array1[0] = 5;
array1[1] = 6;
- int[] array2 = new int[2];
+ final int[] array2 = new int[2];
array2[0] = 5;
array2[1] = 6;
- int[] array3 = new int[3];
+ final int[] array3 = new int[3];
array3[0] = 5;
array3[1] = 6;
array3[2] = 7;
- Object obj1 = array1;
- Object obj2 = array2;
- Object obj3 = array3;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
+ final Object obj3 = array3;
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
@@ -1016,19 +1016,19 @@ public class CompareToBuilderTest {
@Test
public void testShortArrayHiddenByObject() {
- short[] array1 = new short[2];
+ final short[] array1 = new short[2];
array1[0] = 5;
array1[1] = 6;
- short[] array2 = new short[2];
+ final short[] array2 = new short[2];
array2[0] = 5;
array2[1] = 6;
- short[] array3 = new short[3];
+ final short[] array3 = new short[3];
array3[0] = 5;
array3[1] = 6;
array3[2] = 7;
- Object obj1 = array1;
- Object obj2 = array2;
- Object obj3 = array3;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
+ final Object obj3 = array3;
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
@@ -1041,19 +1041,19 @@ public class CompareToBuilderTest {
@Test
public void testCharArrayHiddenByObject() {
- char[] array1 = new char[2];
+ final char[] array1 = new char[2];
array1[0] = 5;
array1[1] = 6;
- char[] array2 = new char[2];
+ final char[] array2 = new char[2];
array2[0] = 5;
array2[1] = 6;
- char[] array3 = new char[3];
+ final char[] array3 = new char[3];
array3[0] = 5;
array3[1] = 6;
array3[2] = 7;
- Object obj1 = array1;
- Object obj2 = array2;
- Object obj3 = array3;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
+ final Object obj3 = array3;
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
@@ -1066,19 +1066,19 @@ public class CompareToBuilderTest {
@Test
public void testByteArrayHiddenByObject() {
- byte[] array1 = new byte[2];
+ final byte[] array1 = new byte[2];
array1[0] = 5;
array1[1] = 6;
- byte[] array2 = new byte[2];
+ final byte[] array2 = new byte[2];
array2[0] = 5;
array2[1] = 6;
- byte[] array3 = new byte[3];
+ final byte[] array3 = new byte[3];
array3[0] = 5;
array3[1] = 6;
array3[2] = 7;
- Object obj1 = array1;
- Object obj2 = array2;
- Object obj3 = array3;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
+ final Object obj3 = array3;
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
@@ -1091,19 +1091,19 @@ public class CompareToBuilderTest {
@Test
public void testDoubleArrayHiddenByObject() {
- double[] array1 = new double[2];
+ final double[] array1 = new double[2];
array1[0] = 5;
array1[1] = 6;
- double[] array2 = new double[2];
+ final double[] array2 = new double[2];
array2[0] = 5;
array2[1] = 6;
- double[] array3 = new double[3];
+ final double[] array3 = new double[3];
array3[0] = 5;
array3[1] = 6;
array3[2] = 7;
- Object obj1 = array1;
- Object obj2 = array2;
- Object obj3 = array3;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
+ final Object obj3 = array3;
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
@@ -1116,19 +1116,19 @@ public class CompareToBuilderTest {
@Test
public void testFloatArrayHiddenByObject() {
- float[] array1 = new float[2];
+ final float[] array1 = new float[2];
array1[0] = 5;
array1[1] = 6;
- float[] array2 = new float[2];
+ final float[] array2 = new float[2];
array2[0] = 5;
array2[1] = 6;
- float[] array3 = new float[3];
+ final float[] array3 = new float[3];
array3[0] = 5;
array3[1] = 6;
array3[2] = 7;
- Object obj1 = array1;
- Object obj2 = array2;
- Object obj3 = array3;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
+ final Object obj3 = array3;
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
@@ -1141,19 +1141,19 @@ public class CompareToBuilderTest {
@Test
public void testBooleanArrayHiddenByObject() {
- boolean[] array1 = new boolean[2];
+ final boolean[] array1 = new boolean[2];
array1[0] = true;
array1[1] = false;
- boolean[] array2 = new boolean[2];
+ final boolean[] array2 = new boolean[2];
array2[0] = true;
array2[1] = false;
- boolean[] array3 = new boolean[3];
+ final boolean[] array3 = new boolean[3];
array3[0] = true;
array3[1] = false;
array3[2] = true;
- Object obj1 = array1;
- Object obj2 = array2;
- Object obj3 = array3;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
+ final Object obj3 = array3;
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java Tue Jan 22 07:09:45 2013
@@ -65,8 +65,8 @@ public class DefaultToStringStyleTest {
@Test
public void testObject() {
- Integer i3 = Integer.valueOf(3);
- Integer i4 = Integer.valueOf(4);
+ final Integer i3 = Integer.valueOf(3);
+ final Integer i4 = Integer.valueOf(4);
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) null).toString());
assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).toString());
assertEquals(baseStr + "[a=<null>]", new ToStringBuilder(base).append("a", (Object) null).toString());
@@ -83,11 +83,11 @@ public class DefaultToStringStyleTest {
@Test
public void testPerson() {
- Person p = new Person();
+ final Person p = new Person();
p.name = "John Doe";
p.age = 33;
p.smoker = false;
- String pBaseStr = p.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(p));
+ final String pBaseStr = p.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(p));
assertEquals(pBaseStr + "[name=John Doe,age=33,smoker=false]", new ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).toString());
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java Tue Jan 22 07:09:45 2013
@@ -49,7 +49,7 @@ public class EqualsBuilderTest {
return false;
}
- TestObject rhs = (TestObject) o;
+ final TestObject rhs = (TestObject) o;
return a == rhs.a;
}
@@ -84,7 +84,7 @@ public class EqualsBuilderTest {
return false;
}
- TestSubObject rhs = (TestSubObject) o;
+ final TestSubObject rhs = (TestSubObject) o;
return super.equals(o) && b == rhs.b;
}
@@ -150,8 +150,8 @@ public class EqualsBuilderTest {
@Test
public void testReflectionEquals() {
- TestObject o1 = new TestObject(4);
- TestObject o2 = new TestObject(5);
+ final TestObject o1 = new TestObject(4);
+ final TestObject o2 = new TestObject(5);
assertTrue(EqualsBuilder.reflectionEquals(o1, o1));
assertTrue(!EqualsBuilder.reflectionEquals(o1, o2));
o2.setA(4);
@@ -177,18 +177,18 @@ public class EqualsBuilderTest {
}
private void testReflectionHierarchyEquals(final boolean testTransients) {
- TestObject to1 = new TestObject(4);
- TestObject to1Bis = new TestObject(4);
- TestObject to1Ter = new TestObject(4);
- TestObject to2 = new TestObject(5);
- TestEmptySubObject teso = new TestEmptySubObject(4);
- TestTSubObject ttso = new TestTSubObject(4, 1);
- TestTTSubObject tttso = new TestTTSubObject(4, 1, 2);
- TestTTLeafObject ttlo = new TestTTLeafObject(4, 1, 2, 3);
- TestSubObject tso1 = new TestSubObject(1, 4);
- TestSubObject tso1bis = new TestSubObject(1, 4);
- TestSubObject tso1ter = new TestSubObject(1, 4);
- TestSubObject tso2 = new TestSubObject(2, 5);
+ final TestObject to1 = new TestObject(4);
+ final TestObject to1Bis = new TestObject(4);
+ final TestObject to1Ter = new TestObject(4);
+ final TestObject to2 = new TestObject(5);
+ final TestEmptySubObject teso = new TestEmptySubObject(4);
+ final TestTSubObject ttso = new TestTSubObject(4, 1);
+ final TestTTSubObject tttso = new TestTTSubObject(4, 1, 2);
+ final TestTTLeafObject ttlo = new TestTTLeafObject(4, 1, 2, 3);
+ final TestSubObject tso1 = new TestSubObject(1, 4);
+ final TestSubObject tso1bis = new TestSubObject(1, 4);
+ final TestSubObject tso1ter = new TestSubObject(1, 4);
+ final TestSubObject tso2 = new TestSubObject(2, 5);
testReflectionEqualsEquivalenceRelationship(to1, to1Bis, to1Ter, to2, new TestObject(), testTransients);
testReflectionEqualsEquivalenceRelationship(tso1, tso1bis, tso1ter, tso2, new TestSubObject(), testTransients);
@@ -293,8 +293,8 @@ public class EqualsBuilderTest {
@Test
public void testSuper() {
- TestObject o1 = new TestObject(4);
- TestObject o2 = new TestObject(5);
+ final TestObject o1 = new TestObject(4);
+ final TestObject o2 = new TestObject(5);
assertTrue(new EqualsBuilder().appendSuper(true).append(o1, o1).isEquals());
assertFalse(new EqualsBuilder().appendSuper(false).append(o1, o1).isEquals());
assertFalse(new EqualsBuilder().appendSuper(true).append(o1, o2).isEquals());
@@ -303,8 +303,8 @@ public class EqualsBuilderTest {
@Test
public void testObject() {
- TestObject o1 = new TestObject(4);
- TestObject o2 = new TestObject(5);
+ final TestObject o1 = new TestObject(4);
+ final TestObject o2 = new TestObject(5);
assertTrue(new EqualsBuilder().append(o1, o1).isEquals());
assertTrue(!new EqualsBuilder().append(o1, o2).isEquals());
o2.setA(4);
@@ -319,8 +319,8 @@ public class EqualsBuilderTest {
@Test
public void testObjectBuild() {
- TestObject o1 = new TestObject(4);
- TestObject o2 = new TestObject(5);
+ final TestObject o1 = new TestObject(4);
+ final TestObject o2 = new TestObject(5);
assertEquals(Boolean.TRUE, new EqualsBuilder().append(o1, o1).build());
assertEquals(Boolean.FALSE, new EqualsBuilder().append(o1, o2).build());
o2.setA(4);
@@ -335,48 +335,48 @@ public class EqualsBuilderTest {
@Test
public void testLong() {
- long o1 = 1L;
- long o2 = 2L;
+ final long o1 = 1L;
+ final long o2 = 2L;
assertTrue(new EqualsBuilder().append(o1, o1).isEquals());
assertTrue(!new EqualsBuilder().append(o1, o2).isEquals());
}
@Test
public void testInt() {
- int o1 = 1;
- int o2 = 2;
+ final int o1 = 1;
+ final int o2 = 2;
assertTrue(new EqualsBuilder().append(o1, o1).isEquals());
assertTrue(!new EqualsBuilder().append(o1, o2).isEquals());
}
@Test
public void testShort() {
- short o1 = 1;
- short o2 = 2;
+ final short o1 = 1;
+ final short o2 = 2;
assertTrue(new EqualsBuilder().append(o1, o1).isEquals());
assertTrue(!new EqualsBuilder().append(o1, o2).isEquals());
}
@Test
public void testChar() {
- char o1 = 1;
- char o2 = 2;
+ final char o1 = 1;
+ final char o2 = 2;
assertTrue(new EqualsBuilder().append(o1, o1).isEquals());
assertTrue(!new EqualsBuilder().append(o1, o2).isEquals());
}
@Test
public void testByte() {
- byte o1 = 1;
- byte o2 = 2;
+ final byte o1 = 1;
+ final byte o2 = 2;
assertTrue(new EqualsBuilder().append(o1, o1).isEquals());
assertTrue(!new EqualsBuilder().append(o1, o2).isEquals());
}
@Test
public void testDouble() {
- double o1 = 1;
- double o2 = 2;
+ final double o1 = 1;
+ final double o2 = 2;
assertTrue(new EqualsBuilder().append(o1, o1).isEquals());
assertTrue(!new EqualsBuilder().append(o1, o2).isEquals());
assertTrue(!new EqualsBuilder().append(o1, Double.NaN).isEquals());
@@ -386,8 +386,8 @@ public class EqualsBuilderTest {
@Test
public void testFloat() {
- float o1 = 1;
- float o2 = 2;
+ final float o1 = 1;
+ final float o2 = 2;
assertTrue(new EqualsBuilder().append(o1, o1).isEquals());
assertTrue(!new EqualsBuilder().append(o1, o2).isEquals());
assertTrue(!new EqualsBuilder().append(o1, Float.NaN).isEquals());
@@ -397,7 +397,7 @@ public class EqualsBuilderTest {
@Test
public void testAccessors() {
- EqualsBuilder equalsBuilder = new EqualsBuilder();
+ final EqualsBuilder equalsBuilder = new EqualsBuilder();
assertTrue(equalsBuilder.isEquals());
equalsBuilder.setEquals(true);
assertTrue(equalsBuilder.isEquals());
@@ -407,7 +407,7 @@ public class EqualsBuilderTest {
@Test
public void testReset() {
- EqualsBuilder equalsBuilder = new EqualsBuilder();
+ final EqualsBuilder equalsBuilder = new EqualsBuilder();
assertTrue(equalsBuilder.isEquals());
equalsBuilder.setEquals(false);
assertFalse(equalsBuilder.isEquals());
@@ -417,8 +417,8 @@ public class EqualsBuilderTest {
@Test
public void testBoolean() {
- boolean o1 = true;
- boolean o2 = false;
+ final boolean o1 = true;
+ final boolean o2 = false;
assertTrue(new EqualsBuilder().append(o1, o1).isEquals());
assertTrue(!new EqualsBuilder().append(o1, o2).isEquals());
}
@@ -606,8 +606,8 @@ public class EqualsBuilderTest {
@Test
public void testMultiLongArray() {
- long[][] array1 = new long[2][2];
- long[][] array2 = new long[2][2];
+ final long[][] array1 = new long[2][2];
+ final long[][] array2 = new long[2][2];
for (int i = 0; i < array1.length; ++i) {
for (int j = 0; j < array1[0].length; j++) {
array1[i][j] = (i + 1) * (j + 1);
@@ -622,8 +622,8 @@ public class EqualsBuilderTest {
@Test
public void testMultiIntArray() {
- int[][] array1 = new int[2][2];
- int[][] array2 = new int[2][2];
+ final int[][] array1 = new int[2][2];
+ final int[][] array2 = new int[2][2];
for (int i = 0; i < array1.length; ++i) {
for (int j = 0; j < array1[0].length; j++) {
array1[i][j] = (i + 1) * (j + 1);
@@ -638,8 +638,8 @@ public class EqualsBuilderTest {
@Test
public void testMultiShortArray() {
- short[][] array1 = new short[2][2];
- short[][] array2 = new short[2][2];
+ final short[][] array1 = new short[2][2];
+ final short[][] array2 = new short[2][2];
for (short i = 0; i < array1.length; ++i) {
for (short j = 0; j < array1[0].length; j++) {
array1[i][j] = i;
@@ -654,8 +654,8 @@ public class EqualsBuilderTest {
@Test
public void testMultiCharArray() {
- char[][] array1 = new char[2][2];
- char[][] array2 = new char[2][2];
+ final char[][] array1 = new char[2][2];
+ final char[][] array2 = new char[2][2];
for (char i = 0; i < array1.length; ++i) {
for (char j = 0; j < array1[0].length; j++) {
array1[i][j] = i;
@@ -670,8 +670,8 @@ public class EqualsBuilderTest {
@Test
public void testMultiByteArray() {
- byte[][] array1 = new byte[2][2];
- byte[][] array2 = new byte[2][2];
+ final byte[][] array1 = new byte[2][2];
+ final byte[][] array2 = new byte[2][2];
for (byte i = 0; i < array1.length; ++i) {
for (byte j = 0; j < array1[0].length; j++) {
array1[i][j] = i;
@@ -686,8 +686,8 @@ public class EqualsBuilderTest {
@Test
public void testMultiFloatArray() {
- float[][] array1 = new float[2][2];
- float[][] array2 = new float[2][2];
+ final float[][] array1 = new float[2][2];
+ final float[][] array2 = new float[2][2];
for (int i = 0; i < array1.length; ++i) {
for (int j = 0; j < array1[0].length; j++) {
array1[i][j] = (i + 1) * (j + 1);
@@ -702,8 +702,8 @@ public class EqualsBuilderTest {
@Test
public void testMultiDoubleArray() {
- double[][] array1 = new double[2][2];
- double[][] array2 = new double[2][2];
+ final double[][] array1 = new double[2][2];
+ final double[][] array2 = new double[2][2];
for (int i = 0; i < array1.length; ++i) {
for (int j = 0; j < array1[0].length; j++) {
array1[i][j] = (i + 1) * (j + 1);
@@ -718,8 +718,8 @@ public class EqualsBuilderTest {
@Test
public void testMultiBooleanArray() {
- boolean[][] array1 = new boolean[2][2];
- boolean[][] array2 = new boolean[2][2];
+ final boolean[][] array1 = new boolean[2][2];
+ final boolean[][] array2 = new boolean[2][2];
for (int i = 0; i < array1.length; ++i) {
for (int j = 0; j < array1[0].length; j++) {
array1[i][j] = i == 1 || j == 1;
@@ -732,7 +732,7 @@ public class EqualsBuilderTest {
assertTrue(!new EqualsBuilder().append(array1, array2).isEquals());
// compare 1 dim to 2.
- boolean[] array3 = new boolean[]{true, true};
+ final boolean[] array3 = new boolean[]{true, true};
assertFalse(new EqualsBuilder().append(array1, array3).isEquals());
assertFalse(new EqualsBuilder().append(array3, array1).isEquals());
assertFalse(new EqualsBuilder().append(array2, array3).isEquals());
@@ -741,8 +741,8 @@ public class EqualsBuilderTest {
@Test
public void testRaggedArray() {
- long array1[][] = new long[2][];
- long array2[][] = new long[2][];
+ final long array1[][] = new long[2][];
+ final long array2[][] = new long[2][];
for (int i = 0; i < array1.length; ++i) {
array1[i] = new long[2];
array2[i] = new long[2];
@@ -759,8 +759,8 @@ public class EqualsBuilderTest {
@Test
public void testMixedArray() {
- Object array1[] = new Object[2];
- Object array2[] = new Object[2];
+ final Object array1[] = new Object[2];
+ final Object array2[] = new Object[2];
for (int i = 0; i < array1.length; ++i) {
array1[i] = new long[2];
array2[i] = new long[2];
@@ -777,14 +777,14 @@ public class EqualsBuilderTest {
@Test
public void testObjectArrayHiddenByObject() {
- TestObject[] array1 = new TestObject[2];
+ final TestObject[] array1 = new TestObject[2];
array1[0] = new TestObject(4);
array1[1] = new TestObject(5);
- TestObject[] array2 = new TestObject[2];
+ final TestObject[] array2 = new TestObject[2];
array2[0] = new TestObject(4);
array2[1] = new TestObject(5);
- Object obj1 = array1;
- Object obj2 = array2;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
assertTrue(new EqualsBuilder().append(obj1, obj1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, array1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
@@ -795,14 +795,14 @@ public class EqualsBuilderTest {
@Test
public void testLongArrayHiddenByObject() {
- long[] array1 = new long[2];
+ final long[] array1 = new long[2];
array1[0] = 5L;
array1[1] = 6L;
- long[] array2 = new long[2];
+ final long[] array2 = new long[2];
array2[0] = 5L;
array2[1] = 6L;
- Object obj1 = array1;
- Object obj2 = array2;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
assertTrue(new EqualsBuilder().append(obj1, obj1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, array1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
@@ -813,14 +813,14 @@ public class EqualsBuilderTest {
@Test
public void testIntArrayHiddenByObject() {
- int[] array1 = new int[2];
+ final int[] array1 = new int[2];
array1[0] = 5;
array1[1] = 6;
- int[] array2 = new int[2];
+ final int[] array2 = new int[2];
array2[0] = 5;
array2[1] = 6;
- Object obj1 = array1;
- Object obj2 = array2;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
assertTrue(new EqualsBuilder().append(obj1, obj1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, array1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
@@ -831,14 +831,14 @@ public class EqualsBuilderTest {
@Test
public void testShortArrayHiddenByObject() {
- short[] array1 = new short[2];
+ final short[] array1 = new short[2];
array1[0] = 5;
array1[1] = 6;
- short[] array2 = new short[2];
+ final short[] array2 = new short[2];
array2[0] = 5;
array2[1] = 6;
- Object obj1 = array1;
- Object obj2 = array2;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
assertTrue(new EqualsBuilder().append(obj1, obj1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, array1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
@@ -849,14 +849,14 @@ public class EqualsBuilderTest {
@Test
public void testCharArrayHiddenByObject() {
- char[] array1 = new char[2];
+ final char[] array1 = new char[2];
array1[0] = 5;
array1[1] = 6;
- char[] array2 = new char[2];
+ final char[] array2 = new char[2];
array2[0] = 5;
array2[1] = 6;
- Object obj1 = array1;
- Object obj2 = array2;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
assertTrue(new EqualsBuilder().append(obj1, obj1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, array1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
@@ -867,14 +867,14 @@ public class EqualsBuilderTest {
@Test
public void testByteArrayHiddenByObject() {
- byte[] array1 = new byte[2];
+ final byte[] array1 = new byte[2];
array1[0] = 5;
array1[1] = 6;
- byte[] array2 = new byte[2];
+ final byte[] array2 = new byte[2];
array2[0] = 5;
array2[1] = 6;
- Object obj1 = array1;
- Object obj2 = array2;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
assertTrue(new EqualsBuilder().append(obj1, obj1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, array1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
@@ -885,14 +885,14 @@ public class EqualsBuilderTest {
@Test
public void testDoubleArrayHiddenByObject() {
- double[] array1 = new double[2];
+ final double[] array1 = new double[2];
array1[0] = 5;
array1[1] = 6;
- double[] array2 = new double[2];
+ final double[] array2 = new double[2];
array2[0] = 5;
array2[1] = 6;
- Object obj1 = array1;
- Object obj2 = array2;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
assertTrue(new EqualsBuilder().append(obj1, obj1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, array1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
@@ -903,14 +903,14 @@ public class EqualsBuilderTest {
@Test
public void testFloatArrayHiddenByObject() {
- float[] array1 = new float[2];
+ final float[] array1 = new float[2];
array1[0] = 5;
array1[1] = 6;
- float[] array2 = new float[2];
+ final float[] array2 = new float[2];
array2[0] = 5;
array2[1] = 6;
- Object obj1 = array1;
- Object obj2 = array2;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
assertTrue(new EqualsBuilder().append(obj1, obj1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, array1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
@@ -921,14 +921,14 @@ public class EqualsBuilderTest {
@Test
public void testBooleanArrayHiddenByObject() {
- boolean[] array1 = new boolean[2];
+ final boolean[] array1 = new boolean[2];
array1[0] = true;
array1[1] = false;
- boolean[] array2 = new boolean[2];
+ final boolean[] array2 = new boolean[2];
array2[0] = true;
array2[1] = false;
- Object obj1 = array1;
- Object obj2 = array2;
+ final Object obj1 = array1;
+ final Object obj2 = array2;
assertTrue(new EqualsBuilder().append(obj1, obj1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, array1).isEquals());
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
@@ -1006,8 +1006,8 @@ public class EqualsBuilderTest {
*/
@Test
public void testUnrelatedClasses() {
- Object[] x = new Object[]{new TestACanEqualB(1)};
- Object[] y = new Object[]{new TestBCanEqualA(1)};
+ final Object[] x = new Object[]{new TestACanEqualB(1)};
+ final Object[] y = new Object[]{new TestBCanEqualA(1)};
// sanity checks:
assertTrue(Arrays.equals(x, x));
@@ -1030,8 +1030,8 @@ public class EqualsBuilderTest {
*/
@Test
public void testNpeForNullElement() {
- Object[] x1 = new Object[] { Integer.valueOf(1), null, Integer.valueOf(3) };
- Object[] x2 = new Object[] { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3) };
+ final Object[] x1 = new Object[] { Integer.valueOf(1), null, Integer.valueOf(3) };
+ final Object[] x2 = new Object[] { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3) };
// causes an NPE in 2.0 according to:
// http://issues.apache.org/bugzilla/show_bug.cgi?id=33067
@@ -1040,8 +1040,8 @@ public class EqualsBuilderTest {
@Test
public void testReflectionEqualsExcludeFields() throws Exception {
- TestObjectWithMultipleFields x1 = new TestObjectWithMultipleFields(1, 2, 3);
- TestObjectWithMultipleFields x2 = new TestObjectWithMultipleFields(1, 3, 4);
+ final TestObjectWithMultipleFields x1 = new TestObjectWithMultipleFields(1, 2, 3);
+ final TestObjectWithMultipleFields x2 = new TestObjectWithMultipleFields(1, 3, 4);
// not equal when including all fields
assertTrue(!EqualsBuilder.reflectionEquals(x1, x2));
@@ -1084,18 +1084,18 @@ public class EqualsBuilderTest {
*/
@Test
public void testCyclicalObjectReferences() {
- TestObjectReference refX1 = new TestObjectReference(1);
- TestObjectReference x1 = new TestObjectReference(1);
+ final TestObjectReference refX1 = new TestObjectReference(1);
+ final TestObjectReference x1 = new TestObjectReference(1);
x1.setObjectReference(refX1);
refX1.setObjectReference(x1);
- TestObjectReference refX2 = new TestObjectReference(1);
- TestObjectReference x2 = new TestObjectReference(1);
+ final TestObjectReference refX2 = new TestObjectReference(1);
+ final TestObjectReference x2 = new TestObjectReference(1);
x2.setObjectReference(refX2);
refX2.setObjectReference(x2);
- TestObjectReference refX3 = new TestObjectReference(2);
- TestObjectReference x3 = new TestObjectReference(2);
+ final TestObjectReference refX3 = new TestObjectReference(2);
+ final TestObjectReference x3 = new TestObjectReference(2);
x3.setObjectReference(refX3);
refX3.setObjectReference(x3);
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderAndEqualsBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderAndEqualsBuilderTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderAndEqualsBuilderTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderAndEqualsBuilderTest.java Tue Jan 22 07:09:45 2013
@@ -32,8 +32,8 @@ public class HashCodeBuilderAndEqualsBui
//-----------------------------------------------------------------------
private void testInteger(final boolean testTransients) {
- Integer i1 = Integer.valueOf(12345);
- Integer i2 = Integer.valueOf(12345);
+ final Integer i1 = Integer.valueOf(12345);
+ final Integer i2 = Integer.valueOf(12345);
assertEqualsAndHashCodeContract(i1, i2, testTransients);
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java Tue Jan 22 07:09:45 2013
@@ -79,7 +79,7 @@ public class HashCodeBuilderTest {
if (!(o instanceof TestObject)) {
return false;
}
- TestObject rhs = (TestObject) o;
+ final TestObject rhs = (TestObject) o;
return a == rhs.a;
}
@@ -121,7 +121,7 @@ public class HashCodeBuilderTest {
if (!(o instanceof TestSubObject)) {
return false;
}
- TestSubObject rhs = (TestSubObject) o;
+ final TestSubObject rhs = (TestSubObject) o;
return super.equals(o) && b == rhs.b;
}
@@ -175,7 +175,7 @@ public class HashCodeBuilderTest {
@Test
public void testSuper() {
- Object obj = new Object();
+ final Object obj = new Object();
assertEquals(17 * 37 + 19 * 41 + obj.hashCode(), new HashCodeBuilder(17, 37).appendSuper(
new HashCodeBuilder(19, 41).append(obj).toHashCode()).toHashCode());
}
@@ -233,8 +233,8 @@ public class HashCodeBuilderTest {
@SuppressWarnings("cast") // cast is not really needed, keep for consistency
public void testDouble() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((double) 0d).toHashCode());
- double d = 1234567.89;
- long l = Double.doubleToLongBits(d);
+ final double d = 1234567.89;
+ final long l = Double.doubleToLongBits(d);
assertEquals(17 * 37 + (int) (l ^ l >> 32), new HashCodeBuilder(17, 37).append(d).toHashCode());
}
@@ -242,8 +242,8 @@ public class HashCodeBuilderTest {
@SuppressWarnings("cast") // cast is not really needed, keep for consistency
public void testFloat() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((float) 0f).toHashCode());
- float f = 1234.89f;
- int i = Float.floatToIntBits(f);
+ final float f = 1234.89f;
+ final int i = Float.floatToIntBits(f);
assertEquals(17 * 37 + i, new HashCodeBuilder(17, 37).append(f).toHashCode());
}
@@ -256,7 +256,7 @@ public class HashCodeBuilderTest {
@Test
public void testObjectArray() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((Object[]) null).toHashCode());
- Object[] obj = new Object[2];
+ final Object[] obj = new Object[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[0] = new Object();
assertEquals((17 * 37 + obj[0].hashCode()) * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
@@ -267,7 +267,7 @@ public class HashCodeBuilderTest {
@Test
public void testObjectArrayAsObject() {
- Object[] obj = new Object[2];
+ final Object[] obj = new Object[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[0] = new Object();
assertEquals((17 * 37 + obj[0].hashCode()) * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
@@ -279,32 +279,32 @@ public class HashCodeBuilderTest {
@Test
public void testLongArray() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((long[]) null).toHashCode());
- long[] obj = new long[2];
+ final long[] obj = new long[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[0] = 5L;
- int h1 = (int) (5L ^ 5L >> 32);
+ final int h1 = (int) (5L ^ 5L >> 32);
assertEquals((17 * 37 + h1) * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[1] = 6L;
- int h2 = (int) (6L ^ 6L >> 32);
+ final int h2 = (int) (6L ^ 6L >> 32);
assertEquals((17 * 37 + h1) * 37 + h2, new HashCodeBuilder(17, 37).append(obj).toHashCode());
}
@Test
public void testLongArrayAsObject() {
- long[] obj = new long[2];
+ final long[] obj = new long[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[0] = 5L;
- int h1 = (int) (5L ^ 5L >> 32);
+ final int h1 = (int) (5L ^ 5L >> 32);
assertEquals((17 * 37 + h1) * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[1] = 6L;
- int h2 = (int) (6L ^ 6L >> 32);
+ final int h2 = (int) (6L ^ 6L >> 32);
assertEquals((17 * 37 + h1) * 37 + h2, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
}
@Test
public void testIntArray() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((int[]) null).toHashCode());
- int[] obj = new int[2];
+ final int[] obj = new int[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[0] = 5;
assertEquals((17 * 37 + 5) * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
@@ -314,7 +314,7 @@ public class HashCodeBuilderTest {
@Test
public void testIntArrayAsObject() {
- int[] obj = new int[2];
+ final int[] obj = new int[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[0] = 5;
assertEquals((17 * 37 + 5) * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
@@ -325,7 +325,7 @@ public class HashCodeBuilderTest {
@Test
public void testShortArray() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((short[]) null).toHashCode());
- short[] obj = new short[2];
+ final short[] obj = new short[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[0] = (short) 5;
assertEquals((17 * 37 + 5) * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
@@ -335,7 +335,7 @@ public class HashCodeBuilderTest {
@Test
public void testShortArrayAsObject() {
- short[] obj = new short[2];
+ final short[] obj = new short[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[0] = (short) 5;
assertEquals((17 * 37 + 5) * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
@@ -346,7 +346,7 @@ public class HashCodeBuilderTest {
@Test
public void testCharArray() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((char[]) null).toHashCode());
- char[] obj = new char[2];
+ final char[] obj = new char[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[0] = (char) 5;
assertEquals((17 * 37 + 5) * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
@@ -356,7 +356,7 @@ public class HashCodeBuilderTest {
@Test
public void testCharArrayAsObject() {
- char[] obj = new char[2];
+ final char[] obj = new char[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[0] = (char) 5;
assertEquals((17 * 37 + 5) * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
@@ -367,7 +367,7 @@ public class HashCodeBuilderTest {
@Test
public void testByteArray() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((byte[]) null).toHashCode());
- byte[] obj = new byte[2];
+ final byte[] obj = new byte[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[0] = (byte) 5;
assertEquals((17 * 37 + 5) * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
@@ -377,7 +377,7 @@ public class HashCodeBuilderTest {
@Test
public void testByteArrayAsObject() {
- byte[] obj = new byte[2];
+ final byte[] obj = new byte[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[0] = (byte) 5;
assertEquals((17 * 37 + 5) * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
@@ -388,61 +388,61 @@ public class HashCodeBuilderTest {
@Test
public void testDoubleArray() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((double[]) null).toHashCode());
- double[] obj = new double[2];
+ final double[] obj = new double[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[0] = 5.4d;
- long l1 = Double.doubleToLongBits(5.4d);
- int h1 = (int) (l1 ^ l1 >> 32);
+ final long l1 = Double.doubleToLongBits(5.4d);
+ final int h1 = (int) (l1 ^ l1 >> 32);
assertEquals((17 * 37 + h1) * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[1] = 6.3d;
- long l2 = Double.doubleToLongBits(6.3d);
- int h2 = (int) (l2 ^ l2 >> 32);
+ final long l2 = Double.doubleToLongBits(6.3d);
+ final int h2 = (int) (l2 ^ l2 >> 32);
assertEquals((17 * 37 + h1) * 37 + h2, new HashCodeBuilder(17, 37).append(obj).toHashCode());
}
@Test
public void testDoubleArrayAsObject() {
- double[] obj = new double[2];
+ final double[] obj = new double[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[0] = 5.4d;
- long l1 = Double.doubleToLongBits(5.4d);
- int h1 = (int) (l1 ^ l1 >> 32);
+ final long l1 = Double.doubleToLongBits(5.4d);
+ final int h1 = (int) (l1 ^ l1 >> 32);
assertEquals((17 * 37 + h1) * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[1] = 6.3d;
- long l2 = Double.doubleToLongBits(6.3d);
- int h2 = (int) (l2 ^ l2 >> 32);
+ final long l2 = Double.doubleToLongBits(6.3d);
+ final int h2 = (int) (l2 ^ l2 >> 32);
assertEquals((17 * 37 + h1) * 37 + h2, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
}
@Test
public void testFloatArray() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((float[]) null).toHashCode());
- float[] obj = new float[2];
+ final float[] obj = new float[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[0] = 5.4f;
- int h1 = Float.floatToIntBits(5.4f);
+ final int h1 = Float.floatToIntBits(5.4f);
assertEquals((17 * 37 + h1) * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[1] = 6.3f;
- int h2 = Float.floatToIntBits(6.3f);
+ final int h2 = Float.floatToIntBits(6.3f);
assertEquals((17 * 37 + h1) * 37 + h2, new HashCodeBuilder(17, 37).append(obj).toHashCode());
}
@Test
public void testFloatArrayAsObject() {
- float[] obj = new float[2];
+ final float[] obj = new float[2];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[0] = 5.4f;
- int h1 = Float.floatToIntBits(5.4f);
+ final int h1 = Float.floatToIntBits(5.4f);
assertEquals((17 * 37 + h1) * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[1] = 6.3f;
- int h2 = Float.floatToIntBits(6.3f);
+ final int h2 = Float.floatToIntBits(6.3f);
assertEquals((17 * 37 + h1) * 37 + h2, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
}
@Test
public void testBooleanArray() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((boolean[]) null).toHashCode());
- boolean[] obj = new boolean[2];
+ final boolean[] obj = new boolean[2];
assertEquals((17 * 37 + 1) * 37 + 1, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[0] = true;
assertEquals((17 * 37 + 0) * 37 + 1, new HashCodeBuilder(17, 37).append(obj).toHashCode());
@@ -452,7 +452,7 @@ public class HashCodeBuilderTest {
@Test
public void testBooleanArrayAsObject() {
- boolean[] obj = new boolean[2];
+ final boolean[] obj = new boolean[2];
assertEquals((17 * 37 + 1) * 37 + 1, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
obj[0] = true;
assertEquals((17 * 37 + 0) * 37 + 1, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode());
@@ -462,7 +462,7 @@ public class HashCodeBuilderTest {
@Test
public void testBooleanMultiArray() {
- boolean[][] obj = new boolean[2][];
+ final boolean[][] obj = new boolean[2][];
assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
obj[0] = new boolean[0];
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
@@ -478,7 +478,7 @@ public class HashCodeBuilderTest {
@Test
public void testReflectionHashCodeExcludeFields() throws Exception {
- TestObjectWithMultipleFields x = new TestObjectWithMultipleFields(1, 2, 3);
+ final TestObjectWithMultipleFields x = new TestObjectWithMultipleFields(1, 2, 3);
assertEquals(((17 * 37 + 1) * 37 + 2) * 37 + 3, HashCodeBuilder.reflectionHashCode(x));
@@ -517,8 +517,8 @@ public class HashCodeBuilderTest {
*/
@Test
public void testReflectionObjectCycle() {
- ReflectionTestCycleA a = new ReflectionTestCycleA();
- ReflectionTestCycleB b = new ReflectionTestCycleB();
+ final ReflectionTestCycleA a = new ReflectionTestCycleA();
+ final ReflectionTestCycleB b = new ReflectionTestCycleB();
a.b = b;
b.a = a;
@@ -550,7 +550,7 @@ public class HashCodeBuilderTest {
*/
@Test
public void testToHashCodeEqualsHashCode() {
- HashCodeBuilder hcb = new HashCodeBuilder(17, 37).append(new Object()).append('a');
+ final HashCodeBuilder hcb = new HashCodeBuilder(17, 37).append(new Object()).append('a');
assertEquals("hashCode() is no longer returning the same value as toHashCode() - see LANG-520",
hcb.toHashCode(), hcb.hashCode());
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java Tue Jan 22 07:09:45 2013
@@ -66,8 +66,8 @@ public class MultiLineToStringStyleTest
@Test
public void testObject() {
- Integer i3 = Integer.valueOf(3);
- Integer i4 = Integer.valueOf(4);
+ final Integer i3 = Integer.valueOf(3);
+ final Integer i4 = Integer.valueOf(4);
assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " <null>" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append((Object) null).toString());
assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " 3" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append(i3).toString());
assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=<null>" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", (Object) null).toString());
@@ -84,11 +84,11 @@ public class MultiLineToStringStyleTest
@Test
public void testPerson() {
- Person p = new Person();
+ final Person p = new Person();
p.name = "Jane Doe";
p.age = 25;
p.smoker = true;
- String pBaseStr = p.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(p));
+ final String pBaseStr = p.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(p));
assertEquals(pBaseStr + "[" + SystemUtils.LINE_SEPARATOR + " name=Jane Doe" + SystemUtils.LINE_SEPARATOR + " age=25" + SystemUtils.LINE_SEPARATOR + " smoker=true" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).toString());
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java Tue Jan 22 07:09:45 2013
@@ -65,8 +65,8 @@ public class NoFieldNamesToStringStyleTe
@Test
public void testObject() {
- Integer i3 = Integer.valueOf(3);
- Integer i4 = Integer.valueOf(4);
+ final Integer i3 = Integer.valueOf(3);
+ final Integer i4 = Integer.valueOf(4);
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) null).toString());
assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).toString());
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append("a", (Object) null).toString());
@@ -83,11 +83,11 @@ public class NoFieldNamesToStringStyleTe
@Test
public void testPerson() {
- Person p = new Person();
+ final Person p = new Person();
p.name = "Ron Paul";
p.age = 72;
p.smoker = false;
- String pBaseStr = p.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(p));
+ final String pBaseStr = p.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(p));
assertEquals(pBaseStr + "[Ron Paul,72,false]", new ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).toString());
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java Tue Jan 22 07:09:45 2013
@@ -89,18 +89,18 @@ public class ReflectionToStringBuilderCo
// Create a thread pool with two threads to cause the most contention on the underlying resource.
final ExecutorService threadPool = Executors.newFixedThreadPool(2);
// Consumes toStrings
- Callable<Integer> consumer = new Callable<Integer>() {
+ final Callable<Integer> consumer = new Callable<Integer>() {
@Override
public Integer call() {
for (int i = 0; i < REPEAT; i++) {
- String s = ReflectionToStringBuilder.toString(holder);
+ final String s = ReflectionToStringBuilder.toString(holder);
Assert.assertNotNull(s);
}
return Integer.valueOf(REPEAT);
}
};
// Produces changes in the list
- Callable<Integer> producer = new Callable<Integer>() {
+ final Callable<Integer> producer = new Callable<Integer>() {
@Override
public Integer call() {
for (int i = 0; i < DATA_SIZE; i++) {
@@ -109,11 +109,11 @@ public class ReflectionToStringBuilderCo
return Integer.valueOf(REPEAT);
}
};
- Collection<Callable<Integer>> tasks = new ArrayList<Callable<Integer>>();
+ final Collection<Callable<Integer>> tasks = new ArrayList<Callable<Integer>>();
tasks.add(consumer);
tasks.add(producer);
final List<Future<Integer>> futures = threadPool.invokeAll(tasks);
- for (Future<Integer> future : futures) {
+ for (final Future<Integer> future : futures) {
Assert.assertEquals(REPEAT, future.get().intValue());
}
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java Tue Jan 22 07:09:45 2013
@@ -49,74 +49,74 @@ public class ReflectionToStringBuilderEx
@Test
public void test_toStringExclude() {
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), SECRET_FIELD);
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), SECRET_FIELD);
this.validateSecretFieldAbsent(toString);
}
@Test
public void test_toStringExcludeArray() {
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{SECRET_FIELD});
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{SECRET_FIELD});
this.validateSecretFieldAbsent(toString);
}
@Test
public void test_toStringExcludeArrayWithNull() {
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{null});
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{null});
this.validateSecretFieldPresent(toString);
}
@Test
public void test_toStringExcludeArrayWithNulls() {
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{null, null});
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{null, null});
this.validateSecretFieldPresent(toString);
}
@Test
public void test_toStringExcludeCollection() {
- List<String> excludeList = new ArrayList<String>();
+ final List<String> excludeList = new ArrayList<String>();
excludeList.add(SECRET_FIELD);
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), excludeList);
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), excludeList);
this.validateSecretFieldAbsent(toString);
}
@Test
public void test_toStringExcludeCollectionWithNull() {
- List<String> excludeList = new ArrayList<String>();
+ final List<String> excludeList = new ArrayList<String>();
excludeList.add(null);
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), excludeList);
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), excludeList);
this.validateSecretFieldPresent(toString);
}
@Test
public void test_toStringExcludeCollectionWithNulls() {
- List<String> excludeList = new ArrayList<String>();
+ final List<String> excludeList = new ArrayList<String>();
excludeList.add(null);
excludeList.add(null);
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), excludeList);
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), excludeList);
this.validateSecretFieldPresent(toString);
}
@Test
public void test_toStringExcludeEmptyArray() {
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), ArrayUtils.EMPTY_STRING_ARRAY);
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), ArrayUtils.EMPTY_STRING_ARRAY);
this.validateSecretFieldPresent(toString);
}
@Test
public void test_toStringExcludeEmptyCollection() {
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new ArrayList<String>());
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new ArrayList<String>());
this.validateSecretFieldPresent(toString);
}
@Test
public void test_toStringExcludeNullArray() {
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), (String[]) null);
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), (String[]) null);
this.validateSecretFieldPresent(toString);
}
@Test
public void test_toStringExcludeNullCollection() {
- String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), (Collection<String>) null);
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), (Collection<String>) null);
this.validateSecretFieldPresent(toString);
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java Tue Jan 22 07:09:45 2013
@@ -93,14 +93,14 @@ public class ReflectionToStringBuilderMu
@Test
@Ignore
public void testConcurrency() throws Exception {
- TestFixture testFixture = new TestFixture();
+ final TestFixture testFixture = new TestFixture();
final int numMutators = 10;
final int numIterations = 10;
for (int i = 0; i < numIterations; i++) {
for (int j = 0; j < numMutators; j++) {
- Thread t = new Thread(new MutatingClient(testFixture));
+ final Thread t = new Thread(new MutatingClient(testFixture));
t.start();
- Thread s = new Thread(new InspectingClient(testFixture));
+ final Thread s = new Thread(new InspectingClient(testFixture));
s.start();
}
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java Tue Jan 22 07:09:45 2013
@@ -65,8 +65,8 @@ public class ShortPrefixToStringStyleTes
@Test
public void testObject() {
- Integer i3 = Integer.valueOf(3);
- Integer i4 = Integer.valueOf(4);
+ final Integer i3 = Integer.valueOf(3);
+ final Integer i4 = Integer.valueOf(4);
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) null).toString());
assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).toString());
assertEquals(baseStr + "[a=<null>]", new ToStringBuilder(base).append("a", (Object) null).toString());
@@ -83,11 +83,11 @@ public class ShortPrefixToStringStyleTes
@Test
public void testPerson() {
- Person p = new Person();
+ final Person p = new Person();
p.name = "John Q. Public";
p.age = 45;
p.smoker = true;
- String pBaseStr = "ToStringStyleTest.Person";
+ final String pBaseStr = "ToStringStyleTest.Person";
assertEquals(pBaseStr + "[name=John Q. Public,age=45,smoker=true]", new ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).toString());
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java Tue Jan 22 07:09:45 2013
@@ -64,8 +64,8 @@ public class SimpleToStringStyleTest {
@Test
public void testObject() {
- Integer i3 = Integer.valueOf(3);
- Integer i4 = Integer.valueOf(4);
+ final Integer i3 = Integer.valueOf(3);
+ final Integer i4 = Integer.valueOf(4);
assertEquals("<null>", new ToStringBuilder(base).append((Object) null).toString());
assertEquals("3", new ToStringBuilder(base).append(i3).toString());
assertEquals("<null>", new ToStringBuilder(base).append("a", (Object) null).toString());
@@ -82,7 +82,7 @@ public class SimpleToStringStyleTest {
@Test
public void testPerson() {
- Person p = new Person();
+ final Person p = new Person();
p.name = "Jane Q. Public";
p.age = 47;
p.smoker = false;
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java Tue Jan 22 07:09:45 2013
@@ -80,8 +80,8 @@ public class StandardToStringStyleTest {
@Test
public void testObject() {
- Integer i3 = Integer.valueOf(3);
- Integer i4 = Integer.valueOf(4);
+ final Integer i3 = Integer.valueOf(3);
+ final Integer i4 = Integer.valueOf(4);
assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append((Object) null).toString());
assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).toString());
assertEquals(baseStr + "[a=%NULL%]", new ToStringBuilder(base).append("a", (Object) null).toString());
@@ -98,11 +98,11 @@ public class StandardToStringStyleTest {
@Test
public void testPerson() {
- Person p = new Person();
+ final Person p = new Person();
p.name = "Suzy Queue";
p.age = 19;
p.smoker = false;
- String pBaseStr = "ToStringStyleTest.Person";
+ final String pBaseStr = "ToStringStyleTest.Person";
assertEquals(pBaseStr + "[name=Suzy Queue,age=19,smoker=false]", new ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).toString());
}