diff --git a/k9mail/src/androidTest/java/com/fsck/k9/activity/MessageReferenceTest.java b/k9mail/src/test/java/com/fsck/k9/activity/MessageReferenceTest.java similarity index 97% rename from k9mail/src/androidTest/java/com/fsck/k9/activity/MessageReferenceTest.java rename to k9mail/src/test/java/com/fsck/k9/activity/MessageReferenceTest.java index 3ad1ba75b..85acf6b27 100644 --- a/k9mail/src/androidTest/java/com/fsck/k9/activity/MessageReferenceTest.java +++ b/k9mail/src/test/java/com/fsck/k9/activity/MessageReferenceTest.java @@ -1,12 +1,12 @@ package com.fsck.k9.activity; -import android.support.test.runner.AndroidJUnit4; - import com.fsck.k9.mail.Flag; import com.fsck.k9.mail.MessagingException; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; @@ -14,7 +14,8 @@ import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; -@RunWith(AndroidJUnit4.class) +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) public class MessageReferenceTest { @Test diff --git a/k9mail/src/androidTest/java/com/fsck/k9/crypto/MessageDecryptVerifierTest.java b/k9mail/src/test/java/com/fsck/k9/crypto/MessageDecryptVerifierTest.java similarity index 94% rename from k9mail/src/androidTest/java/com/fsck/k9/crypto/MessageDecryptVerifierTest.java rename to k9mail/src/test/java/com/fsck/k9/crypto/MessageDecryptVerifierTest.java index e06bd7971..3764cd6d5 100644 --- a/k9mail/src/androidTest/java/com/fsck/k9/crypto/MessageDecryptVerifierTest.java +++ b/k9mail/src/test/java/com/fsck/k9/crypto/MessageDecryptVerifierTest.java @@ -3,8 +3,6 @@ package com.fsck.k9.crypto; import java.util.List; -import android.support.test.runner.AndroidJUnit4; - import com.fsck.k9.mail.Part; import com.fsck.k9.mail.internet.MimeBodyPart; import com.fsck.k9.mail.internet.MimeMessage; @@ -13,12 +11,15 @@ import com.fsck.k9.mail.internet.MimeMultipart; import com.fsck.k9.mail.internet.TextBody; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertSame; -@RunWith(AndroidJUnit4.class) +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) public class MessageDecryptVerifierTest { @Test diff --git a/k9mail/src/androidTest/java/com/fsck/k9/helper/HtmlConverterTest.java b/k9mail/src/test/java/com/fsck/k9/helper/HtmlConverterTest.java similarity index 98% rename from k9mail/src/androidTest/java/com/fsck/k9/helper/HtmlConverterTest.java rename to k9mail/src/test/java/com/fsck/k9/helper/HtmlConverterTest.java index c09244164..9292991b5 100644 --- a/k9mail/src/androidTest/java/com/fsck/k9/helper/HtmlConverterTest.java +++ b/k9mail/src/test/java/com/fsck/k9/helper/HtmlConverterTest.java @@ -1,18 +1,20 @@ package com.fsck.k9.helper; + import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; -import android.support.test.runner.AndroidJUnit4; - import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; import static junit.framework.Assert.assertEquals; -@RunWith(AndroidJUnit4.class) +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) 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/androidTest/java/com/fsck/k9/helper/MessageHelperTest.java b/k9mail/src/test/java/com/fsck/k9/helper/MessageHelperTest.java similarity index 91% rename from k9mail/src/androidTest/java/com/fsck/k9/helper/MessageHelperTest.java rename to k9mail/src/test/java/com/fsck/k9/helper/MessageHelperTest.java index 485f11520..a2292a61c 100644 --- a/k9mail/src/androidTest/java/com/fsck/k9/helper/MessageHelperTest.java +++ b/k9mail/src/test/java/com/fsck/k9/helper/MessageHelperTest.java @@ -3,27 +3,29 @@ package com.fsck.k9.helper; import android.content.Context; import android.graphics.Color; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; import android.text.SpannableString; 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(AndroidJUnit4.class) +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) public class MessageHelperTest { private Contacts contacts; private Contacts mockContacts; @Before public void setUp() throws Exception { - Context context = InstrumentationRegistry.getTargetContext(); + Context context = RuntimeEnvironment.application; contacts = new Contacts(context); mockContacts = new Contacts(context) { @Override public String getNameForAddress(String address) {