diff --git a/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserSplitTests.java b/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserSplitTests.java
index 7a87f37..b5d1258 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserSplitTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserSplitTests.java
@@ -55,8 +55,8 @@
         return names.toArray(new String[names.size()]);
     }
 
-    private static void assertArrayEquals(final String message, final Object[] expected,
-            final Object[] actual) {
+    private static <T> void assertArrayEquals(final String message, final T[] expected,
+            final T[] actual) {
         if (expected == actual) {
             return;
         }
@@ -69,8 +69,12 @@
             return;
         }
         for (int i = 0; i < expected.length; i++) {
-            assertEquals(message + " [" + i + "]",
-                    Arrays.toString(expected), Arrays.toString(actual));
+            final T e = expected[i];
+            final T a = actual[i];
+            if (e == a) {
+                continue;
+            }
+            assertEquals(message + " [" + i + "]", e, a);
         }
     }
 
diff --git a/tests/src/com/android/inputmethod/latin/InputPointersTests.java b/tests/src/com/android/inputmethod/latin/InputPointersTests.java
index e1149b3..3015829 100644
--- a/tests/src/com/android/inputmethod/latin/InputPointersTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputPointersTests.java
@@ -108,13 +108,13 @@
         assertNotSame("pointerIds after copy", dst.getPointerIds(), src.getPointerIds());
         assertNotSame("times after copy", dst.getTimes(), src.getTimes());
         final int size = dst.getPointerSize();
