mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Clean up tests
This commit is contained in:
parent
b091ae4fa0
commit
5248350953
@ -1,54 +1,16 @@
|
|||||||
package com.fsck.k9.activity;
|
package com.fsck.k9.activity;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import org.junit.experimental.theories.*;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
import com.fsck.k9.Account.QuoteStyle;
|
import com.fsck.k9.Account.QuoteStyle;
|
||||||
import com.fsck.k9.activity.TextBodyBuilder;
|
|
||||||
import com.fsck.k9.mail.internet.TextBody;
|
import com.fsck.k9.mail.internet.TextBody;
|
||||||
|
|
||||||
class TestingTextBodyBuilder extends TextBodyBuilder {
|
import org.junit.experimental.theories.DataPoints;
|
||||||
|
import org.junit.experimental.theories.Theories;
|
||||||
|
import org.junit.experimental.theories.Theory;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
public TestingTextBodyBuilder(boolean includeQuotedText,
|
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||||
boolean isDraft,
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
QuoteStyle quoteStyle,
|
import static org.junit.Assert.assertThat;
|
||||||
boolean replyAfterQuote,
|
|
||||||
boolean signatureBeforeQuotedText,
|
|
||||||
boolean useSignature,
|
|
||||||
String messageText,
|
|
||||||
String signatureText) {
|
|
||||||
super(messageText);
|
|
||||||
|
|
||||||
includeQuotedText = (isDraft || includeQuotedText);
|
|
||||||
if (includeQuotedText) {
|
|
||||||
this.setIncludeQuotedText(true);
|
|
||||||
this.setReplyAfterQuote(quoteStyle == QuoteStyle.PREFIX && replyAfterQuote);
|
|
||||||
} else {
|
|
||||||
this.setIncludeQuotedText(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setInsertSeparator(!isDraft);
|
|
||||||
|
|
||||||
useSignature = (!isDraft && useSignature);
|
|
||||||
if (useSignature) {
|
|
||||||
this.setAppendSignature(true);
|
|
||||||
this.setSignature(signatureText);
|
|
||||||
this.setSignatureBeforeQuotedText(signatureBeforeQuotedText);
|
|
||||||
} else {
|
|
||||||
this.setAppendSignature(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// HtmlConverter depends on Android.
|
|
||||||
// So we use dummy method for tests.
|
|
||||||
@Override
|
|
||||||
protected String textToHtmlFragment(String text) {
|
|
||||||
return "<html>" + text + "</html>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@RunWith(Theories.class)
|
@RunWith(Theories.class)
|
||||||
public class TextBodyBuilderTest {
|
public class TextBodyBuilderTest {
|
||||||
@ -326,4 +288,44 @@ public class TextBodyBuilderTest {
|
|||||||
assertThat(insertableHtmlContent.toDebugString(), is(expectedHtmlContent));
|
assertThat(insertableHtmlContent.toDebugString(), is(expectedHtmlContent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static class TestingTextBodyBuilder extends TextBodyBuilder {
|
||||||
|
|
||||||
|
public TestingTextBodyBuilder(boolean includeQuotedText,
|
||||||
|
boolean isDraft,
|
||||||
|
QuoteStyle quoteStyle,
|
||||||
|
boolean replyAfterQuote,
|
||||||
|
boolean signatureBeforeQuotedText,
|
||||||
|
boolean useSignature,
|
||||||
|
String messageText,
|
||||||
|
String signatureText) {
|
||||||
|
super(messageText);
|
||||||
|
|
||||||
|
includeQuotedText = (isDraft || includeQuotedText);
|
||||||
|
if (includeQuotedText) {
|
||||||
|
this.setIncludeQuotedText(true);
|
||||||
|
this.setReplyAfterQuote(quoteStyle == QuoteStyle.PREFIX && replyAfterQuote);
|
||||||
|
} else {
|
||||||
|
this.setIncludeQuotedText(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setInsertSeparator(!isDraft);
|
||||||
|
|
||||||
|
useSignature = (!isDraft && useSignature);
|
||||||
|
if (useSignature) {
|
||||||
|
this.setAppendSignature(true);
|
||||||
|
this.setSignature(signatureText);
|
||||||
|
this.setSignatureBeforeQuotedText(signatureBeforeQuotedText);
|
||||||
|
} else {
|
||||||
|
this.setAppendSignature(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HtmlConverter depends on Android.
|
||||||
|
// So we use dummy method for tests.
|
||||||
|
@Override
|
||||||
|
protected String textToHtmlFragment(String text) {
|
||||||
|
return "<html>" + text + "</html>";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,6 @@ import junit.framework.TestCase;
|
|||||||
|
|
||||||
public class DecoderUtilTest extends TestCase {
|
public class DecoderUtilTest extends TestCase {
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
|
||||||
super.setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void tearDown() throws Exception {
|
|
||||||
super.tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDecodeEncodedWords() {
|
public void testDecodeEncodedWords() {
|
||||||
String body, expect;
|
String body, expect;
|
||||||
MimeMessage message;
|
MimeMessage message;
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package com.fsck.k9.mail.internet;
|
package com.fsck.k9.mail.internet;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
|
||||||
import com.fsck.k9.mail.MessagingException;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
public class MimeUtilityTest extends TestCase {
|
public class MimeUtilityTest extends TestCase {
|
||||||
|
Loading…
Reference in New Issue
Block a user