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
This commit is contained in:
parent
a6e6b9969a
commit
d9cf94632f
|
@ -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.
|
||||
|
||||
|
|
|
@ -55,16 +55,6 @@ public interface Transport {
|
|||
*/
|
||||
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
|
||||
*/
|
||||
|
|
|
@ -98,21 +98,6 @@ public class MailTransport implements Transport {
|
|||
return newObject;
|
||||
}
|
||||
|
||||
@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() {
|
||||
|
|
|
@ -30,6 +30,12 @@ import android.test.suitebuilder.annotation.MediumTest;
|
|||
*/
|
||||
@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();
|
||||
|
|
|
@ -102,7 +102,8 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
@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());
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue