Fix CP2 unit tests

Bug 27119132

Change-Id: I5eca1c91db5e7cab946d0011a0a62575991d038f
diff --git a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
index 65b8f1e..b0c3ef4 100644
--- a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
+++ b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
@@ -2899,8 +2899,8 @@
     }
 
     public void testUpdateMetadataOnRawContactInsert() throws Exception {
-        ContactMetadataProvider contactMetadataProvider = (ContactMetadataProvider) addProvider(
-                ContactMetadataProvider.class, MetadataSync.METADATA_AUTHORITY);
+        ContactMetadataProvider contactMetadataProvider = addProvider(
+                ContactMetadataProviderTestable.class, MetadataSync.METADATA_AUTHORITY);
         // Reset the dbHelper to be the one ContactsProvider2 is using. Before this, two providers
         // are using different dbHelpers.
         contactMetadataProvider.setDatabaseHelper(((SynchronousContactsProvider2)
@@ -2955,8 +2955,8 @@
     }
 
     public void testUpdateMetadataOnRawContactBackupIdChange() throws Exception {
-        ContactMetadataProvider contactMetadataProvider = (ContactMetadataProvider) addProvider(
-                ContactMetadataProvider.class, MetadataSync.METADATA_AUTHORITY);
+        ContactMetadataProvider contactMetadataProvider = addProvider(
+                ContactMetadataProviderTestable.class, MetadataSync.METADATA_AUTHORITY);
         // Reset the dbHelper to be the one ContactsProvider2 is using. Before this, two providers
         // are using different dbHelpers.
         contactMetadataProvider.setDatabaseHelper(((SynchronousContactsProvider2)
@@ -3021,8 +3021,8 @@
     }
 
     public void testDeleteMetadataOnRawContactDelete() throws Exception {
-        ContactMetadataProvider contactMetadataProvider = (ContactMetadataProvider) addProvider(
-                ContactMetadataProvider.class, MetadataSync.METADATA_AUTHORITY);
+        ContactMetadataProvider contactMetadataProvider = addProvider(
+                ContactMetadataProviderTestable.class, MetadataSync.METADATA_AUTHORITY);
         // Reset the dbHelper to be the one ContactsProvider2 is using. Before this, two providers
         // are using different dbHelpers.
         contactMetadataProvider.setDatabaseHelper(((SynchronousContactsProvider2)
@@ -6630,8 +6630,8 @@
         mActor.setAccounts(new Account[]{doomedAccount, safeAccount});
         cp.onAccountsUpdated(new Account[]{doomedAccount, safeAccount});
 
-        ContactMetadataProvider contactMetadataProvider = (ContactMetadataProvider) addProvider(
-                ContactMetadataProvider.class, MetadataSync.METADATA_AUTHORITY);
+        ContactMetadataProvider contactMetadataProvider = addProvider(
+                ContactMetadataProviderTestable.class, MetadataSync.METADATA_AUTHORITY);
         // Reset the dbHelper to be the one ContactsProvider2 is using. Before this, two providers
         // are using different dbHelpers.
         contactMetadataProvider.setDatabaseHelper(((SynchronousContactsProvider2)