Code clean-up: remove warnings around TestCase usage.

We don't need TestCase object but need AndroidTestCase anyway,
so verifiers accept AndroidTestCase object, which is often
dropped silently.

Change-Id: I9bd45dd1d2481ccc8b95e62ea62c5e014f1d7057
diff --git a/tests/src/com/android/vcard/tests/test_utils/ExportTestProvider.java b/tests/src/com/android/vcard/tests/test_utils/ExportTestProvider.java
index caedf9d..e3f39f4 100644
--- a/tests/src/com/android/vcard/tests/test_utils/ExportTestProvider.java
+++ b/tests/src/com/android/vcard/tests/test_utils/ExportTestProvider.java
@@ -24,6 +24,7 @@
 import android.provider.ContactsContract.Contacts;
 import android.provider.ContactsContract.Data;
 import android.provider.ContactsContract.RawContacts;
+import android.test.AndroidTestCase;
 import android.test.mock.MockContentProvider;
 import android.test.mock.MockCursor;
 
@@ -36,7 +37,6 @@
 import java.util.List;
 
 /* package */ class ExportTestProvider extends MockContentProvider {
-    final private TestCase mTestCase;
     final private ArrayList<ContactEntry> mContactEntryList = new ArrayList<ContactEntry>();
 
     private static class MockEntityIterator implements EntityIterator {
@@ -73,8 +73,7 @@
         }
     }
 
