mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 09:52:16 -05:00
Move JVM tests into main k9mail module
Use Robolectric for the tests that use framework classes.
This commit is contained in:
parent
b45065a5b2
commit
0f66cacf10
@ -25,6 +25,14 @@ dependencies {
|
|||||||
exclude group: 'junit'
|
exclude group: 'junit'
|
||||||
}
|
}
|
||||||
androidTestCompile 'com.madgag.spongycastle:pg:1.51.0.0'
|
androidTestCompile 'com.madgag.spongycastle:pg:1.51.0.0'
|
||||||
|
|
||||||
|
testCompile('org.robolectric:robolectric:3.0-rc3') {
|
||||||
|
exclude group: 'org.hamcrest', module: 'hamcrest-core'
|
||||||
|
}
|
||||||
|
testCompile 'org.hamcrest:hamcrest-core:1.3'
|
||||||
|
testCompile('junit:junit:4.10') {
|
||||||
|
exclude group: 'org.hamcrest', module: 'hamcrest-core'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
@ -2,10 +2,15 @@ package com.fsck.k9.mail;
|
|||||||
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
@Config(manifest = Config.NONE)
|
||||||
public class AddressTest {
|
public class AddressTest {
|
||||||
/**
|
/**
|
||||||
* test the possibility to parse "From:" fields with no email.
|
* test the possibility to parse "From:" fields with no email.
|
@ -2,10 +2,15 @@ package com.fsck.k9.mail;
|
|||||||
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
@Config(manifest = Config.NONE)
|
||||||
public class Address_quoteAtoms {
|
public class Address_quoteAtoms {
|
||||||
@Test
|
@Test
|
||||||
public void testNoQuote() {
|
public void testNoQuote() {
|
@ -2,10 +2,15 @@ package com.fsck.k9.mail.internet;
|
|||||||
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
@Config(manifest = Config.NONE)
|
||||||
public class CharsetSupportTest {
|
public class CharsetSupportTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
@ -2,10 +2,15 @@ package com.fsck.k9.mail.internet;
|
|||||||
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
@Config(manifest = Config.NONE)
|
||||||
public class DecoderUtilTest {
|
public class DecoderUtilTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
@ -18,10 +18,15 @@ import com.fsck.k9.mail.Body;
|
|||||||
import com.fsck.k9.mail.BodyPart;
|
import com.fsck.k9.mail.BodyPart;
|
||||||
import com.fsck.k9.mail.Message.RecipientType;
|
import com.fsck.k9.mail.Message.RecipientType;
|
||||||
import com.fsck.k9.mail.Multipart;
|
import com.fsck.k9.mail.Multipart;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
@Config(manifest = Config.NONE)
|
||||||
public class MimeMessageParseTest {
|
public class MimeMessageParseTest {
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
@ -3,6 +3,9 @@ package com.fsck.k9.mail.store.imap;
|
|||||||
import com.fsck.k9.mail.filter.PeekableInputStream;
|
import com.fsck.k9.mail.filter.PeekableInputStream;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -16,6 +19,8 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
@Config(manifest = Config.NONE)
|
||||||
public class ImapResponseParserTest {
|
public class ImapResponseParserTest {
|
||||||
|
|
||||||
@Test public void testSimpleOkResponse() throws IOException {
|
@Test public void testSimpleOkResponse() throws IOException {
|
@ -18,12 +18,17 @@
|
|||||||
package com.fsck.k9.mail.store.imap;
|
package com.fsck.k9.mail.store.imap;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
|
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
@Config(manifest = Config.NONE)
|
||||||
public class ImapUtilityTest {
|
public class ImapUtilityTest {
|
||||||
@Test
|
@Test
|
||||||
public void testGetImapSequenceValues() {
|
public void testGetImapSequenceValues() {
|
@ -3,6 +3,7 @@ package com.fsck.k9.message;
|
|||||||
import com.fsck.k9.Account.QuoteStyle;
|
import com.fsck.k9.Account.QuoteStyle;
|
||||||
import com.fsck.k9.mail.internet.TextBody;
|
import com.fsck.k9.mail.internet.TextBody;
|
||||||
|
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.experimental.theories.DataPoints;
|
import org.junit.experimental.theories.DataPoints;
|
||||||
import org.junit.experimental.theories.Theories;
|
import org.junit.experimental.theories.Theories;
|
||||||
import org.junit.experimental.theories.Theory;
|
import org.junit.experimental.theories.Theory;
|
||||||
@ -12,6 +13,8 @@ import static org.hamcrest.CoreMatchers.instanceOf;
|
|||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
|
//TODO: Get rid of 'Theories' and write simple tests
|
||||||
|
@Ignore
|
||||||
@RunWith(Theories.class)
|
@RunWith(Theories.class)
|
||||||
public class TextBodyBuilderTest {
|
public class TextBodyBuilderTest {
|
||||||
|
|
@ -3,4 +3,3 @@ include ':k9mail-library'
|
|||||||
include ':plugins:Android-PullToRefresh:library'
|
include ':plugins:Android-PullToRefresh:library'
|
||||||
include ':plugins:HoloColorPicker'
|
include ':plugins:HoloColorPicker'
|
||||||
include ':plugins:openpgp-api-library'
|
include ':plugins:openpgp-api-library'
|
||||||
include ':tests-on-jvm'
|
|
||||||
|
Loading…
Reference in New Issue
Block a user