Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update robolectric, use Runner class instead of annotations #2193

Merged
merged 2 commits into from Feb 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -2,7 +2,7 @@ androidCompileSdkVersion=24
androidBuildToolsVersion=24.0.3
androidSupportLibraryVersion=23.1.1

robolectricVersion=3.1.1
robolectricVersion=3.2.2
junitVersion=4.12
mockitoVersion=1.10.19
okioVersion=1.11.0
Expand Up @@ -3,7 +3,6 @@

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import static org.junit.Assert.assertEquals;
Expand All @@ -12,8 +11,7 @@
import static org.junit.Assert.assertTrue;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class AddressTest {
/**
* test the possibility to parse "From:" fields with no email.
Expand Down
Expand Up @@ -3,14 +3,11 @@

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, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class Address_quoteAtoms {
@Test
public void testNoQuote() {
Expand Down
@@ -0,0 +1,20 @@
package com.fsck.k9.mail;

import org.junit.runners.model.InitializationError;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

public class K9LibRobolectricTestRunner extends RobolectricTestRunner {

public K9LibRobolectricTestRunner(Class<?> testClass) throws InitializationError {
super(testClass);
}

@Override
protected Config buildGlobalConfig() {
return new Config.Builder()
.setSdk(22)
.setManifest(Config.NONE)
.build();
}
}
Expand Up @@ -26,16 +26,14 @@
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.assertNotNull;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class MessageTest {

private Context context;
Expand Down
@@ -1,16 +1,15 @@
package com.fsck.k9.mail.internet;


import com.fsck.k9.mail.K9LibRobolectricTestRunner;

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, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class CharsetSupportTest {

@Test
Expand Down
@@ -1,16 +1,15 @@
package com.fsck.k9.mail.internet;


import com.fsck.k9.mail.K9LibRobolectricTestRunner;

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, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class DecoderUtilTest {

@Test
Expand Down
Expand Up @@ -2,19 +2,17 @@


import com.fsck.k9.mail.Address;
import com.fsck.k9.mail.K9LibRobolectricTestRunner;
import com.fsck.k9.mail.Message;
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 org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class ListHeadersTest {
private static final String[] TEST_EMAIL_ADDRESSES = new String[] {
"prettyandsimple@example.com",
Expand Down
Expand Up @@ -2,14 +2,13 @@


import com.fsck.k9.mail.Body;
import com.fsck.k9.mail.K9LibRobolectricTestRunner;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mailstore.BinaryMemoryBody;
import org.apache.james.mime4j.util.MimeUtil;
import org.junit.Before;
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.assertNotNull;
Expand All @@ -18,8 +17,7 @@
import static org.mockito.Mockito.when;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class MessageExtractorTest {
private MimeBodyPart part;

Expand Down
Expand Up @@ -2,18 +2,16 @@


import com.fsck.k9.mail.Address;
import com.fsck.k9.mail.K9LibRobolectricTestRunner;
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.annotation.Config;

import static org.junit.Assert.assertEquals;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class MessageIdGeneratorTest {
private MessageIdGenerator messageIdGenerator;

Expand Down
Expand Up @@ -16,17 +16,15 @@
import com.fsck.k9.mail.Address;
import com.fsck.k9.mail.Body;
import com.fsck.k9.mail.BodyPart;
import com.fsck.k9.mail.K9LibRobolectricTestRunner;
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, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class MimeMessageParseTest {
@Before
public void setup() {
Expand Down
@@ -1,22 +1,21 @@
package com.fsck.k9.mail.store.imap;


import com.fsck.k9.mail.K9LibRobolectricTestRunner;

import java.util.HashMap;
import java.util.Map;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import static com.fsck.k9.mail.store.imap.ImapResponseHelper.createImapResponse;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class CopyUidResponseTest {
@Test
public void parse_withCopyUidResponse_shouldCreateUidMapping() throws Exception {
Expand Down
Expand Up @@ -11,6 +11,7 @@
import com.fsck.k9.mail.CertificateValidationException;
import com.fsck.k9.mail.CertificateValidationException.Reason;
import com.fsck.k9.mail.ConnectionSecurity;
import com.fsck.k9.mail.K9LibRobolectricTestRunner;
import com.fsck.k9.mail.K9MailLib;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.XOAuth2ChallengeParserTest;
Expand All @@ -23,8 +24,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowLog;

import static org.hamcrest.core.StringContains.containsString;
Expand All @@ -38,8 +37,7 @@
import static org.mockito.Mockito.when;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class ImapConnectionTest {
private static final boolean DEBUGGING = false;

Expand Down
Expand Up @@ -17,6 +17,7 @@
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Folder;
import com.fsck.k9.mail.Folder.FolderType;
import com.fsck.k9.mail.K9LibRobolectricTestRunner;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessageRetrievalListener;
import com.fsck.k9.mail.MessagingException;
Expand All @@ -32,9 +33,7 @@
import org.mockito.ArgumentCaptor;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;

import static com.fsck.k9.mail.Folder.OPEN_MODE_RO;
import static com.fsck.k9.mail.Folder.OPEN_MODE_RW;
Expand All @@ -58,8 +57,7 @@
import static org.mockito.internal.util.collections.Sets.newSet;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class ImapFolderTest {
private ImapStore imapStore;
private ImapConnection imapConnection;
Expand Down
@@ -1,17 +1,16 @@
package com.fsck.k9.mail.store.imap;


import com.fsck.k9.mail.K9LibRobolectricTestRunner;

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.assertNotNull;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class ImapPushStateTest {
@Test
public void parse_withValidArgument() throws Exception {
Expand Down
Expand Up @@ -6,13 +6,12 @@
import java.util.Collections;
import java.util.List;

import com.fsck.k9.mail.K9LibRobolectricTestRunner;
import com.fsck.k9.mail.PushReceiver;
import com.fsck.k9.mail.store.StoreConfig;
import org.junit.Before;
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.mockito.Mockito.doThrow;
Expand All @@ -21,8 +20,7 @@
import static org.mockito.Mockito.when;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class ImapPusherTest {
private ImapStore imapStore;
private TestImapPusher imapPusher;
Expand Down
Expand Up @@ -6,12 +6,11 @@
import java.util.ArrayList;
import java.util.List;

import com.fsck.k9.mail.K9LibRobolectricTestRunner;
import com.fsck.k9.mail.filter.FixedLengthInputStream;
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 static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
Expand All @@ -20,8 +19,7 @@
import static org.junit.Assert.fail;


@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class ImapResponseParserTest {
private PeekableInputStream peekableInputStream;

Expand Down
Expand Up @@ -17,18 +17,17 @@

package com.fsck.k9.mail.store.imap;

import com.fsck.k9.mail.K9LibRobolectricTestRunner;

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, sdk = 21)
@RunWith(K9LibRobolectricTestRunner.class)
public class ImapUtilityTest {
@Test
public void testGetImapSequenceValues() {
Expand Down