Browse Source

Move JVM tests into main k9mail module

Use Robolectric for the tests that use framework classes.
art/static-analysis-fixes
cketti 8 years ago
parent
commit
0f66cacf10
  1. 8
      k9mail/build.gradle
  2. 0
      k9mail/src/test/java/com/fsck/k9/helper/HtmlSanitizerTest.java
  3. 5
      k9mail/src/test/java/com/fsck/k9/mail/AddressTest.java
  4. 5
      k9mail/src/test/java/com/fsck/k9/mail/Address_quoteAtoms.java
  5. 0
      k9mail/src/test/java/com/fsck/k9/mail/filter/EOLConvertingOutputStreamTest.java
  6. 5
      k9mail/src/test/java/com/fsck/k9/mail/internet/CharsetSupportTest.java
  7. 5
      k9mail/src/test/java/com/fsck/k9/mail/internet/DecoderUtilTest.java
  8. 5
      k9mail/src/test/java/com/fsck/k9/mail/internet/MimeMessageParseTest.java
  9. 0
      k9mail/src/test/java/com/fsck/k9/mail/internet/MimeUtilityTest.java
  10. 0
      k9mail/src/test/java/com/fsck/k9/mail/store/imap/ImapListTest.java
  11. 5
      k9mail/src/test/java/com/fsck/k9/mail/store/imap/ImapResponseParserTest.java
  12. 0
      k9mail/src/test/java/com/fsck/k9/mail/store/imap/ImapStoreUriTest.java
  13. 5
      k9mail/src/test/java/com/fsck/k9/mail/store/imap/ImapUtilityTest.java
  14. 3
      k9mail/src/test/java/com/fsck/k9/message/TextBodyBuilderTest.java
  15. 1
      settings.gradle

8
k9mail/build.gradle

@ -25,6 +25,14 @@ dependencies { @@ -25,6 +25,14 @@ dependencies {
exclude group: 'junit'
}
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 {

0
tests-on-jvm/src/test/java/com/fsck/k9/helper/HtmlSanitizerTest.java → k9mail/src/test/java/com/fsck/k9/helper/HtmlSanitizerTest.java

5
tests-on-jvm/src/test/java/com/fsck/k9/mail/AddressTest.java → k9mail/src/test/java/com/fsck/k9/mail/AddressTest.java

@ -2,10 +2,15 @@ package com.fsck.k9.mail; @@ -2,10 +2,15 @@ package com.fsck.k9.mail;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import static org.junit.Assert.assertEquals;
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class AddressTest {
/**
* test the possibility to parse "From:" fields with no email.

5
tests-on-jvm/src/test/java/com/fsck/k9/mail/Address_quoteAtoms.java → k9mail/src/test/java/com/fsck/k9/mail/Address_quoteAtoms.java

@ -2,10 +2,15 @@ package com.fsck.k9.mail; @@ -2,10 +2,15 @@ package com.fsck.k9.mail;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import static org.junit.Assert.assertEquals;
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class Address_quoteAtoms {
@Test
public void testNoQuote() {

0
tests-on-jvm/src/test/java/com/fsck/k9/mail/filter/EOLConvertingOutputStreamTest.java → k9mail/src/test/java/com/fsck/k9/mail/filter/EOLConvertingOutputStreamTest.java

5
tests-on-jvm/src/test/java/com/fsck/k9/mail/internet/CharsetSupportTest.java → k9mail/src/test/java/com/fsck/k9/mail/internet/CharsetSupportTest.java

@ -2,10 +2,15 @@ package com.fsck.k9.mail.internet; @@ -2,10 +2,15 @@ package com.fsck.k9.mail.internet;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import static org.junit.Assert.assertEquals;
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class CharsetSupportTest {
@Test

5
tests-on-jvm/src/test/java/com/fsck/k9/mail/internet/DecoderUtilTest.java → k9mail/src/test/java/com/fsck/k9/mail/internet/DecoderUtilTest.java

@ -2,10 +2,15 @@ package com.fsck.k9.mail.internet; @@ -2,10 +2,15 @@ package com.fsck.k9.mail.internet;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import static org.junit.Assert.assertEquals;
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class DecoderUtilTest {
@Test

5
tests-on-jvm/src/test/java/com/fsck/k9/mail/internet/MimeMessageParseTest.java → k9mail/src/test/java/com/fsck/k9/mail/internet/MimeMessageParseTest.java

@ -18,10 +18,15 @@ import com.fsck.k9.mail.Body; @@ -18,10 +18,15 @@ import com.fsck.k9.mail.Body;
import com.fsck.k9.mail.BodyPart;
import com.fsck.k9.mail.Message.RecipientType;
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;
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class MimeMessageParseTest {
@Before
public void setup() {

0
tests-on-jvm/src/test/java/com/fsck/k9/mail/internet/MimeUtilityTest.java → k9mail/src/test/java/com/fsck/k9/mail/internet/MimeUtilityTest.java

0
tests-on-jvm/src/test/java/com/fsck/k9/mail/store/imap/ImapListTest.java → k9mail/src/test/java/com/fsck/k9/mail/store/imap/ImapListTest.java

5
tests-on-jvm/src/test/java/com/fsck/k9/mail/store/imap/ImapResponseParserTest.java → k9mail/src/test/java/com/fsck/k9/mail/store/imap/ImapResponseParserTest.java

@ -3,6 +3,9 @@ package com.fsck.k9.mail.store.imap; @@ -3,6 +3,9 @@ package com.fsck.k9.mail.store.imap;
import com.fsck.k9.mail.filter.PeekableInputStream;
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.IOException;
@ -16,6 +19,8 @@ import static org.junit.Assert.assertEquals; @@ -16,6 +19,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class ImapResponseParserTest {
@Test public void testSimpleOkResponse() throws IOException {

0
tests-on-jvm/src/test/java/com/fsck/k9/mail/store/imap/ImapStoreUriTest.java → k9mail/src/test/java/com/fsck/k9/mail/store/imap/ImapStoreUriTest.java

5
tests-on-jvm/src/test/java/com/fsck/k9/mail/store/imap/ImapUtilityTest.java → k9mail/src/test/java/com/fsck/k9/mail/store/imap/ImapUtilityTest.java

@ -18,12 +18,17 @@ @@ -18,12 +18,17 @@
package com.fsck.k9.mail.store.imap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import java.util.List;
import static org.junit.Assert.assertArrayEquals;
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class ImapUtilityTest {
@Test
public void testGetImapSequenceValues() {

3
tests-on-jvm/src/test/java/com/fsck/k9/message/TextBodyBuilderTest.java → k9mail/src/test/java/com/fsck/k9/message/TextBodyBuilderTest.java

@ -3,6 +3,7 @@ package com.fsck.k9.message; @@ -3,6 +3,7 @@ package com.fsck.k9.message;
import com.fsck.k9.Account.QuoteStyle;
import com.fsck.k9.mail.internet.TextBody;
import org.junit.Ignore;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
@ -12,6 +13,8 @@ import static org.hamcrest.CoreMatchers.instanceOf; @@ -12,6 +13,8 @@ import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
//TODO: Get rid of 'Theories' and write simple tests
@Ignore
@RunWith(Theories.class)
public class TextBodyBuilderTest {

1
settings.gradle

@ -3,4 +3,3 @@ include ':k9mail-library' @@ -3,4 +3,3 @@ include ':k9mail-library'
include ':plugins:Android-PullToRefresh:library'
include ':plugins:HoloColorPicker'
include ':plugins:openpgp-api-library'
include ':tests-on-jvm'

Loading…
Cancel
Save