-    public ExportTestProvider(TestCase testCase) {
-        mTestCase = testCase;
+    public ExportTestProvider(AndroidTestCase androidTestCase) {
     }
 
     public ContactEntry buildInputEntry() {
@@ -94,14 +93,14 @@
      */
     public EntityIterator queryEntities(Uri uri,
             String selection, String[] selectionArgs, String sortOrder) {
-        mTestCase.assertTrue(uri != null);
-        mTestCase.assertTrue(ContentResolver.SCHEME_CONTENT.equals(uri.getScheme()));
+        TestCase.assertTrue(uri != null);
+        TestCase.assertTrue(ContentResolver.SCHEME_CONTENT.equals(uri.getScheme()));
         final String authority = uri.getAuthority();
-        mTestCase.assertTrue(RawContacts.CONTENT_URI.getAuthority().equals(authority));
-        mTestCase.assertTrue((Data.CONTACT_ID + "=?").equals(selection));
-        mTestCase.assertEquals(1, selectionArgs.length);
+        TestCase.assertTrue(RawContacts.CONTENT_URI.getAuthority().equals(authority));
+        TestCase.assertTrue((Data.CONTACT_ID + "=?").equals(selection));
+        TestCase.assertEquals(1, selectionArgs.length);
         final int id = Integer.parseInt(selectionArgs[0]);
-        mTestCase.assertTrue(id >= 0 && id < mContactEntryList.size());
+        TestCase.assertTrue(id >= 0 && id < mContactEntryList.size());
 
         return new MockEntityIterator(mContactEntryList.get(id).getList());
     }
@@ -109,11 +108,11 @@
     @Override
     public Cursor query(Uri uri,String[] projection,
             String selection, String[] selectionArgs, String sortOrder) {
-        mTestCase.assertTrue(VCardComposer.CONTACTS_TEST_CONTENT_URI.equals(uri));
+        TestCase.assertTrue(VCardComposer.CONTACTS_TEST_CONTENT_URI.equals(uri));
         // In this test, following arguments are not supported.
-        mTestCase.assertNull(selection);
-        mTestCase.assertNull(selectionArgs);
-        mTestCase.assertNull(sortOrder);
+        TestCase.assertNull(selection);
+        TestCase.assertNull(selectionArgs);
+        TestCase.assertNull(sortOrder);
 
         return new MockCursor() {
             int mCurrentPosition = -1;
@@ -151,14 +150,14 @@
 
             @Override
             public int getColumnIndex(String columnName) {
-                mTestCase.assertEquals(Contacts._ID, columnName);
+                TestCase.assertEquals(Contacts._ID, columnName);
                 return 0;
             }
 
             @Override
             public int getInt(int columnIndex) {
-                mTestCase.assertEquals(0, columnIndex);
-                mTestCase.assertTrue(mCurrentPosition >= 0
+                TestCase.assertEquals(0, columnIndex);
+                TestCase.assertTrue(mCurrentPosition >= 0
                         && mCurrentPosition < mContactEntryList.size());
                 return mCurrentPosition;
             }
diff --git a/tests/src/com/android/vcard/tests/test_utils/ExportTestResolver.java b/tests/src/com/android/vcard/tests/test_utils/ExportTestResolver.java
index 3cd014c..b5a7dea 100644
--- a/tests/src/com/android/vcard/tests/test_utils/ExportTestResolver.java
+++ b/tests/src/com/android/vcard/tests/test_utils/ExportTestResolver.java
@@ -16,16 +16,15 @@
 package com.android.vcard.tests.test_utils;
 
 import android.provider.ContactsContract.RawContacts;
+import android.test.AndroidTestCase;
 import android.test.mock.MockContentResolver;
 
 import com.android.vcard.VCardComposer;
 
-import junit.framework.TestCase;
-
 /* package */ class ExportTestResolver extends MockContentResolver {
     private final ExportTestProvider mProvider;
-    public ExportTestResolver(TestCase testCase) {
-        mProvider = new ExportTestProvider(testCase);
+    public ExportTestResolver(AndroidTestCase androidTestCase) {
+        mProvider = new ExportTestProvider(androidTestCase);
         addProvider(VCardComposer.VCARD_TEST_AUTHORITY, mProvider);
         addProvider(RawContacts.CONTENT_URI.getAuthority(), mProvider);
     }
diff --git a/tests/src/com/android/vcard/tests/test_utils/ImportTestProvider.java b/tests/src/com/android/vcard/tests/test_utils/ImportTestProvider.java
index 3d7cb60..55f5b65 100644
--- a/tests/src/com/android/vcard/tests/test_utils/ImportTestProvider.java
+++ b/tests/src/com/android/vcard/tests/test_utils/ImportTestProvider.java
@@ -19,8 +19,6 @@
 import android.content.ContentProviderResult;
 import android.content.ContentValues;
 import android.net.Uri;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.RawContacts;
 import android.provider.ContactsContract.CommonDataKinds.Email;
 import android.provider.ContactsContract.CommonDataKinds.Event;
 import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
@@ -34,6 +32,9 @@
 import android.provider.ContactsContract.CommonDataKinds.StructuredName;
 import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
 import android.provider.ContactsContract.CommonDataKinds.Website;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.RawContacts;
+import android.test.AndroidTestCase;
 import android.test.mock.MockContentProvider;
 import android.text.TextUtils;
 import android.util.Log;
@@ -46,10 +47,10 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.SortedMap;
 import java.util.TreeMap;
-import java.util.Map.Entry;
 
 /* package */ class ImportTestProvider extends MockContentProvider {
     private static final Set<String> sKnownMimeTypeSet =
@@ -64,10 +65,7 @@
 
     final Map<String, Collection<ContentValues>> mMimeTypeToExpectedContentValues;
 
-    private final TestCase mTestCase;
-
-    public ImportTestProvider(TestCase testCase) {
-        mTestCase = testCase;
+    public ImportTestProvider(AndroidTestCase androidTestCase) {
         mMimeTypeToExpectedContentValues =
             new HashMap<String, Collection<ContentValues>>();
         for (String acceptanbleMimeType : sKnownMimeTypeSet) {
@@ -82,7 +80,7 @@
     public void addExpectedContentValues(ContentValues expectedContentValues) {
         final String mimeType = expectedContentValues.getAsString(Data.MIMETYPE);
         if (!sKnownMimeTypeSet.contains(mimeType)) {
-            mTestCase.fail(String.format(
+            TestCase.fail(String.format(
                     "Unknow MimeType %s in the test code. Test code should be broken.",
                     mimeType));
         }
@@ -96,7 +94,7 @@
     public ContentProviderResult[] applyBatch(
             ArrayList<ContentProviderOperation> operations) {
         if (operations == null) {
-            mTestCase.fail("There is no operation.");
+            TestCase.fail("There is no operation.");
         }
 
         final int size = operations.size();
@@ -117,12 +115,12 @@
                     fakeResultArray, i);
             final Uri uri = operation.getUri();
             if (uri.equals(RawContacts.CONTENT_URI)) {
-                mTestCase.assertNull(actualContentValues.get(RawContacts.ACCOUNT_NAME));
-                mTestCase.assertNull(actualContentValues.get(RawContacts.ACCOUNT_TYPE));
+                TestCase.assertNull(actualContentValues.get(RawContacts.ACCOUNT_NAME));
+                TestCase.assertNull(actualContentValues.get(RawContacts.ACCOUNT_TYPE));
             } else if (uri.equals(Data.CONTENT_URI)) {
                 final String mimeType = actualContentValues.getAsString(Data.MIMETYPE);
                 if (!sKnownMimeTypeSet.contains(mimeType)) {
-                    mTestCase.fail(String.format(
+                    TestCase.fail(String.format(
                             "Unknown MimeType %s. Probably added after developing this test",
                             mimeType));
                 }
@@ -154,7 +152,7 @@
                 final Collection<ContentValues> contentValuesCollection =
                     mMimeTypeToExpectedContentValues.get(mimeType);
                 if (contentValuesCollection.isEmpty()) {
-                    mTestCase.fail("ContentValues for MimeType " + mimeType
+                    TestCase.fail("ContentValues for MimeType " + mimeType
                             + " is not expected at all (" + actualContentValues + ")");
                 }
                 boolean checked = false;
@@ -166,7 +164,7 @@
                             + convertToEasilyReadableString(actualContentValues));*/
                     if (equalsForContentValues(expectedContentValues,
                             actualContentValues)) {
-                        mTestCase.assertTrue(contentValuesCollection.remove(expectedContentValues));
+                        TestCase.assertTrue(contentValuesCollection.remove(expectedContentValues));
                         checked = true;
                         break;
                     }
@@ -179,10 +177,10 @@
                     for (ContentValues expectedContentValues : contentValuesCollection) {
                         builder.append(convertToEasilyReadableString(expectedContentValues));
                     }
-                    mTestCase.fail(builder.toString());
+                    TestCase.fail(builder.toString());
                 }
             } else {
-                mTestCase.fail("Unexpected Uri has come: " + uri);
+                TestCase.fail("Unexpected Uri has come: " + uri);
             }
         }  // for (int i = 0; i < size; i++) {
         return fakeResultArray;
@@ -201,7 +199,7 @@
             final String failMsg =
                 "There is(are) remaining expected ContentValues instance(s): \n"
                     + builder.toString();
-            mTestCase.fail(failMsg);
+            TestCase.fail(failMsg);
         }
     }
 
@@ -221,7 +219,7 @@
             if (Data.MIMETYPE.equals(key)) {
                 mimeTypeValue = valueString;
             } else {
-                mTestCase.assertNotNull(key);
+                TestCase.assertNotNull(key);
                 sortedMap.put(key, valueString);
             }
         }
diff --git a/tests/src/com/android/vcard/tests/test_utils/ImportTestResolver.java b/tests/src/com/android/vcard/tests/test_utils/ImportTestResolver.java
index 645e9db..151a861 100644
--- a/tests/src/com/android/vcard/tests/test_utils/ImportTestResolver.java
+++ b/tests/src/com/android/vcard/tests/test_utils/ImportTestResolver.java
@@ -19,17 +19,16 @@
 import android.content.ContentProviderResult;
 import android.content.ContentValues;
 import android.provider.ContactsContract.RawContacts;
+import android.test.AndroidTestCase;
 import android.test.mock.MockContentResolver;
 
-import junit.framework.TestCase;
-
 import java.util.ArrayList;
 
 /* package */ class ImportTestResolver extends MockContentResolver {
     private final ImportTestProvider mProvider;
 
-    public ImportTestResolver(TestCase testCase) {
-        mProvider = new ImportTestProvider(testCase);
+    public ImportTestResolver(AndroidTestCase androidTestCase) {
+        mProvider = new ImportTestProvider(androidTestCase);
     }
 
     @Override
diff --git a/tests/src/com/android/vcard/tests/test_utils/LineVerifier.java b/tests/src/com/android/vcard/tests/test_utils/LineVerifier.java
index d8cfe5b..9e31d53 100644
--- a/tests/src/com/android/vcard/tests/test_utils/LineVerifier.java
+++ b/tests/src/com/android/vcard/tests/test_utils/LineVerifier.java
@@ -15,38 +15,39 @@
  */
 package com.android.vcard.tests.test_utils;
 
-import com.android.vcard.VCardComposer;
-
 import android.content.Context;
+import android.test.AndroidTestCase;
+
+import com.android.vcard.VCardComposer;
 
 import junit.framework.TestCase;
 
 import java.util.ArrayList;
 
 public class LineVerifier implements VCardComposer.OneEntryHandler {
-    private final TestCase mTestCase;
+    private final AndroidTestCase mAndroidTestCase;
     private final ArrayList<LineVerifierElem> mLineVerifierElemList;
     private int mVCardType;
     private int index;
 
-    public LineVerifier(TestCase testCase, int vcardType) {
-        mTestCase = testCase;
+    public LineVerifier(AndroidTestCase androidTestCase, int vcardType) {
+        mAndroidTestCase = androidTestCase;
         mLineVerifierElemList = new ArrayList<LineVerifierElem>();
         mVCardType = vcardType;
     }
 
     public LineVerifierElem addLineVerifierElem() {
-        LineVerifierElem lineVerifier = new LineVerifierElem(mTestCase, mVCardType);
+        LineVerifierElem lineVerifier = new LineVerifierElem(mAndroidTestCase, mVCardType);
         mLineVerifierElemList.add(lineVerifier);
         return lineVerifier;
     }
 
     public void verify(String vcard) {
         if (index >= mLineVerifierElemList.size()) {
-            mTestCase.fail("Insufficient number of LineVerifier (" + index + ")");
+            TestCase.fail("Insufficient number of LineVerifier (" + index + ")");
         }
 
-        LineVerifierElem lineVerifier = mLineVerifierElemList.get(index);
+        final LineVerifierElem lineVerifier = mLineVerifierElemList.get(index);
         lineVerifier.verify(vcard);
 
         index++;
diff --git a/tests/src/com/android/vcard/tests/test_utils/LineVerifierElem.java b/tests/src/com/android/vcard/tests/test_utils/LineVerifierElem.java
index cdabe71..f730f1e 100644
--- a/tests/src/com/android/vcard/tests/test_utils/LineVerifierElem.java
+++ b/tests/src/com/android/vcard/tests/test_utils/LineVerifierElem.java
@@ -15,6 +15,7 @@
  */
 package com.android.vcard.tests.test_utils;
 
+import android.test.AndroidTestCase;
 import android.text.TextUtils;
 
 import com.android.vcard.VCardConfig;
@@ -25,12 +26,10 @@
 import java.util.List;
 
 public class LineVerifierElem {
-    private final TestCase mTestCase;
     private final List<String> mExpectedLineList = new ArrayList<String>();
     private final int mVCardType;
 
-    public LineVerifierElem(TestCase testCase, int vcardType) {
-        mTestCase = testCase;
+    public LineVerifierElem(AndroidTestCase androidTestCase, int vcardType) {
         mVCardType = vcardType;
     }
 
diff --git a/tests/src/com/android/vcard/tests/test_utils/PropertyNodesVerifierElem.java b/tests/src/com/android/vcard/tests/test_utils/PropertyNodesVerifierElem.java
index 6eb8498..e4a275c 100644
--- a/tests/src/com/android/vcard/tests/test_utils/PropertyNodesVerifierElem.java
+++ b/tests/src/com/android/vcard/tests/test_utils/PropertyNodesVerifierElem.java
@@ -16,6 +16,7 @@
 package com.android.vcard.tests.test_utils;
 
 import android.content.ContentValues;
+import android.test.AndroidTestCase;
 
 import junit.framework.TestCase;
 
@@ -50,12 +51,10 @@
     // Intentionally use ArrayList instead of Set, assuming there may be more than one
     // exactly same objects.
     private final ArrayList<PropertyNode> mUnorderedNodeList;
-    private final TestCase mTestCase;
 
-    public PropertyNodesVerifierElem(TestCase testCase) {
+    public PropertyNodesVerifierElem(AndroidTestCase androidTestCase) {
         mOrderedNodeMap = new HashMap<String, List<PropertyNode>>();
         mUnorderedNodeList = new ArrayList<PropertyNode>();
-        mTestCase = testCase;
     }
 
     // WithOrder
@@ -212,7 +211,7 @@
                     expectedProps.add(node.propName);
                 }
             }
-            mTestCase.fail("Expected property " + Arrays.toString(expectedProps.toArray())
+            TestCase.fail("Expected property " + Arrays.toString(expectedProps.toArray())
                     + " was not found.");
         }
     }
@@ -249,7 +248,7 @@
                             expectedButDifferentValueList);
                 } else {
                     // There's no expected node with same propName.
-                    mTestCase.fail("Unexpected property \"" + propName + "\" exists.");
+                    TestCase.fail("Unexpected property \"" + propName + "\" exists.");
                 }
             }
         } else {
@@ -264,7 +263,7 @@
                             expectedButDifferentValueList);
                 } else {
                     // There's no expected node with same propName.
-                    mTestCase.fail("Unexpected property \"" + propName + "\" exists.");
+                    TestCase.fail("Unexpected property \"" + propName + "\" exists.");
                 }
             }
         }
@@ -310,7 +309,7 @@
             builder.append(expectedNode.toString());
             builder.append("\n");
         }
-        mTestCase.fail("Property \"" + propName + "\" has wrong value.\n"
+        TestCase.fail("Property \"" + propName + "\" has wrong value.\n"
                 + builder.toString()
                 + "  actual: " + actualNode.toString());
     }