commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1206700 - in /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3: ./ builder/ concurrent/ tuple/
Date Sun, 27 Nov 2011 11:39:37 GMT
Author: sebb
Date: Sun Nov 27 11:39:35 2011
New Revision: 1206700

URL: http://svn.apache.org/viewvc?rev=1206700&view=rev
Log:
Fix various boxing errors

Modified:
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java?rev=1206700&r1=1206699&r2=1206700&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java Sun
Nov 27 11:39:35 2011
@@ -441,7 +441,7 @@ public class ArrayUtilsTest extends Test
         // Test null handling
         assertEquals(ArrayUtils.EMPTY_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Object[]) null));
         // Test valid array handling
-        Object[] original = new Object[] {true, false};
+        Object[] original = new Object[] {Boolean.TRUE, Boolean.FALSE};
         assertEquals(original, ArrayUtils.nullToEmpty(original));
         // Test empty array handling
         Object[] empty = new Object[]{};
@@ -480,6 +480,7 @@ public class ArrayUtilsTest extends Test
         // Test null handling
         assertEquals(ArrayUtils.EMPTY_LONG_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Long[])
null));
         // Test valid array handling
+        @SuppressWarnings("boxing")
         Long[] original = new Long[] {1L, 2L};
         assertEquals(original, ArrayUtils.nullToEmpty(original));
         // Test empty array handling
@@ -506,6 +507,7 @@ public class ArrayUtilsTest extends Test
         // Test null handling
         assertEquals(ArrayUtils.EMPTY_SHORT_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Short[])
null));
         // Test valid array handling
+        @SuppressWarnings("boxing")
         Short[] original = new Short[] {1, 2};
         assertEquals(original, ArrayUtils.nullToEmpty(original));
         // Test empty array handling

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=1206700&r1=1206699&r2=1206700&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
Sun Nov 27 11:39:35 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.lang3.builder;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -282,15 +283,15 @@ public class CompareToBuilderTest {
     public void testObjectBuild() {
         TestObject o1 = new TestObject(4);
         TestObject o2 = new TestObject(4);
-        assertTrue(new CompareToBuilder().append(o1, o1).build() == 0);
-        assertTrue(new CompareToBuilder().append(o1, o2).build() == 0);
+        assertEquals(Integer.valueOf(0), new CompareToBuilder().append(o1, o1).build());
+        assertEquals(Integer.valueOf(0), new CompareToBuilder().append(o1, o2).build());
         o2.setA(5);
-        assertTrue(new CompareToBuilder().append(o1, o2).build() < 0);
-        assertTrue(new CompareToBuilder().append(o2, o1).build() > 0);
+        assertTrue(new CompareToBuilder().append(o1, o2).build().intValue() < 0);
+        assertTrue(new CompareToBuilder().append(o2, o1).build().intValue() > 0);
         
-        assertTrue(new CompareToBuilder().append(o1, null).build() > 0);
-        assertTrue(new CompareToBuilder().append((Object) null, (Object) null).build() ==
0);
-        assertTrue(new CompareToBuilder().append(null, o1).build() < 0);
+        assertTrue(new CompareToBuilder().append(o1, null).build().intValue() > 0);
+        assertEquals(Integer.valueOf(0), new CompareToBuilder().append((Object) null, (Object)
null).build());
+        assertTrue(new CompareToBuilder().append(null, o1).build().intValue() < 0);
     }
 
     @Test

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java?rev=1206700&r1=1206699&r2=1206700&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java
Sun Nov 27 11:39:35 2011
@@ -179,7 +179,7 @@ public class BasicThreadFactoryTest {
         BasicThreadFactory factory = builder.wrappedFactory(wrapped).daemon(
                 flag).build();
         assertSame("Wrong thread", t, factory.newThread(r));
-        assertEquals("Wrong daemon flag", flag, t.isDaemon());
+        assertTrue("Wrong daemon flag", flag == t.isDaemon());
         EasyMock.verify(wrapped, r);
     }
 

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java?rev=1206700&r1=1206699&r2=1206700&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java
Sun Nov 27 11:39:35 2011
@@ -48,9 +48,9 @@ public class ConstantInitializerTest {
      * @param expected the expected result
      */
     private void checkEquals(Object obj, boolean expected) {
-        assertEquals("Wrong result of equals", expected, init.equals(obj));
+        assertTrue("Wrong result of equals", expected == init.equals(obj));
         if (obj != null) {
-            assertEquals("Not symmetric", expected, obj.equals(init));
+            assertTrue("Not symmetric", expected == obj.equals(init));
             if (expected) {
                 assertEquals("Different hash codes", init.hashCode(),
                         obj.hashCode());

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java?rev=1206700&r1=1206699&r2=1206700&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java
Sun Nov 27 11:39:35 2011
@@ -62,7 +62,7 @@ public class MutableTripleTest {
         triple.setRight(Boolean.FALSE);
         assertEquals(42, triple.getLeft().intValue());
         assertEquals("bar", triple.getMiddle());
-        assertFalse(triple.getRight());
+        assertEquals(Boolean.FALSE, triple.getRight());
     }
 
     @Test
@@ -70,7 +70,7 @@ public class MutableTripleTest {
         MutableTriple<Integer, String, Boolean> triple = MutableTriple.of(0, "foo",
Boolean.TRUE);
         assertEquals(0, triple.getLeft().intValue());
         assertEquals("foo", triple.getMiddle());
-        assertTrue(triple.getRight());
+        assertEquals(Boolean.TRUE, triple.getRight());
         MutableTriple<Object, String, String> triple2 = MutableTriple.of(null, "bar",
"hello");
         assertNull(triple2.getLeft());
         assertEquals("bar", triple2.getMiddle());

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java?rev=1206700&r1=1206699&r2=1206700&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java
Sun Nov 27 11:39:35 2011
@@ -39,7 +39,7 @@ public class TripleTest {
         assertEquals(0, ((ImmutableTriple<Integer, String, Boolean>) triple).left.intValue());
         assertEquals("foo", ((ImmutableTriple<Integer, String, Boolean>) triple).middle);
         assertEquals(Boolean.TRUE, ((ImmutableTriple<Integer, String, Boolean>) triple).right);
-        Triple<Object, String, Long> triple2 = Triple.of(null, "bar", 200L);
+        Triple<Object, String, Long> triple2 = Triple.of(null, "bar", Long.valueOf(200L));
         assertTrue(triple2 instanceof ImmutableTriple<?, ?, ?>);
         assertNull(((ImmutableTriple<Object, String, Long>) triple2).left);
         assertEquals("bar", ((ImmutableTriple<Object, String, Long>) triple2).middle);



Mime
View raw message