From d538278be62687758c956af62ee47c53637d67d8 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 28 Apr 2015 05:41:35 +0200 Subject: [PATCH] Don't write HtmlConverterTest results to a file Fixes issue #618 --- .../com/fsck/k9/helper/HtmlConverterTest.java | 35 +++---------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/k9mail/src/androidTest/java/com/fsck/k9/helper/HtmlConverterTest.java b/k9mail/src/androidTest/java/com/fsck/k9/helper/HtmlConverterTest.java index 701a9ec83..e61b6e84b 100644 --- a/k9mail/src/androidTest/java/com/fsck/k9/helper/HtmlConverterTest.java +++ b/k9mail/src/androidTest/java/com/fsck/k9/helper/HtmlConverterTest.java @@ -1,8 +1,5 @@ package com.fsck.k9.helper; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; import android.support.test.runner.AndroidJUnit4; @@ -14,9 +11,6 @@ import static junit.framework.Assert.assertEquals; @RunWith(AndroidJUnit4.class) public class HtmlConverterTest { - // Useful if you want to write stuff to a file for debugging in a browser. - private static final boolean WRITE_TO_FILE = Boolean.parseBoolean(System.getProperty("k9.htmlConverterTest.writeToFile", "false")); - private static final String OUTPUT_FILE = "C:/temp/parse.html"; @Test public void testTextQuoteToHtmlBlockquote() { @@ -32,7 +26,7 @@ public class HtmlConverterTest { "Nice job :)\r\n" + ">> Guess!"; String result = HtmlConverter.textToHtml(message); - writeToFile(result); + assertEquals("
"
                 + "Panama!
" + "
" @@ -71,7 +65,7 @@ public class HtmlConverterTest { ">\r\n" + "> :)"; String result = HtmlConverter.textToHtml(message); - writeToFile(result); + assertEquals("
"
                 + "*facepalm*
" + "
" @@ -106,7 +100,7 @@ public class HtmlConverterTest { ">>>>> five\r\n" + ">>>>>> six"; String result = HtmlConverter.textToHtml(message); - writeToFile(result); + assertEquals("
"
                 + "zero
" + "
" @@ -130,32 +124,13 @@ public class HtmlConverterTest { + "
", result); } - private void writeToFile(final String content) { - if (!WRITE_TO_FILE) { - return; - } - try { - System.err.println(content); - - File f = new File(OUTPUT_FILE); - f.delete(); - - FileWriter fstream = new FileWriter(OUTPUT_FILE); - BufferedWriter out = new BufferedWriter(fstream); - out.write(content); - out.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - @Test public void testPreserveSpacesAtFirst() { String message = "foo\r\n" + " bar\r\n" + " baz\r\n"; String result = HtmlConverter.textToHtml(message); - writeToFile(result); + assertEquals("
"
                 + "foo
" + " bar
" @@ -172,7 +147,7 @@ public class HtmlConverterTest { + " <\r\n" + " > \r\n"; String result = HtmlConverter.textToHtml(message); - writeToFile(result); + assertEquals("
"
                 + " 
" + " &
"