Move some tests from 'androidTest' to 'test' folder

This commit is contained in:
cketti 2015-05-20 20:57:21 +02:00
parent 0f66cacf10
commit 4b273c1749
4 changed files with 19 additions and 13 deletions

View File

@ -1,12 +1,12 @@
package com.fsck.k9.activity; package com.fsck.k9.activity;
import android.support.test.runner.AndroidJUnit4;
import com.fsck.k9.mail.Flag; import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.MessagingException;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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.assertEquals;
import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertFalse;
@ -14,7 +14,8 @@ import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue; import static junit.framework.Assert.assertTrue;
@RunWith(AndroidJUnit4.class) @RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class MessageReferenceTest { public class MessageReferenceTest {
@Test @Test

View File

@ -3,8 +3,6 @@ package com.fsck.k9.crypto;
import java.util.List; import java.util.List;
import android.support.test.runner.AndroidJUnit4;
import com.fsck.k9.mail.Part; import com.fsck.k9.mail.Part;
import com.fsck.k9.mail.internet.MimeBodyPart; import com.fsck.k9.mail.internet.MimeBodyPart;
import com.fsck.k9.mail.internet.MimeMessage; 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 com.fsck.k9.mail.internet.TextBody;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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.assertEquals;
import static junit.framework.Assert.assertSame; import static junit.framework.Assert.assertSame;
@RunWith(AndroidJUnit4.class) @RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class MessageDecryptVerifierTest { public class MessageDecryptVerifierTest {
@Test @Test

View File

@ -1,18 +1,20 @@
package com.fsck.k9.helper; package com.fsck.k9.helper;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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.assertEquals;
@RunWith(AndroidJUnit4.class) @RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class HtmlConverterTest { public class HtmlConverterTest {
// Useful if you want to write stuff to a file for debugging in a browser. // 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")); private static final boolean WRITE_TO_FILE = Boolean.parseBoolean(System.getProperty("k9.htmlConverterTest.writeToFile", "false"));

View File

@ -3,27 +3,29 @@ package com.fsck.k9.helper;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.text.SpannableString; import android.text.SpannableString;
import com.fsck.k9.mail.Address; import com.fsck.k9.mail.Address;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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.assertEquals;
import static junit.framework.Assert.assertTrue; import static junit.framework.Assert.assertTrue;
@RunWith(AndroidJUnit4.class) @RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class MessageHelperTest { public class MessageHelperTest {
private Contacts contacts; private Contacts contacts;
private Contacts mockContacts; private Contacts mockContacts;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
Context context = InstrumentationRegistry.getTargetContext(); Context context = RuntimeEnvironment.application;
contacts = new Contacts(context); contacts = new Contacts(context);
mockContacts = new Contacts(context) { mockContacts = new Contacts(context) {
@Override public String getNameForAddress(String address) { @Override public String getNameForAddress(String address) {