From a492673609111fe8c41ae152d62547b267346502 Mon Sep 17 00:00:00 2001 From: Mihai Preda Date: Thu, 18 Jun 2009 12:16:28 -0700 Subject: [PATCH] Review Email tests annotations (small/medium/large) and change some annotations based on time. Fix an NPE appearing when running the test suite. BUG: 1566281, 1910409. --- src/com/android/email/mail/Store.java | 2 +- tests/src/com/android/email/AccountUnitTests.java | 4 ++-- .../email/activity/MessageComposeInstrumentationTests.java | 4 ++-- tests/src/com/android/email/activity/MessageViewTests.java | 4 ++-- .../src/com/android/email/mail/internet/MimeMessageTest.java | 2 ++ .../src/com/android/email/mail/store/LocalStoreUnitTests.java | 4 ++-- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/com/android/email/mail/Store.java b/src/com/android/email/mail/Store.java index 9709b20ab..4956a9836 100644 --- a/src/com/android/email/mail/Store.java +++ b/src/com/android/email/mail/Store.java @@ -115,7 +115,7 @@ public abstract class Store { if (xmlEventType == XmlResourceParser.START_TAG && "store".equals(xml.getName())) { String xmlScheme = xml.getAttributeValue(null, "scheme"); - if (scheme.startsWith(xmlScheme)) { + if (scheme != null && scheme.startsWith(xmlScheme)) { StoreInfo result = new StoreInfo(); result.mScheme = xmlScheme; result.mClassName = xml.getAttributeValue(null, "class"); diff --git a/tests/src/com/android/email/AccountUnitTests.java b/tests/src/com/android/email/AccountUnitTests.java index 2354d519f..23a9d7afc 100644 --- a/tests/src/com/android/email/AccountUnitTests.java +++ b/tests/src/com/android/email/AccountUnitTests.java @@ -21,7 +21,7 @@ import com.android.email.mail.Store; import android.content.Context; import android.content.SharedPreferences; import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.SmallTest; +import android.test.suitebuilder.annotation.MediumTest; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -34,7 +34,7 @@ import java.io.ObjectOutputStream; * * Technically these are functional because they use the underlying preferences framework. */ -@SmallTest +@MediumTest public class AccountUnitTests extends AndroidTestCase { private Preferences mPreferences; diff --git a/tests/src/com/android/email/activity/MessageComposeInstrumentationTests.java b/tests/src/com/android/email/activity/MessageComposeInstrumentationTests.java index 33dec4f2b..a26127c88 100644 --- a/tests/src/com/android/email/activity/MessageComposeInstrumentationTests.java +++ b/tests/src/com/android/email/activity/MessageComposeInstrumentationTests.java @@ -31,7 +31,7 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.test.ActivityInstrumentationTestCase2; -import android.test.suitebuilder.annotation.MediumTest; +import android.test.suitebuilder.annotation.LargeTest; import android.view.View; import android.widget.EditText; @@ -40,7 +40,7 @@ import android.widget.EditText; * * It might be possible to convert these to ActivityUnitTest, which would be faster. */ -@MediumTest +@LargeTest public class MessageComposeInstrumentationTests extends ActivityInstrumentationTestCase2 { diff --git a/tests/src/com/android/email/activity/MessageViewTests.java b/tests/src/com/android/email/activity/MessageViewTests.java index 65b6e5d7f..09be557b7 100644 --- a/tests/src/com/android/email/activity/MessageViewTests.java +++ b/tests/src/com/android/email/activity/MessageViewTests.java @@ -28,7 +28,7 @@ import android.content.Context; import android.content.Intent; import android.os.Environment; import android.test.ActivityInstrumentationTestCase2; -import android.test.suitebuilder.annotation.MediumTest; +import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.Suppress; import android.webkit.WebView; import android.widget.TextView; @@ -46,7 +46,7 @@ import java.util.Arrays; * * It might be possible to convert these to ActivityUnitTest, which would be faster. */ -@MediumTest +@LargeTest public class MessageViewTests extends ActivityInstrumentationTestCase2 { diff --git a/tests/src/com/android/email/mail/internet/MimeMessageTest.java b/tests/src/com/android/email/mail/internet/MimeMessageTest.java index 24474b38a..be82f96cc 100644 --- a/tests/src/com/android/email/mail/internet/MimeMessageTest.java +++ b/tests/src/com/android/email/mail/internet/MimeMessageTest.java @@ -22,6 +22,7 @@ import com.android.email.mail.MessagingException; import com.android.email.mail.Message.RecipientType; import android.test.suitebuilder.annotation.SmallTest; +import android.test.suitebuilder.annotation.MediumTest; import java.io.ByteArrayOutputStream; import java.text.ParseException; @@ -69,6 +70,7 @@ public class MimeMessageTest extends TestCase { * @throws MessagingException * @throws ParseException */ + @MediumTest public void testSetSentDate() throws MessagingException, ParseException { Locale savedLocale = Locale.getDefault(); Locale.setDefault(Locale.US); diff --git a/tests/src/com/android/email/mail/store/LocalStoreUnitTests.java b/tests/src/com/android/email/mail/store/LocalStoreUnitTests.java index 2db359805..a18dda85f 100644 --- a/tests/src/com/android/email/mail/store/LocalStoreUnitTests.java +++ b/tests/src/com/android/email/mail/store/LocalStoreUnitTests.java @@ -41,7 +41,7 @@ import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.SmallTest; +import android.test.suitebuilder.annotation.MediumTest; import java.io.File; import java.net.URI; @@ -53,7 +53,7 @@ import java.util.HashSet; /** * This is a series of unit tests for the LocalStore class. */ -@SmallTest +@MediumTest public class LocalStoreUnitTests extends AndroidTestCase { private static final String dbName = "com.android.email.mail.store.LocalStoreUnitTests.db";