Fix some unit tests

- some proguard flags were stale
- some deprecated methods were legitimately stripped - kill the tests
for them

Bug: 4330508
Change-Id: I6d5c46c99d002895377f32b203844e9a6dcf0074
diff --git a/proguard.flags b/proguard.flags
index 0f6c90a..b39a182 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -192,6 +192,10 @@
   *** getBody();
 }
 
+-keepclasseswithmembers class com.android.email.mail.FolderProperties {
+  *** getDisplayName(int);
+}
+
 # The following classes are used only by unit tests.
 # We should move them into tests/ if possible.
 
diff --git a/src/com/android/email/mail/Transport.java b/src/com/android/email/mail/Transport.java
index 3de50f5..2a30d02 100644
--- a/src/com/android/email/mail/Transport.java
+++ b/src/com/android/email/mail/Transport.java
@@ -56,16 +56,6 @@
     public Transport newInstanceWithConfiguration();
 
     /**
-     * Set the Uri for the connection.
-     *
-     * @param uri The Uri for the connection
-     * @param defaultPort If the Uri does not include an explicit port, this value will be used.
-     * @deprecated use the individual methods {@link #setHost(String)} and {@link #setPort(int)}
-     */
-    @Deprecated
-    public void setUri(URI uri, int defaultPort);
-
-    /**
      * Sets the host
      */
     public void setHost(String host);
diff --git a/src/com/android/email/mail/transport/MailTransport.java b/src/com/android/email/mail/transport/MailTransport.java
index 6ae40b7..09541f4 100644
--- a/src/com/android/email/mail/transport/MailTransport.java
+++ b/src/com/android/email/mail/transport/MailTransport.java
@@ -100,21 +100,6 @@
 
     @Override
     @Deprecated
-    public void setUri(URI uri, int defaultPort) {
-        mHost = uri.getHost();
-
-        mPort = defaultPort;
-        if (uri.getPort() != -1) {
-            mPort = uri.getPort();
-        }
-
-        if (uri.getUserInfo() != null) {
-            mUserInfoParts = uri.getUserInfo().split(":", 2);
-        }
-    }
-
-    @Override
-    @Deprecated
     public String[] getUserInfoParts() {
         return mUserInfoParts;
     }
diff --git a/tests/src/com/android/email/mail/StoreTests.java b/tests/src/com/android/email/mail/StoreTests.java
index 91db0f2..8ce7002 100644
--- a/tests/src/com/android/email/mail/StoreTests.java
+++ b/tests/src/com/android/email/mail/StoreTests.java
@@ -30,6 +30,12 @@
  */
 @MediumTest
 public class StoreTests extends AndroidTestCase {
+
+    @Override
+    public void setUp() {
+        Store.sStores.clear();
+    }
+
     public void testGetStoreKey() throws MessagingException {
         HostAuth testAuth = new HostAuth();
         Account testAccount = new Account();
diff --git a/tests/src/com/android/email/mail/store/ImapStoreUnitTests.java b/tests/src/com/android/email/mail/store/ImapStoreUnitTests.java
index f3afbdc..d6b6aa0 100644
--- a/tests/src/com/android/email/mail/store/ImapStoreUnitTests.java
+++ b/tests/src/com/android/email/mail/store/ImapStoreUnitTests.java
@@ -102,7 +102,8 @@
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        mTestContext = getInstrumentation().getContext();
+        // TODO: this should really use a mock context.
+        mTestContext = getInstrumentation().getTargetContext();
         // Use the target's (i.e. the Email application) context
         TempDirectory.setTempDirectory(getInstrumentation().getTargetContext());
 
diff --git a/tests/src/com/android/email/mail/transport/MailTransportUnitTests.java b/tests/src/com/android/email/mail/transport/MailTransportUnitTests.java
deleted file mode 100644
index 8c32986..0000000
--- a/tests/src/com/android/email/mail/transport/MailTransportUnitTests.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.email.mail.transport;
-
-import com.android.email.mail.transport.MailTransport;
-
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * Simple unit tests for MailSender.  Tests here should not attempt any actual connections.
- */
-@SmallTest
-public class MailTransportUnitTests extends AndroidTestCase {
-
-    /**
-     * Tests of the Uri parsing logic
-     */
-    public void testUriParsing() throws URISyntaxException {
-
-        // Parse with everything in the Uri
-        URI uri = new URI("smtp://user:password@server.com:999");
-        MailTransport transport = new MailTransport("SMTP");
-        transport.setUri(uri, 888);
-        assertEquals("server.com", transport.getHost());
-        assertEquals(999, transport.getPort());
-        String[] userInfoParts = transport.getUserInfoParts();
-        assertNotNull(userInfoParts);
-        assertEquals("user", userInfoParts[0]);
-        assertEquals("password", userInfoParts[1]);
-
-        // Parse with no user/password (e.g. anonymous SMTP)
-        uri = new URI("smtp://server.com:999");
-        transport = new MailTransport("SMTP");
-        transport.setUri(uri, 888);
-        assertEquals("server.com", transport.getHost());
-        assertEquals(999, transport.getPort());
-        assertNull(transport.getUserInfoParts());
-    }
-}