From 5d93d1139e01a74639ff979cf5908170ed6626d1 Mon Sep 17 00:00:00 2001 From: cketti Date: Sun, 25 Feb 2018 01:28:42 +0100 Subject: [PATCH] Update Robolectric to 3.7.1 and simplify test annotations --- gradle.properties | 2 +- k9mail/build.gradle | 6 ++++++ .../com/fsck/k9/K9RobolectricTestRunner.java | 20 ------------------- .../k9/activity/ActivityListenerTest.java | 4 ++-- .../k9/activity/MessageReferenceTest.java | 6 ++---- .../activity/compose/RecipientLoaderTest.java | 6 +++--- .../compose/RecipientPresenterTest.java | 6 +++--- .../misc/ContactPictureLoaderTest.java | 6 +++--- .../autocrypt/AutocryptHeaderParserTest.java | 10 ++-------- .../fsck/k9/cache/EmailProviderCacheTest.java | 11 +++++----- .../controller/MessagingControllerTest.java | 4 ++-- .../fsck/k9/controller/imap/ImapSyncTest.java | 4 ++-- .../MessageCryptoStructureDetectorTest.java | 6 ++---- .../fsck/k9/crypto/OpenPgpApiHelperTest.java | 8 +++----- .../com/fsck/k9/helper/IdentityHelperTest.kt | 4 ++-- .../java/com/fsck/k9/helper/MailToTest.java | 6 ++---- .../com/fsck/k9/helper/MessageHelperTest.java | 6 ++---- .../com/fsck/k9/helper/ReplyToParserTest.java | 6 ++---- .../k9/mailstore/AttachmentResolverTest.java | 9 ++++----- .../k9/mailstore/DeferredFileBodyTest.java | 8 +++----- .../MessageViewInfoExtractorTest.java | 4 ++-- .../com/fsck/k9/mailstore/MigrationTest.java | 5 +++-- .../mailstore/StoreSchemaDefinitionTest.java | 6 ++---- .../MigrationMimeStructureStateTest.java | 4 ++-- .../fsck/k9/message/MessageBuilderTest.java | 4 ++-- .../k9/message/PgpMessageBuilderTest.java | 4 ++-- .../AttachmentInfoExtractorTest.java | 8 +++----- .../extractors/EncryptionDetectorTest.java | 5 +++-- .../extractors/PreviewTextExtractorTest.java | 6 ++---- .../k9/message/html/HtmlConverterTest.java | 6 ++---- .../signature/HtmlSignatureRemoverTest.java | 7 ++----- .../AuthenticationErrorNotificationsTest.java | 4 ++-- .../notification/BaseNotificationsTest.java | 6 ++---- .../CertificateErrorNotificationsTest.java | 4 ++-- .../notification/DeviceNotificationsTest.java | 4 ++-- .../LockScreenNotificationTest.java | 4 ++-- .../NewMailNotificationsTest.java | 4 ++-- .../NotificationContentCreatorTest.java | 4 ++-- .../k9/notification/NotificationDataTest.java | 7 ++----- .../k9/notification/NotificationIdsTest.java | 8 +++----- .../SendFailedNotificationsTest.java | 4 ++-- .../notification/SyncNotificationsTest.java | 4 ++-- .../notification/WearNotificationsTest.java | 4 ++-- .../k9/preferences/SettingsExporterTest.java | 17 ++++++++-------- .../k9/preferences/SettingsImporterTest.java | 4 ++-- .../k9/setup/ServerNameSuggesterTest.java | 6 ++---- .../com/fsck/k9/view/MessageHeaderTest.kt | 4 ++-- 47 files changed, 116 insertions(+), 169 deletions(-) delete mode 100644 k9mail/src/test/java/com/fsck/k9/K9RobolectricTestRunner.java diff --git a/gradle.properties b/gradle.properties index 466c5b5521b..33e500c223a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ androidBuildToolsVersion=27.0.3 androidSupportLibraryVersion=27.0.2 timberVersion=4.5.1 -robolectricVersion=3.2.2 +robolectricVersion=3.7.1 junitVersion=4.12 mockitoVersion=1.10.19 okioVersion=1.11.0 diff --git a/k9mail/build.gradle b/k9mail/build.gradle index 7af74253269..03bcd8de81b 100644 --- a/k9mail/build.gradle +++ b/k9mail/build.gradle @@ -109,6 +109,12 @@ android { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } + + testOptions { + unitTests { + includeAndroidResources = true + } + } } if (project.hasProperty('keyAlias')) { diff --git a/k9mail/src/test/java/com/fsck/k9/K9RobolectricTestRunner.java b/k9mail/src/test/java/com/fsck/k9/K9RobolectricTestRunner.java deleted file mode 100644 index c9b91cc7510..00000000000 --- a/k9mail/src/test/java/com/fsck/k9/K9RobolectricTestRunner.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fsck.k9; - -import org.junit.runners.model.InitializationError; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; - -public class K9RobolectricTestRunner extends RobolectricTestRunner { - - public K9RobolectricTestRunner(Class testClass) throws InitializationError { - super(testClass); - } - - @Override - protected Config buildGlobalConfig() { - return new Config.Builder() - .setSdk(22) - .setManifest("src/main/AndroidManifest.xml") - .build(); - } -} \ No newline at end of file diff --git a/k9mail/src/test/java/com/fsck/k9/activity/ActivityListenerTest.java b/k9mail/src/test/java/com/fsck/k9/activity/ActivityListenerTest.java index f05813fc550..5add13b14e1 100644 --- a/k9mail/src/test/java/com/fsck/k9/activity/ActivityListenerTest.java +++ b/k9mail/src/test/java/com/fsck/k9/activity/ActivityListenerTest.java @@ -5,11 +5,11 @@ import com.fsck.k9.Account; import com.fsck.k9.K9; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.Message; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static junit.framework.Assert.assertEquals; @@ -17,7 +17,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class ActivityListenerTest { private static final String FOLDER = "folder"; private static final String ERROR_MESSAGE = "errorMessage"; diff --git a/k9mail/src/test/java/com/fsck/k9/activity/MessageReferenceTest.java b/k9mail/src/test/java/com/fsck/k9/activity/MessageReferenceTest.java index 29a1bcc9dfc..877a210fa47 100644 --- a/k9mail/src/test/java/com/fsck/k9/activity/MessageReferenceTest.java +++ b/k9mail/src/test/java/com/fsck/k9/activity/MessageReferenceTest.java @@ -1,11 +1,10 @@ package com.fsck.k9.activity; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.Flag; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; @@ -14,8 +13,7 @@ import static org.junit.Assert.assertNotNull; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class MessageReferenceTest { @Test diff --git a/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientLoaderTest.java b/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientLoaderTest.java index 5cef41381c9..d8d1e0c69c2 100644 --- a/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientLoaderTest.java +++ b/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientLoaderTest.java @@ -10,17 +10,17 @@ import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Email; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.Address; import com.fsck.k9.view.RecipientSelectView.Recipient; import com.fsck.k9.view.RecipientSelectView.RecipientCryptoStatus; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static android.provider.ContactsContract.CommonDataKinds.Email.TYPE_HOME; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalMatchers.aryEq; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; @@ -29,7 +29,7 @@ @SuppressWarnings("WeakerAccess") -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class RecipientLoaderTest { static final String CRYPTO_PROVIDER = "cryptoProvider"; static final String[] PROJECTION = { diff --git a/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.java b/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.java index b94f905b7f5..413eb0df025 100644 --- a/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.java +++ b/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.java @@ -11,7 +11,6 @@ import com.fsck.k9.Account; import com.fsck.k9.K9; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.activity.compose.RecipientMvpView.CryptoSpecialModeDisplayType; import com.fsck.k9.activity.compose.RecipientMvpView.CryptoStatusDisplayType; import com.fsck.k9.activity.compose.RecipientPresenter.CryptoMode; @@ -34,6 +33,7 @@ import org.openintents.openpgp.util.OpenPgpServiceConnection; import org.openintents.openpgp.util.ShadowOpenPgpAsyncTask; import org.robolectric.Robolectric; +import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowApplication; @@ -49,8 +49,8 @@ @SuppressWarnings("ConstantConditions") -@RunWith(K9RobolectricTestRunner.class) -@Config(shadows = {ShadowOpenPgpAsyncTask.class}) +@RunWith(RobolectricTestRunner.class) +@Config(shadows = { ShadowOpenPgpAsyncTask.class }) public class RecipientPresenterTest { private static final ReplyToAddresses TO_ADDRESSES = new ReplyToAddresses(Address.parse("to@example.org")); private static final List
ALL_TO_ADDRESSES = Arrays.asList(Address.parse("allTo@example.org")); diff --git a/k9mail/src/test/java/com/fsck/k9/activity/misc/ContactPictureLoaderTest.java b/k9mail/src/test/java/com/fsck/k9/activity/misc/ContactPictureLoaderTest.java index 5d34610115f..90ae4e86282 100644 --- a/k9mail/src/test/java/com/fsck/k9/activity/misc/ContactPictureLoaderTest.java +++ b/k9mail/src/test/java/com/fsck/k9/activity/misc/ContactPictureLoaderTest.java @@ -1,15 +1,15 @@ package com.fsck.k9.activity.misc; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.Address; - import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import static org.junit.Assert.assertEquals; -@RunWith(K9RobolectricTestRunner.class) + +@RunWith(RobolectricTestRunner.class) public class ContactPictureLoaderTest { @Test diff --git a/k9mail/src/test/java/com/fsck/k9/autocrypt/AutocryptHeaderParserTest.java b/k9mail/src/test/java/com/fsck/k9/autocrypt/AutocryptHeaderParserTest.java index 2dd070c41c1..ab882ec8ffc 100644 --- a/k9mail/src/test/java/com/fsck/k9/autocrypt/AutocryptHeaderParserTest.java +++ b/k9mail/src/test/java/com/fsck/k9/autocrypt/AutocryptHeaderParserTest.java @@ -1,7 +1,6 @@ package com.fsck.k9.autocrypt; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -14,7 +13,6 @@ import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -22,8 +20,6 @@ @RunWith(RobolectricTestRunner.class) -@Config(manifest = Config.NONE, sdk = 21) -@SuppressWarnings("WeakerAccess") public class AutocryptHeaderParserTest { AutocryptHeaderParser autocryptHeaderParser = AutocryptHeaderParser.getInstance(); @@ -123,8 +119,6 @@ private MimeMessage parseFromResource(String resourceName) throws IOException, M } private InputStream readFromResourceFile(String name) throws FileNotFoundException { - return new FileInputStream(RuntimeEnvironment.application.getPackageResourcePath() + "/src/test/resources/" + name); + return getClass().getResourceAsStream("/" + name); } - - -} \ No newline at end of file +} diff --git a/k9mail/src/test/java/com/fsck/k9/cache/EmailProviderCacheTest.java b/k9mail/src/test/java/com/fsck/k9/cache/EmailProviderCacheTest.java index 73168bca47e..c5b371b2a27 100644 --- a/k9mail/src/test/java/com/fsck/k9/cache/EmailProviderCacheTest.java +++ b/k9mail/src/test/java/com/fsck/k9/cache/EmailProviderCacheTest.java @@ -1,20 +1,19 @@ package com.fsck.k9.cache; -import com.fsck.k9.K9RobolectricTestRunner; +import java.util.Collections; +import java.util.UUID; + import com.fsck.k9.mailstore.LocalFolder; import com.fsck.k9.mailstore.LocalMessage; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; -import java.util.Collections; -import java.util.UUID; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; @@ -24,7 +23,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class EmailProviderCacheTest { private EmailProviderCache cache; diff --git a/k9mail/src/test/java/com/fsck/k9/controller/MessagingControllerTest.java b/k9mail/src/test/java/com/fsck/k9/controller/MessagingControllerTest.java index 821a9338143..fe14d564dae 100644 --- a/k9mail/src/test/java/com/fsck/k9/controller/MessagingControllerTest.java +++ b/k9mail/src/test/java/com/fsck/k9/controller/MessagingControllerTest.java @@ -14,7 +14,6 @@ import com.fsck.k9.Account; import com.fsck.k9.AccountStats; import com.fsck.k9.K9; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.Preferences; import com.fsck.k9.helper.Contacts; import com.fsck.k9.mail.AuthenticationFailedException; @@ -46,6 +45,7 @@ import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.robolectric.RobolectricTestRunner; import org.robolectric.shadows.ShadowApplication; import org.robolectric.shadows.ShadowLog; @@ -70,7 +70,7 @@ @SuppressWarnings("unchecked") -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class MessagingControllerTest { private static final String FOLDER_NAME = "Folder"; private static final String SENT_FOLDER_NAME = "Sent"; diff --git a/k9mail/src/test/java/com/fsck/k9/controller/imap/ImapSyncTest.java b/k9mail/src/test/java/com/fsck/k9/controller/imap/ImapSyncTest.java index 0cef8d7cae6..9ef46592163 100644 --- a/k9mail/src/test/java/com/fsck/k9/controller/imap/ImapSyncTest.java +++ b/k9mail/src/test/java/com/fsck/k9/controller/imap/ImapSyncTest.java @@ -11,7 +11,6 @@ import com.fsck.k9.Account; import com.fsck.k9.AccountStats; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.controller.MessagingController; import com.fsck.k9.controller.MessagingListener; import com.fsck.k9.controller.SimpleMessagingListener; @@ -34,6 +33,7 @@ import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.robolectric.RobolectricTestRunner; import org.robolectric.shadows.ShadowApplication; import org.robolectric.shadows.ShadowLog; @@ -51,7 +51,7 @@ @SuppressWarnings("unchecked") -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class ImapSyncTest { private static final String FOLDER_NAME = "Folder"; private static final int MAXIMUM_SMALL_MESSAGE_SIZE = 1000; diff --git a/k9mail/src/test/java/com/fsck/k9/crypto/MessageCryptoStructureDetectorTest.java b/k9mail/src/test/java/com/fsck/k9/crypto/MessageCryptoStructureDetectorTest.java index 92c968c9f9a..dfc408ccac8 100644 --- a/k9mail/src/test/java/com/fsck/k9/crypto/MessageCryptoStructureDetectorTest.java +++ b/k9mail/src/test/java/com/fsck/k9/crypto/MessageCryptoStructureDetectorTest.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.BodyPart; import com.fsck.k9.mail.Message; import com.fsck.k9.mail.Multipart; @@ -15,7 +14,7 @@ import com.fsck.k9.ui.crypto.MessageCryptoAnnotations; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static com.fsck.k9.message.TestMessageConstructionUtils.bodypart; import static com.fsck.k9.message.TestMessageConstructionUtils.messageFromBody; @@ -29,8 +28,7 @@ @SuppressWarnings("WeakerAccess") -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class MessageCryptoStructureDetectorTest { MessageCryptoAnnotations messageCryptoAnnotations = mock(MessageCryptoAnnotations.class); static final String PGP_INLINE_DATA = "" + diff --git a/k9mail/src/test/java/com/fsck/k9/crypto/OpenPgpApiHelperTest.java b/k9mail/src/test/java/com/fsck/k9/crypto/OpenPgpApiHelperTest.java index 149868ba4e0..15114be2d42 100644 --- a/k9mail/src/test/java/com/fsck/k9/crypto/OpenPgpApiHelperTest.java +++ b/k9mail/src/test/java/com/fsck/k9/crypto/OpenPgpApiHelperTest.java @@ -2,16 +2,14 @@ import com.fsck.k9.Identity; -import com.fsck.k9.K9RobolectricTestRunner; - import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static org.junit.Assert.assertEquals; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) + +@RunWith(RobolectricTestRunner.class) public class OpenPgpApiHelperTest { @Test diff --git a/k9mail/src/test/java/com/fsck/k9/helper/IdentityHelperTest.kt b/k9mail/src/test/java/com/fsck/k9/helper/IdentityHelperTest.kt index 24e2cb5ac29..aeea6e5cc27 100644 --- a/k9mail/src/test/java/com/fsck/k9/helper/IdentityHelperTest.kt +++ b/k9mail/src/test/java/com/fsck/k9/helper/IdentityHelperTest.kt @@ -3,7 +3,6 @@ package com.fsck.k9.helper import com.fsck.k9.Account import com.fsck.k9.Identity -import com.fsck.k9.K9RobolectricTestRunner import com.fsck.k9.mail.Address import com.fsck.k9.mail.Message import com.fsck.k9.mail.Message.RecipientType @@ -11,9 +10,10 @@ import com.fsck.k9.mail.internet.MimeMessage import com.google.common.truth.Truth.assertThat import org.junit.Test import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner import org.robolectric.RuntimeEnvironment -@RunWith(K9RobolectricTestRunner::class) +@RunWith(RobolectricTestRunner::class) class IdentityHelperTest { private val account = createDummyAccount() diff --git a/k9mail/src/test/java/com/fsck/k9/helper/MailToTest.java b/k9mail/src/test/java/com/fsck/k9/helper/MailToTest.java index 46ff491429b..ecb902a3f20 100644 --- a/k9mail/src/test/java/com/fsck/k9/helper/MailToTest.java +++ b/k9mail/src/test/java/com/fsck/k9/helper/MailToTest.java @@ -7,14 +7,13 @@ import android.net.Uri; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.helper.MailTo.CaseInsensitiveParamWrapper; import com.fsck.k9.mail.Address; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; @@ -23,8 +22,7 @@ import static org.junit.Assert.assertThat; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class MailToTest { @Rule public ExpectedException exception = ExpectedException.none(); diff --git a/k9mail/src/test/java/com/fsck/k9/helper/MessageHelperTest.java b/k9mail/src/test/java/com/fsck/k9/helper/MessageHelperTest.java index f306be0df40..82249db534b 100644 --- a/k9mail/src/test/java/com/fsck/k9/helper/MessageHelperTest.java +++ b/k9mail/src/test/java/com/fsck/k9/helper/MessageHelperTest.java @@ -5,20 +5,18 @@ import android.graphics.Color; import android.text.SpannableString; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.Address; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertTrue; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class MessageHelperTest { private Contacts contacts; private Contacts contactsWithFakeContact; diff --git a/k9mail/src/test/java/com/fsck/k9/helper/ReplyToParserTest.java b/k9mail/src/test/java/com/fsck/k9/helper/ReplyToParserTest.java index 6725cb25cd6..16f2f4131d2 100644 --- a/k9mail/src/test/java/com/fsck/k9/helper/ReplyToParserTest.java +++ b/k9mail/src/test/java/com/fsck/k9/helper/ReplyToParserTest.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import com.fsck.k9.Account; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.helper.ReplyToParser.ReplyToAddresses; import com.fsck.k9.mail.Address; import com.fsck.k9.mail.Message; @@ -14,7 +13,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -26,8 +25,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class ReplyToParserTest { private static final Address[] REPLY_TO_ADDRESSES = Address.parse("replyTo1@example.com, replyTo2@example.com"); private static final Address[] LIST_POST_ADDRESSES = Address.parse("listPost@example.com"); diff --git a/k9mail/src/test/java/com/fsck/k9/mailstore/AttachmentResolverTest.java b/k9mail/src/test/java/com/fsck/k9/mailstore/AttachmentResolverTest.java index 3d3d9200eb7..1c413ad83f1 100644 --- a/k9mail/src/test/java/com/fsck/k9/mailstore/AttachmentResolverTest.java +++ b/k9mail/src/test/java/com/fsck/k9/mailstore/AttachmentResolverTest.java @@ -5,7 +5,6 @@ import android.net.Uri; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.BodyPart; import com.fsck.k9.mail.Multipart; import com.fsck.k9.mail.Part; @@ -16,9 +15,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; @@ -26,8 +26,7 @@ @SuppressWarnings("unchecked") -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class AttachmentResolverTest { public static final Uri ATTACHMENT_TEST_URI_1 = Uri.parse("uri://test/1"); public static final Uri ATTACHMENT_TEST_URI_2 = Uri.parse("uri://test/2"); diff --git a/k9mail/src/test/java/com/fsck/k9/mailstore/DeferredFileBodyTest.java b/k9mail/src/test/java/com/fsck/k9/mailstore/DeferredFileBodyTest.java index 77e7393c1b9..171ff77811b 100644 --- a/k9mail/src/test/java/com/fsck/k9/mailstore/DeferredFileBodyTest.java +++ b/k9mail/src/test/java/com/fsck/k9/mailstore/DeferredFileBodyTest.java @@ -7,14 +7,13 @@ import java.io.InputStream; import java.io.OutputStream; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mailstore.util.FileFactory; import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.ByteArrayOutputStream; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -23,8 +22,7 @@ import static org.junit.Assert.assertSame; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class DeferredFileBodyTest { public static final String TEST_ENCODING = "test-encoding"; public static final byte[] TEST_DATA_SHORT = "test data".getBytes(); @@ -143,4 +141,4 @@ private void writeLongTestData() throws IOException { outputStream.write(TEST_DATA_LONG); outputStream.close(); } -} \ No newline at end of file +} diff --git a/k9mail/src/test/java/com/fsck/k9/mailstore/MessageViewInfoExtractorTest.java b/k9mail/src/test/java/com/fsck/k9/mailstore/MessageViewInfoExtractorTest.java index 36cc80fc1f4..31282da0583 100644 --- a/k9mail/src/test/java/com/fsck/k9/mailstore/MessageViewInfoExtractorTest.java +++ b/k9mail/src/test/java/com/fsck/k9/mailstore/MessageViewInfoExtractorTest.java @@ -12,7 +12,6 @@ import android.support.annotation.NonNull; import com.fsck.k9.GlobalsHelper; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.activity.K9ActivityCommon; import com.fsck.k9.mail.Address; import com.fsck.k9.mail.BodyPart; @@ -39,6 +38,7 @@ import org.junit.runner.RunWith; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static com.fsck.k9.message.TestMessageConstructionUtils.bodypart; @@ -56,7 +56,7 @@ @SuppressWarnings("WeakerAccess") -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class MessageViewInfoExtractorTest { public static final String BODY_TEXT = "K-9 Mail rocks :>"; public static final String BODY_TEXT_HTML = "K-9 Mail rocks :>"; diff --git a/k9mail/src/test/java/com/fsck/k9/mailstore/MigrationTest.java b/k9mail/src/test/java/com/fsck/k9/mailstore/MigrationTest.java index 20099ecc31c..b2af0152187 100644 --- a/k9mail/src/test/java/com/fsck/k9/mailstore/MigrationTest.java +++ b/k9mail/src/test/java/com/fsck/k9/mailstore/MigrationTest.java @@ -14,7 +14,6 @@ import com.fsck.k9.Account; import com.fsck.k9.K9; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.Preferences; import com.fsck.k9.mail.BodyPart; import com.fsck.k9.mail.FetchProfile; @@ -29,11 +28,13 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.openintents.openpgp.util.OpenPgpUtils; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.shadows.ShadowLog; import org.robolectric.shadows.ShadowSQLiteConnection; -@RunWith(K9RobolectricTestRunner.class) + +@RunWith(RobolectricTestRunner.class) public class MigrationTest { Account account; diff --git a/k9mail/src/test/java/com/fsck/k9/mailstore/StoreSchemaDefinitionTest.java b/k9mail/src/test/java/com/fsck/k9/mailstore/StoreSchemaDefinitionTest.java index 1fd51967114..c34f8c85a03 100644 --- a/k9mail/src/test/java/com/fsck/k9/mailstore/StoreSchemaDefinitionTest.java +++ b/k9mail/src/test/java/com/fsck/k9/mailstore/StoreSchemaDefinitionTest.java @@ -17,14 +17,13 @@ import com.fsck.k9.BuildConfig; import com.fsck.k9.GlobalsHelper; import com.fsck.k9.K9; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.R; import com.fsck.k9.mail.MessagingException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; import static org.junit.Assert.assertEquals; @@ -37,8 +36,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class StoreSchemaDefinitionTest { private StoreSchemaDefinition storeSchemaDefinition; diff --git a/k9mail/src/test/java/com/fsck/k9/mailstore/migrations/MigrationMimeStructureStateTest.java b/k9mail/src/test/java/com/fsck/k9/mailstore/migrations/MigrationMimeStructureStateTest.java index 3121f4ed022..350e37cdfc6 100644 --- a/k9mail/src/test/java/com/fsck/k9/mailstore/migrations/MigrationMimeStructureStateTest.java +++ b/k9mail/src/test/java/com/fsck/k9/mailstore/migrations/MigrationMimeStructureStateTest.java @@ -3,14 +3,14 @@ import android.content.ContentValues; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; -@RunWith(K9RobolectricTestRunner.class) // required for ContentValues +@RunWith(RobolectricTestRunner.class) // required for ContentValues public class MigrationMimeStructureStateTest { @Test(expected = IllegalStateException.class) diff --git a/k9mail/src/test/java/com/fsck/k9/message/MessageBuilderTest.java b/k9mail/src/test/java/com/fsck/k9/message/MessageBuilderTest.java index 49b5f8390cc..1b3fdfb910f 100644 --- a/k9mail/src/test/java/com/fsck/k9/message/MessageBuilderTest.java +++ b/k9mail/src/test/java/com/fsck/k9/message/MessageBuilderTest.java @@ -15,7 +15,6 @@ import com.fsck.k9.Account.QuoteStyle; import com.fsck.k9.Identity; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.activity.misc.Attachment; import com.fsck.k9.mail.Address; import com.fsck.k9.mail.BodyPart; @@ -33,6 +32,7 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.robolectric.Robolectric; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.junit.Assert.assertArrayEquals; @@ -45,7 +45,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class MessageBuilderTest { public static final String TEST_MESSAGE_TEXT = "soviet message\r\ntext ☭"; public static final String TEST_ATTACHMENT_TEXT = "text data in attachment"; diff --git a/k9mail/src/test/java/com/fsck/k9/message/PgpMessageBuilderTest.java b/k9mail/src/test/java/com/fsck/k9/message/PgpMessageBuilderTest.java index a8aa3467a45..5c58b7a9745 100644 --- a/k9mail/src/test/java/com/fsck/k9/message/PgpMessageBuilderTest.java +++ b/k9mail/src/test/java/com/fsck/k9/message/PgpMessageBuilderTest.java @@ -17,7 +17,6 @@ import com.fsck.k9.Account.QuoteStyle; import com.fsck.k9.Identity; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.activity.compose.ComposeCryptoStatus; import com.fsck.k9.activity.compose.ComposeCryptoStatus.ComposeCryptoStatusBuilder; import com.fsck.k9.activity.compose.RecipientPresenter.CryptoMode; @@ -49,6 +48,7 @@ import org.openintents.openpgp.OpenPgpError; import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpApi.OpenPgpDataSource; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static com.fsck.k9.autocrypt.AutocryptOperationsHelper.assertMessageHasAutocryptHeader; @@ -65,7 +65,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class PgpMessageBuilderTest { private static final long TEST_KEY_ID = 123L; private static final String TEST_MESSAGE_TEXT = "message text with a ☭ CCCP symbol"; diff --git a/k9mail/src/test/java/com/fsck/k9/message/extractors/AttachmentInfoExtractorTest.java b/k9mail/src/test/java/com/fsck/k9/message/extractors/AttachmentInfoExtractorTest.java index 0778c3a6c43..1ab2bd3aadf 100644 --- a/k9mail/src/test/java/com/fsck/k9/message/extractors/AttachmentInfoExtractorTest.java +++ b/k9mail/src/test/java/com/fsck/k9/message/extractors/AttachmentInfoExtractorTest.java @@ -5,20 +5,19 @@ import android.net.Uri; import android.support.annotation.Nullable; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.Part; import com.fsck.k9.mail.internet.MimeBodyPart; import com.fsck.k9.mail.internet.MimeHeader; import com.fsck.k9.mail.internet.TextBody; import com.fsck.k9.mailstore.AttachmentViewInfo; -import com.fsck.k9.mailstore.LocalBodyPart; import com.fsck.k9.mailstore.DeferredFileBody; +import com.fsck.k9.mailstore.LocalBodyPart; import com.fsck.k9.provider.AttachmentProvider; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -27,8 +26,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class AttachmentInfoExtractorTest { public static final Uri TEST_URI = Uri.parse("uri://test"); public static final String TEST_MIME_TYPE = "text/plain"; diff --git a/k9mail/src/test/java/com/fsck/k9/message/extractors/EncryptionDetectorTest.java b/k9mail/src/test/java/com/fsck/k9/message/extractors/EncryptionDetectorTest.java index 15119b46edf..6ce6a84d5a9 100644 --- a/k9mail/src/test/java/com/fsck/k9/message/extractors/EncryptionDetectorTest.java +++ b/k9mail/src/test/java/com/fsck/k9/message/extractors/EncryptionDetectorTest.java @@ -1,11 +1,11 @@ package com.fsck.k9.message.extractors; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.Message; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import static com.fsck.k9.message.MessageCreationHelper.createMessage; import static com.fsck.k9.message.MessageCreationHelper.createMultipartMessage; @@ -16,7 +16,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) + +@RunWith(RobolectricTestRunner.class) public class EncryptionDetectorTest { private static final String CRLF = "\r\n"; diff --git a/k9mail/src/test/java/com/fsck/k9/message/extractors/PreviewTextExtractorTest.java b/k9mail/src/test/java/com/fsck/k9/message/extractors/PreviewTextExtractorTest.java index 6c71bcdea06..fdd5f498130 100644 --- a/k9mail/src/test/java/com/fsck/k9/message/extractors/PreviewTextExtractorTest.java +++ b/k9mail/src/test/java/com/fsck/k9/message/extractors/PreviewTextExtractorTest.java @@ -1,20 +1,18 @@ package com.fsck.k9.message.extractors; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.Part; import com.fsck.k9.mail.internet.MimeBodyPart; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static com.fsck.k9.message.MessageCreationHelper.createTextPart; import static org.junit.Assert.assertEquals; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class PreviewTextExtractorTest { private PreviewTextExtractor previewTextExtractor; diff --git a/k9mail/src/test/java/com/fsck/k9/message/html/HtmlConverterTest.java b/k9mail/src/test/java/com/fsck/k9/message/html/HtmlConverterTest.java index bddb8ce2625..55829338056 100644 --- a/k9mail/src/test/java/com/fsck/k9/message/html/HtmlConverterTest.java +++ b/k9mail/src/test/java/com/fsck/k9/message/html/HtmlConverterTest.java @@ -8,7 +8,6 @@ import com.fsck.k9.K9; import com.fsck.k9.K9.Theme; -import com.fsck.k9.K9RobolectricTestRunner; import org.apache.commons.io.IOUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; @@ -16,13 +15,12 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static junit.framework.Assert.assertEquals; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class HtmlConverterTest { // Useful if you want to write stuff to a file for debugging in a browser. private static final boolean WRITE_TO_FILE = Boolean.parseBoolean(System.getProperty("k9.htmlConverterTest.writeToFile", "false")); diff --git a/k9mail/src/test/java/com/fsck/k9/message/signature/HtmlSignatureRemoverTest.java b/k9mail/src/test/java/com/fsck/k9/message/signature/HtmlSignatureRemoverTest.java index 89d42f099c3..dcbedb1afd5 100644 --- a/k9mail/src/test/java/com/fsck/k9/message/signature/HtmlSignatureRemoverTest.java +++ b/k9mail/src/test/java/com/fsck/k9/message/signature/HtmlSignatureRemoverTest.java @@ -1,18 +1,15 @@ package com.fsck.k9.message.signature; -import com.fsck.k9.K9RobolectricTestRunner; - import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static com.fsck.k9.message.html.HtmlHelper.extractText; import static org.junit.Assert.assertEquals; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class HtmlSignatureRemoverTest { @Test public void shouldStripSignatureFromK9StyleHtml() throws Exception { diff --git a/k9mail/src/test/java/com/fsck/k9/notification/AuthenticationErrorNotificationsTest.java b/k9mail/src/test/java/com/fsck/k9/notification/AuthenticationErrorNotificationsTest.java index 711bd0ba535..973aae4c686 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/AuthenticationErrorNotificationsTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/AuthenticationErrorNotificationsTest.java @@ -9,12 +9,12 @@ import android.support.v4.app.NotificationManagerCompat; import com.fsck.k9.Account; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.MockHelper; import com.fsck.k9.R; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.mockito.Matchers.any; @@ -24,7 +24,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class AuthenticationErrorNotificationsTest { private static final boolean INCOMING = true; private static final boolean OUTGOING = false; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/BaseNotificationsTest.java b/k9mail/src/test/java/com/fsck/k9/notification/BaseNotificationsTest.java index a5bb022475b..3ecdb33f7c2 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/BaseNotificationsTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/BaseNotificationsTest.java @@ -7,13 +7,12 @@ import com.fsck.k9.Account; import com.fsck.k9.K9; import com.fsck.k9.K9.NotificationQuickDelete; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.MockHelper; import com.fsck.k9.R; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -23,8 +22,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class BaseNotificationsTest { private static final int ACCOUNT_COLOR = 0xAABBCC; private static final String ACCOUNT_NAME = "AccountName"; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/CertificateErrorNotificationsTest.java b/k9mail/src/test/java/com/fsck/k9/notification/CertificateErrorNotificationsTest.java index 47ea603138f..fc6675c5e75 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/CertificateErrorNotificationsTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/CertificateErrorNotificationsTest.java @@ -9,12 +9,12 @@ import android.support.v4.app.NotificationManagerCompat; import com.fsck.k9.Account; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.MockHelper; import com.fsck.k9.R; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.mockito.Matchers.any; @@ -24,7 +24,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class CertificateErrorNotificationsTest { private static final boolean INCOMING = true; private static final boolean OUTGOING = false; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/DeviceNotificationsTest.java b/k9mail/src/test/java/com/fsck/k9/notification/DeviceNotificationsTest.java index 575809fea03..6d9e7a8fb8f 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/DeviceNotificationsTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/DeviceNotificationsTest.java @@ -15,7 +15,6 @@ import com.fsck.k9.K9; import com.fsck.k9.K9.NotificationHideSubject; import com.fsck.k9.K9.NotificationQuickDelete; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.NotificationSetting; import com.fsck.k9.R; import org.junit.Before; @@ -23,6 +22,7 @@ import org.junit.runner.RunWith; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static com.fsck.k9.MockHelper.mockBuilder; @@ -34,7 +34,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class DeviceNotificationsTest { private static final int UNREAD_MESSAGE_COUNT = 42; private static final int NEW_MESSAGE_COUNT = 2; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/LockScreenNotificationTest.java b/k9mail/src/test/java/com/fsck/k9/notification/LockScreenNotificationTest.java index 1355ae0e47f..2dc88dfc36a 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/LockScreenNotificationTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/LockScreenNotificationTest.java @@ -11,12 +11,12 @@ import com.fsck.k9.Account; import com.fsck.k9.K9; import com.fsck.k9.K9.LockScreenNotificationVisibility; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.MockHelper; import com.fsck.k9.R; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.junit.Assert.assertEquals; @@ -27,7 +27,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class LockScreenNotificationTest { private static final String ACCOUNT_NAME = "Hugo"; private static final int NEW_MESSAGE_COUNT = 3; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/NewMailNotificationsTest.java b/k9mail/src/test/java/com/fsck/k9/notification/NewMailNotificationsTest.java index 5250dd23c70..14a59631aba 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/NewMailNotificationsTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/NewMailNotificationsTest.java @@ -7,12 +7,12 @@ import com.fsck.k9.Account; import com.fsck.k9.K9; import com.fsck.k9.K9.NotificationHideSubject; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.activity.MessageReference; import com.fsck.k9.mailstore.LocalMessage; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyBoolean; @@ -25,7 +25,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class NewMailNotificationsTest { private static final int ACCOUNT_NUMBER = 23; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/NotificationContentCreatorTest.java b/k9mail/src/test/java/com/fsck/k9/notification/NotificationContentCreatorTest.java index 6c80179ee75..707cca48965 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/NotificationContentCreatorTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/NotificationContentCreatorTest.java @@ -4,7 +4,6 @@ import android.content.Context; import com.fsck.k9.Account; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.activity.MessageReference; import com.fsck.k9.mail.Address; import com.fsck.k9.mail.Flag; @@ -14,6 +13,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.junit.Assert.assertEquals; @@ -22,7 +22,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class NotificationContentCreatorTest { private static final String ACCOUNT_UUID = "1-2-3"; private static final String FOLDER_NAME = "INBOX"; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/NotificationDataTest.java b/k9mail/src/test/java/com/fsck/k9/notification/NotificationDataTest.java index fc16d3d198a..fddaaedf9c9 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/NotificationDataTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/NotificationDataTest.java @@ -4,13 +4,11 @@ import java.util.List; import com.fsck.k9.Account; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.activity.MessageReference; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -20,8 +18,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class NotificationDataTest { private static final String ACCOUNT_UUID = "1-2-3"; private static final int ACCOUNT_NUMBER = 23; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/NotificationIdsTest.java b/k9mail/src/test/java/com/fsck/k9/notification/NotificationIdsTest.java index 98a449261b9..a4cff0ad423 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/NotificationIdsTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/NotificationIdsTest.java @@ -2,18 +2,16 @@ import com.fsck.k9.Account; -import com.fsck.k9.K9RobolectricTestRunner; - import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) + +@RunWith(RobolectricTestRunner.class) public class NotificationIdsTest { private static final boolean INCOMING = true; private static final boolean OUTGOING = false; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/SendFailedNotificationsTest.java b/k9mail/src/test/java/com/fsck/k9/notification/SendFailedNotificationsTest.java index 897ed4f7695..d5082fbe0c3 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/SendFailedNotificationsTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/SendFailedNotificationsTest.java @@ -8,12 +8,12 @@ import android.support.v4.app.NotificationManagerCompat; import com.fsck.k9.Account; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.MockHelper; import com.fsck.k9.R; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.mockito.Matchers.any; @@ -24,7 +24,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class SendFailedNotificationsTest { private static final int ACCOUNT_NUMBER = 1; private static final String ACCOUNT_NAME = "TestAccount"; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/SyncNotificationsTest.java b/k9mail/src/test/java/com/fsck/k9/notification/SyncNotificationsTest.java index fccf39119c1..b2162b842d3 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/SyncNotificationsTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/SyncNotificationsTest.java @@ -8,13 +8,13 @@ import android.support.v4.app.NotificationManagerCompat; import com.fsck.k9.Account; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.MockHelper; import com.fsck.k9.R; import com.fsck.k9.mail.Folder; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.mockito.Matchers.any; @@ -26,7 +26,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class SyncNotificationsTest { private static final int ACCOUNT_NUMBER = 1; private static final String ACCOUNT_NAME = "TestAccount"; diff --git a/k9mail/src/test/java/com/fsck/k9/notification/WearNotificationsTest.java b/k9mail/src/test/java/com/fsck/k9/notification/WearNotificationsTest.java index 129d4560cc2..ccfaf72cab2 100644 --- a/k9mail/src/test/java/com/fsck/k9/notification/WearNotificationsTest.java +++ b/k9mail/src/test/java/com/fsck/k9/notification/WearNotificationsTest.java @@ -14,7 +14,6 @@ import com.fsck.k9.Account; import com.fsck.k9.K9; import com.fsck.k9.K9.NotificationQuickDelete; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.MockHelper; import com.fsck.k9.R; import com.fsck.k9.activity.MessageReference; @@ -23,6 +22,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentMatcher; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.junit.Assert.assertEquals; @@ -34,7 +34,7 @@ import static org.mockito.Mockito.when; -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class WearNotificationsTest { private static final int ACCOUNT_NUMBER = 42; private static final String ACCOUNT_NAME = "accountName"; diff --git a/k9mail/src/test/java/com/fsck/k9/preferences/SettingsExporterTest.java b/k9mail/src/test/java/com/fsck/k9/preferences/SettingsExporterTest.java index 106a6d11ef4..c67bbb0f1bc 100644 --- a/k9mail/src/test/java/com/fsck/k9/preferences/SettingsExporterTest.java +++ b/k9mail/src/test/java/com/fsck/k9/preferences/SettingsExporterTest.java @@ -1,12 +1,5 @@ package com.fsck.k9.preferences; -import com.fsck.k9.K9RobolectricTestRunner; - -import org.jdom2.Document; -import org.jdom2.input.SAXBuilder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RuntimeEnvironment; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -14,11 +7,19 @@ import java.util.Collections; import java.util.Set; +import org.jdom2.Document; +import org.jdom2.input.SAXBuilder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -@RunWith(K9RobolectricTestRunner.class) + +@RunWith(RobolectricTestRunner.class) public class SettingsExporterTest { @Test diff --git a/k9mail/src/test/java/com/fsck/k9/preferences/SettingsImporterTest.java b/k9mail/src/test/java/com/fsck/k9/preferences/SettingsImporterTest.java index 161d0b613ae..852643be449 100644 --- a/k9mail/src/test/java/com/fsck/k9/preferences/SettingsImporterTest.java +++ b/k9mail/src/test/java/com/fsck/k9/preferences/SettingsImporterTest.java @@ -7,13 +7,13 @@ import java.util.UUID; import com.fsck.k9.Account; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.Preferences; import com.fsck.k9.mail.AuthType; import org.apache.tools.ant.filters.StringInputStream; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.junit.Assert.assertEquals; @@ -21,7 +21,7 @@ @SuppressWarnings("unchecked") -@RunWith(K9RobolectricTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class SettingsImporterTest { @Before diff --git a/k9mail/src/test/java/com/fsck/k9/setup/ServerNameSuggesterTest.java b/k9mail/src/test/java/com/fsck/k9/setup/ServerNameSuggesterTest.java index 7e279d51940..cf03e9a2757 100644 --- a/k9mail/src/test/java/com/fsck/k9/setup/ServerNameSuggesterTest.java +++ b/k9mail/src/test/java/com/fsck/k9/setup/ServerNameSuggesterTest.java @@ -1,18 +1,16 @@ package com.fsck.k9.setup; -import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.mail.ServerSettings.Type; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.annotation.Config; +import org.robolectric.RobolectricTestRunner; import static org.junit.Assert.assertEquals; -@RunWith(K9RobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@RunWith(RobolectricTestRunner.class) public class ServerNameSuggesterTest { private ServerNameSuggester serverNameSuggester; diff --git a/k9mail/src/test/java/com/fsck/k9/view/MessageHeaderTest.kt b/k9mail/src/test/java/com/fsck/k9/view/MessageHeaderTest.kt index c4d22962f94..886d60bd658 100644 --- a/k9mail/src/test/java/com/fsck/k9/view/MessageHeaderTest.kt +++ b/k9mail/src/test/java/com/fsck/k9/view/MessageHeaderTest.kt @@ -1,13 +1,13 @@ package com.fsck.k9.view -import com.fsck.k9.K9RobolectricTestRunner import com.fsck.k9.mail.Address import com.fsck.k9.mail.internet.MimeMessage import com.google.common.truth.Truth.assertThat import org.junit.Test import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner -@RunWith(K9RobolectricTestRunner::class) +@RunWith(RobolectricTestRunner::class) class MessageHeaderTest { @Test