-        assertArrayEquals("xCoordinates values after copy",
+        assertIntArrayEquals("xCoordinates values after copy",
                 dst.getXCoordinates(), 0, src.getXCoordinates(), 0, size);
-        assertArrayEquals("yCoordinates values after copy",
+        assertIntArrayEquals("yCoordinates values after copy",
                 dst.getYCoordinates(), 0, src.getYCoordinates(), 0, size);
-        assertArrayEquals("pointerIds values after copy",
+        assertIntArrayEquals("pointerIds values after copy",
                 dst.getPointerIds(), 0, src.getPointerIds(), 0, size);
-        assertArrayEquals("times values after copy",
+        assertIntArrayEquals("times values after copy",
                 dst.getTimes(), 0, src.getTimes(), 0, size);
     }
 
@@ -135,34 +135,34 @@
 
         dst.append(src, 0, 0);
         assertEquals("size after append zero", dstLen, dst.getPointerSize());
-        assertArrayEquals("xCoordinates after append zero",
+        assertIntArrayEquals("xCoordinates after append zero",
                 dstCopy.getXCoordinates(), 0, dst.getXCoordinates(), 0, dstLen);
-        assertArrayEquals("yCoordinates after append zero",
+        assertIntArrayEquals("yCoordinates after append zero",
                 dstCopy.getYCoordinates(), 0, dst.getYCoordinates(), 0, dstLen);
-        assertArrayEquals("pointerIds after append zero",
+        assertIntArrayEquals("pointerIds after append zero",
                 dstCopy.getPointerIds(), 0, dst.getPointerIds(), 0, dstLen);
-        assertArrayEquals("times after append zero",
+        assertIntArrayEquals("times after append zero",
                 dstCopy.getTimes(), 0, dst.getTimes(), 0, dstLen);
 
         dst.append(src, 0, srcLen);
         assertEquals("size after append", dstLen + srcLen, dst.getPointerSize());
         assertTrue("primitive length after append",
                 dst.getPointerIds().length >= dstLen + srcLen);
-        assertArrayEquals("original xCoordinates values after append",
+        assertIntArrayEquals("original xCoordinates values after append",
                 dstCopy.getXCoordinates(), 0, dst.getXCoordinates(), 0, dstLen);
-        assertArrayEquals("original yCoordinates values after append",
+        assertIntArrayEquals("original yCoordinates values after append",
                 dstCopy.getYCoordinates(), 0, dst.getYCoordinates(), 0, dstLen);
-        assertArrayEquals("original pointerIds values after append",
+        assertIntArrayEquals("original pointerIds values after append",
                 dstCopy.getPointerIds(), 0, dst.getPointerIds(), 0, dstLen);
-        assertArrayEquals("original times values after append",
+        assertIntArrayEquals("original times values after append",
                 dstCopy.getTimes(), 0, dst.getTimes(), 0, dstLen);
-        assertArrayEquals("appended xCoordinates values after append",
+        assertIntArrayEquals("appended xCoordinates values after append",
                 src.getXCoordinates(), 0, dst.getXCoordinates(), dstLen, srcLen);
-        assertArrayEquals("appended yCoordinates values after append",
+        assertIntArrayEquals("appended yCoordinates values after append",
                 src.getYCoordinates(), 0, dst.getYCoordinates(), dstLen, srcLen);
-        assertArrayEquals("appended pointerIds values after append",
+        assertIntArrayEquals("appended pointerIds values after append",
                 src.getPointerIds(), 0, dst.getPointerIds(), dstLen, srcLen);
-        assertArrayEquals("appended times values after append",
+        assertIntArrayEquals("appended times values after append",
                 src.getTimes(), 0, dst.getTimes(), dstLen, srcLen);
     }
 
@@ -190,47 +190,55 @@
 
         dst.append(srcPointerId, srcTimes, srcXCoords, srcYCoords, 0, 0);
         assertEquals("size after append zero", dstLen, dst.getPointerSize());
-        assertArrayEquals("xCoordinates after append zero",
+        assertIntArrayEquals("xCoordinates after append zero",
                 dstCopy.getXCoordinates(), 0, dst.getXCoordinates(), 0, dstLen);
-        assertArrayEquals("yCoordinates after append zero",
+        assertIntArrayEquals("yCoordinates after append zero",
                 dstCopy.getYCoordinates(), 0, dst.getYCoordinates(), 0, dstLen);
-        assertArrayEquals("pointerIds after append zero",
+        assertIntArrayEquals("pointerIds after append zero",
                 dstCopy.getPointerIds(), 0, dst.getPointerIds(), 0, dstLen);
-        assertArrayEquals("times after append zero",
+        assertIntArrayEquals("times after append zero",
                 dstCopy.getTimes(), 0, dst.getTimes(), 0, dstLen);
 
         dst.append(srcPointerId, srcTimes, srcXCoords, srcYCoords, 0, srcLen);
         assertEquals("size after append", dstLen + srcLen, dst.getPointerSize());
         assertTrue("primitive length after append",
                 dst.getPointerIds().length >= dstLen + srcLen);
-        assertArrayEquals("original xCoordinates values after append",
+        assertIntArrayEquals("original xCoordinates values after append",
                 dstCopy.getXCoordinates(), 0, dst.getXCoordinates(), 0, dstLen);
-        assertArrayEquals("original yCoordinates values after append",
+        assertIntArrayEquals("original yCoordinates values after append",
                 dstCopy.getYCoordinates(), 0, dst.getYCoordinates(), 0, dstLen);
-        assertArrayEquals("original pointerIds values after append",
+        assertIntArrayEquals("original pointerIds values after append",
                 dstCopy.getPointerIds(), 0, dst.getPointerIds(), 0, dstLen);
-        assertArrayEquals("original times values after append",
+        assertIntArrayEquals("original times values after append",
                 dstCopy.getTimes(), 0, dst.getTimes(), 0, dstLen);
-        assertArrayEquals("appended xCoordinates values after append",
+        assertIntArrayEquals("appended xCoordinates values after append",
                 srcXCoords.getPrimitiveArray(), 0, dst.getXCoordinates(), dstLen, srcLen);
-        assertArrayEquals("appended yCoordinates values after append",
+        assertIntArrayEquals("appended yCoordinates values after append",
                 srcYCoords.getPrimitiveArray(), 0, dst.getYCoordinates(), dstLen, srcLen);
-        assertArrayEquals("appended pointerIds values after append",
+        assertIntArrayEquals("appended pointerIds values after append",
                 srcPointerIds, 0, dst.getPointerIds(), dstLen, srcLen);
-        assertArrayEquals("appended times values after append",
+        assertIntArrayEquals("appended times values after append",
                 srcTimes.getPrimitiveArray(), 0, dst.getTimes(), dstLen, srcLen);
     }
 
-    private static void assertArrayEquals(String message, int[] expecteds, int expectedPos,
-            int[] actuals, int actualPos, int length) {
-        if (expecteds == null && actuals == null) {
+    // TODO: Consolidate this method with
+    // {@link ResizableIntArrayTests#assertIntArrayEquals(String,int[],int,int[],int,int)}.
+    private static void assertIntArrayEquals(final String message, final int[] expecteds,
+            final int expectedPos, final int[] actuals, final int actualPos, final int length) {
+        if (expecteds == actuals) {
             return;
         }
         if (expecteds == null || actuals == null) {
-            fail(message + ": expecteds=" + expecteds + " actuals=" + actuals);
+            assertEquals(message, Arrays.toString(expecteds), Arrays.toString(actuals));
+            return;
+        }
+        if (expecteds.length < expectedPos + length || actuals.length < actualPos + length) {
+            fail(message + ": insufficient length: expecteds=" + Arrays.toString(expecteds)
+                    + " actuals=" + Arrays.toString(actuals));
+            return;
         }
         for (int i = 0; i < length; i++) {
-            assertEquals(message + ": element at " + i,
+            assertEquals(message + " [" + i + "]",
                     expecteds[i + expectedPos], actuals[i + actualPos]);
         }
     }
diff --git a/tests/src/com/android/inputmethod/latin/ResizableIntArrayTests.java b/tests/src/com/android/inputmethod/latin/ResizableIntArrayTests.java
index 2d1b836..b9fee95 100644
--- a/tests/src/com/android/inputmethod/latin/ResizableIntArrayTests.java
+++ b/tests/src/com/android/inputmethod/latin/ResizableIntArrayTests.java
@@ -19,6 +19,8 @@
 import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import java.util.Arrays;
+
 @SmallTest
 public class ResizableIntArrayTests extends AndroidTestCase {
     private static final int DEFAULT_CAPACITY = 48;
@@ -186,7 +188,7 @@
         assertEquals("length after copy", dst.getLength(), src.getLength());
         assertSame("array after copy", array, dst.getPrimitiveArray());
         assertNotSame("array after copy", dst.getPrimitiveArray(), src.getPrimitiveArray());
-        assertArrayEquals("values after copy",
+        assertIntArrayEquals("values after copy",
                 dst.getPrimitiveArray(), 0, src.getPrimitiveArray(), 0, dst.getLength());
 
         final int smallerLength = DEFAULT_CAPACITY / 2;
@@ -197,7 +199,7 @@
         assertEquals("length after copy to smaller", dst.getLength(), src.getLength());
         assertNotSame("array after copy to smaller", array2, array3);
         assertNotSame("array after copy to smaller", array3, src.getPrimitiveArray());
-        assertArrayEquals("values after copy to smaller",
+        assertIntArrayEquals("values after copy to smaller",
                 dst.getPrimitiveArray(), 0, src.getPrimitiveArray(), 0, dst.getLength());
     }
 
@@ -220,7 +222,7 @@
         dst.append(src, 0, 0);
         assertEquals("length after append zero", dstLen, dst.getLength());
         assertSame("array after append zero", array, dst.getPrimitiveArray());
-        assertArrayEquals("values after append zero",
+        assertIntArrayEquals("values after append zero",
                 dstCopy.getPrimitiveArray(), 0, dst.getPrimitiveArray(), 0, dstLen);
 
         dst.append(src, 0, srcLen);
@@ -228,9 +230,9 @@
         assertSame("array after append", array, dst.getPrimitiveArray());
         assertTrue("primitive length after append",
                 dst.getPrimitiveArray().length >= dstLen + srcLen);
-        assertArrayEquals("original values after append",
+        assertIntArrayEquals("original values after append",
                 dstCopy.getPrimitiveArray(), 0, dst.getPrimitiveArray(), 0, dstLen);
-        assertArrayEquals("appended values after append",
+        assertIntArrayEquals("appended values after append",
                 src.getPrimitiveArray(), 0, dst.getPrimitiveArray(), dstLen, srcLen);
 
         dst.append(src, 0, srcLen);
@@ -238,11 +240,11 @@
         assertNotSame("array after 2nd append", array, dst.getPrimitiveArray());
         assertTrue("primitive length after 2nd append",
                 dst.getPrimitiveArray().length >= dstLen + srcLen * 2);
-        assertArrayEquals("original values after 2nd append",
+        assertIntArrayEquals("original values after 2nd append",
                 dstCopy.getPrimitiveArray(), 0, dst.getPrimitiveArray(), 0, dstLen);
-        assertArrayEquals("appended values after 2nd append",
+        assertIntArrayEquals("appended values after 2nd append",
                 src.getPrimitiveArray(), 0, dst.getPrimitiveArray(), dstLen, srcLen);
-        assertArrayEquals("appended values after 2nd append",
+        assertIntArrayEquals("appended values after 2nd append",
                 src.getPrimitiveArray(), 0, dst.getPrimitiveArray(), dstLen + srcLen, srcLen);
     }
 
@@ -319,16 +321,22 @@
         }
     }
 
-    private static void assertArrayEquals(String message, int[] expecteds, int expectedPos,
-            int[] actuals, int actualPos, int length) {
-        if (expecteds == null && actuals == null) {
+    private static void assertIntArrayEquals(final String message, final int[] expecteds,
+            final int expectedPos, final int[] actuals, final int actualPos, final int length) {
+        if (expecteds == actuals) {
             return;
         }
         if (expecteds == null || actuals == null) {
-            fail(message + ": expecteds=" + expecteds + " actuals=" + actuals);
+            assertEquals(message, Arrays.toString(expecteds), Arrays.toString(actuals));
+            return;
+        }
+        if (expecteds.length < expectedPos + length || actuals.length < actualPos + length) {
+            fail(message + ": insufficient length: expecteds=" + Arrays.toString(expecteds)
+                    + " actuals=" + Arrays.toString(actuals));
+            return;
         }
         for (int i = 0; i < length; i++) {
-            assertEquals(message + ": element at " + i,
+            assertEquals(message + " [" + i + "]",
                     expecteds[i + expectedPos], actuals[i + actualPos]);
         }
     }
