mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Remove account after creation
* Avoid side-effects in static preferences which might interfere with other tests
This commit is contained in:
parent
4e964e271c
commit
79b03b5e4f
@ -1,24 +1,43 @@
|
||||
package com.fsck.k9.mailstore;
|
||||
|
||||
|
||||
import android.test.AndroidTestCase;
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.Preferences;
|
||||
import com.fsck.k9.mail.internet.MimeBodyPart;
|
||||
import com.fsck.k9.mail.internet.MimeMultipart;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
|
||||
|
||||
public class LocalMessageTest extends AndroidTestCase {
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class LocalMessageTest {
|
||||
private LocalMessage message;
|
||||
private Account account;
|
||||
private Preferences preferences;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
Preferences preferences = Preferences.getPreferences(getContext());
|
||||
LocalStore store = LocalStore.getInstance(preferences.newAccount(), getContext());
|
||||
Context targetContext = InstrumentationRegistry.getTargetContext();
|
||||
preferences = Preferences.getPreferences(targetContext);
|
||||
account = preferences.newAccount();
|
||||
LocalStore store = LocalStore.getInstance(account, targetContext);
|
||||
message = new LocalMessage(store, "uid", new LocalFolder(store, "test"));
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
preferences.deleteAccount(account);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDisplayTextWithPlainTextPart() throws Exception {
|
||||
String textBodyText = "text body";
|
||||
|
||||
@ -29,6 +48,7 @@ public class LocalMessageTest extends AndroidTestCase {
|
||||
assertEquals("text body", message.getTextForDisplay());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDisplayTextWithHtmlPart() throws Exception {
|
||||
String htmlBodyText = "html body";
|
||||
String textBodyText = "text body";
|
||||
|
Loading…
Reference in New Issue
Block a user