Add raw text block for various parsers

Add the raw text for procrank, mem info, system props, and top output.

Change-Id: Ifa60612638297aa4626a5f71dbd9de2007a59f65
diff --git a/src/com/android/loganalysis/item/MemInfoItem.java b/src/com/android/loganalysis/item/MemInfoItem.java
index f4e69c5..07a14fe 100644
--- a/src/com/android/loganalysis/item/MemInfoItem.java
+++ b/src/com/android/loganalysis/item/MemInfoItem.java
@@ -15,8 +15,48 @@
  */
 package com.android.loganalysis.item;
 
+import org.json.JSONException;
+import org.json.JSONObject;
+
 /**
  * An {@link IItem} used to store the memory info output.
  */
 @SuppressWarnings("serial")
-public class MemInfoItem extends GenericMapItem<Integer> {}
+public class MemInfoItem extends GenericMapItem<Integer> {
+
+    /** Constant for JSON output */
+    public static final String LINES = "LINES";
+    /** Constant for JSON output */
+    public static final String TEXT = "TEXT";
+
+    private String mText = null;
+
+    /**
+     * Get the raw text of the mem info command.
+     */
+    public String getText() {
+        return mText;
+    }
+
+    /**
+     * Set the raw text of the mem info command.
+     */
+    public void setText(String text) {
+        mText = text;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public JSONObject toJson() {
+        JSONObject object = new JSONObject();
+        try {
+            object.put(LINES, super.toJson());
+            object.put(TEXT, getText());
+        } catch (JSONException e) {
+            // Ignore
+        }
+        return object;
+    }
+}
diff --git a/src/com/android/loganalysis/item/ProcrankItem.java b/src/com/android/loganalysis/item/ProcrankItem.java
index 9a4eab6..3481884 100644
--- a/src/com/android/loganalysis/item/ProcrankItem.java
+++ b/src/com/android/loganalysis/item/ProcrankItem.java
@@ -45,6 +45,8 @@
     public static final String PSS = "PSS";
     /** Constant for JSON output */
     public static final String USS = "USS";
+    /** Constant for JSON output */
+    public static final String TEXT = "TEXT";
 
     private class ProcrankValue {
         public String mProcessName;
@@ -62,6 +64,7 @@
         }
     }
 
+    private String mText = null;
     private Map<Integer, ProcrankValue> mProcrankLines = new HashMap<Integer, ProcrankValue>();
 
     /**
@@ -141,6 +144,20 @@
     }
 
     /**
+     * Get the raw text of the procrank command.
+     */
+    public String getText() {
+        return mText;
+    }
+
+    /**
+     * Set the raw text of the procrank command.
+     */
+    public void setText(String text) {
+        mText = text;
+    }
+
+    /**
      * {@inheritDoc}
      */
     @Override
@@ -176,6 +193,7 @@
                 lines.put(line);
             }
             object.put(LINES, lines);
+            object.put(TEXT, getText());
         } catch (JSONException e) {
             // Ignore
         }
diff --git a/src/com/android/loganalysis/item/SystemPropsItem.java b/src/com/android/loganalysis/item/SystemPropsItem.java
index 0b71398..6bf3ba0 100644
--- a/src/com/android/loganalysis/item/SystemPropsItem.java
+++ b/src/com/android/loganalysis/item/SystemPropsItem.java
@@ -15,8 +15,48 @@
  */
 package com.android.loganalysis.item;
 
+import org.json.JSONException;
+import org.json.JSONObject;
+
 /**
  * An {@link IItem} used to store the system props info.
  */
 @SuppressWarnings("serial")
-public class SystemPropsItem extends GenericMapItem<String> {}
+public class SystemPropsItem extends GenericMapItem<String> {
+
+    /** Constant for JSON output */
+    public static final String LINES = "LINES";
+    /** Constant for JSON output */
+    public static final String TEXT = "TEXT";
+
+    private String mText = null;
+
+    /**
+     * Get the raw text of the system props command.
+     */
+    public String getText() {
+        return mText;
+    }
+
+    /**
+     * Set the raw text of the system props command.
+     */
+    public void setText(String text) {
+        mText = text;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public JSONObject toJson() {
+        JSONObject object = new JSONObject();
+        try {
+            object.put(LINES, super.toJson());
+            object.put(TEXT, getText());
+        } catch (JSONException e) {
+            // Ignore
+        }
+        return object;
+    }
+}
diff --git a/src/com/android/loganalysis/item/TopItem.java b/src/com/android/loganalysis/item/TopItem.java
index 09c44f9..8a36a49 100644
--- a/src/com/android/loganalysis/item/TopItem.java
+++ b/src/com/android/loganalysis/item/TopItem.java
@@ -40,9 +40,11 @@
     public static final String SIRQ = "SIRQ";
     /** Constant for JSON output */
     public static final String TOTAL = "TOTAL";
+    /** Constant for JSON output */
+    public static final String TEXT = "TEXT";
 
     private static final Set<String> ATTRIBUTES = new HashSet<String>(Arrays.asList(
-            USER, NICE, SYSTEM, IDLE, IOW, IRQ, SIRQ, TOTAL));
+            USER, NICE, SYSTEM, IDLE, IOW, IRQ, SIRQ, TOTAL, TEXT));
 
     /**
      * The constructor for {@link TopItem}.
@@ -166,4 +168,18 @@
     public void setTotal(int total) {
         setAttribute(TOTAL, total);
     }
+
+    /**
+     * Get the raw text of the top command.
+     */
+    public String getText() {
+        return (String) getAttribute(TEXT);
+    }
+
+    /**
+     * Set the raw text of the top command.
+     */
+    public void setText(String text) {
+        setAttribute(TEXT, text);
+    }
 }
diff --git a/src/com/android/loganalysis/parser/MemInfoParser.java b/src/com/android/loganalysis/parser/MemInfoParser.java
index 3aeaf05..fd5f23d 100644
--- a/src/com/android/loganalysis/parser/MemInfoParser.java
+++ b/src/com/android/loganalysis/parser/MemInfoParser.java
@@ -16,6 +16,7 @@
 package com.android.loganalysis.parser;
 
 import com.android.loganalysis.item.MemInfoItem;
+import com.android.loganalysis.util.ArrayUtil;
 
 import java.util.List;
 import java.util.regex.Matcher;
@@ -35,10 +36,11 @@
      * @return The {@link MemInfoItem}.
      */
     @Override
-    public MemInfoItem parse(List<String> block) {
+    public MemInfoItem parse(List<String> lines) {
         MemInfoItem item = new MemInfoItem();
+        item.setText(ArrayUtil.join("\n", lines).trim());
 
-        for (String line : block) {
+        for (String line : lines) {
             Matcher m = INFO_LINE.matcher(line);
             if (m.matches()) {
                 String key = m.group(1);
diff --git a/src/com/android/loganalysis/parser/ProcrankParser.java b/src/com/android/loganalysis/parser/ProcrankParser.java
index 938a62c..dad031f 100644
--- a/src/com/android/loganalysis/parser/ProcrankParser.java
+++ b/src/com/android/loganalysis/parser/ProcrankParser.java
@@ -16,6 +16,7 @@
 package com.android.loganalysis.parser;
 
 import com.android.loganalysis.item.ProcrankItem;
+import com.android.loganalysis.util.ArrayUtil;
 
 import java.util.List;
 import java.util.regex.Matcher;
@@ -43,6 +44,7 @@
     @Override
     public ProcrankItem parse(List<String> lines) {
         ProcrankItem item = new ProcrankItem();
+        item.setText(ArrayUtil.join("\n", lines).replaceAll("\\s+$", ""));
 
         for (String line : lines) {
             // If we have reached the end.
diff --git a/src/com/android/loganalysis/parser/SystemPropsParser.java b/src/com/android/loganalysis/parser/SystemPropsParser.java
index a1cd9da..055d9b6 100644
--- a/src/com/android/loganalysis/parser/SystemPropsParser.java
+++ b/src/com/android/loganalysis/parser/SystemPropsParser.java
@@ -16,6 +16,7 @@
 package com.android.loganalysis.parser;
 
 import com.android.loganalysis.item.SystemPropsItem;
+import com.android.loganalysis.util.ArrayUtil;
 
 import java.util.List;
 import java.util.regex.Matcher;
@@ -36,6 +37,7 @@
     @Override
     public SystemPropsItem parse(List<String> lines) {
         SystemPropsItem item = new SystemPropsItem();
+        item.setText(ArrayUtil.join("\n", lines).trim());
 
         for (String line : lines) {
             Matcher m = PROP_LINE.matcher(line);
diff --git a/src/com/android/loganalysis/parser/TopParser.java b/src/com/android/loganalysis/parser/TopParser.java
index e5022c3..7bd9caa 100644
--- a/src/com/android/loganalysis/parser/TopParser.java
+++ b/src/com/android/loganalysis/parser/TopParser.java
@@ -16,6 +16,7 @@
 package com.android.loganalysis.parser;
 
 import com.android.loganalysis.item.TopItem;
+import com.android.loganalysis.util.ArrayUtil;
 
 import java.util.List;
 import java.util.regex.Matcher;
@@ -44,6 +45,7 @@
     @Override
     public TopItem parse(List<String> lines) {
         TopItem item = new TopItem();
+        item.setText(ArrayUtil.join("\n", lines).trim());
 
         for (String line : lines) {
             Matcher m = TICKS_PAT.matcher(line);
diff --git a/tests/src/com/android/loganalysis/UnitTests.java b/tests/src/com/android/loganalysis/UnitTests.java
index caac918..d3b63e1 100644
--- a/tests/src/com/android/loganalysis/UnitTests.java
+++ b/tests/src/com/android/loganalysis/UnitTests.java
@@ -26,9 +26,12 @@
 import com.android.loganalysis.heuristic.RuntimeRestartHeuristicTest;
 import com.android.loganalysis.item.DumpsysBatteryInfoItemTest;
 import com.android.loganalysis.item.GenericItemTest;
+import com.android.loganalysis.item.MemInfoItemTest;
 import com.android.loganalysis.item.MonkeyLogItemTest;
 import com.android.loganalysis.item.ProcrankItemTest;
 import com.android.loganalysis.item.SmartMonkeyLogItemTest;
+import com.android.loganalysis.item.SystemPropsItemTest;
+import com.android.loganalysis.item.TopItemTest;
 import com.android.loganalysis.parser.AbstractSectionParserTest;
 import com.android.loganalysis.parser.AnrParserTest;
 import com.android.loganalysis.parser.BugreportParserTest;
@@ -75,9 +78,12 @@
         // item
         addTestSuite(DumpsysBatteryInfoItemTest.class);
         addTestSuite(GenericItemTest.class);
+        addTestSuite(MemInfoItemTest.class);
         addTestSuite(MonkeyLogItemTest.class);
         addTestSuite(ProcrankItemTest.class);
         addTestSuite(SmartMonkeyLogItemTest.class);
+        addTestSuite(SystemPropsItemTest.class);
+        addTestSuite(TopItemTest.class);
 
         // parser
         addTestSuite(AbstractSectionParserTest.class);
diff --git a/tests/src/com/android/loganalysis/item/GenericItemTest.java b/tests/src/com/android/loganalysis/item/GenericItemTest.java
index 1364b2a..7532fd3 100644
--- a/tests/src/com/android/loganalysis/item/GenericItemTest.java
+++ b/tests/src/com/android/loganalysis/item/GenericItemTest.java
@@ -243,8 +243,6 @@
         // Convert to JSON string and back again
         JSONObject output = new JSONObject(item.toJson().toString());
 
-        System.out.println(item.toJson());
-
         assertTrue(output.has("string"));
         assertEquals("foo", output.get("string"));
         assertTrue(output.has("date"));
diff --git a/tests/src/com/android/loganalysis/item/MemInfoItemTest.java b/tests/src/com/android/loganalysis/item/MemInfoItemTest.java
new file mode 100644
index 0000000..beda797
--- /dev/null
+++ b/tests/src/com/android/loganalysis/item/MemInfoItemTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.loganalysis.item;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * Unit test for {@link MemInfoItem}.
+ */
+public class MemInfoItemTest extends TestCase {
+
+    /**
+     * Test that {@link MemInfoItem#toJson()} returns correctly.
+     */
+    public void testToJson() throws JSONException {
+        MemInfoItem item = new MemInfoItem();
+        item.put("foo", 123);
+        item.put("bar", 456);
+        item.setText("foo: 123 kB\nbar: 456 kB");
+
+        // Convert to JSON string and back again
+        JSONObject output = new JSONObject(item.toJson().toString());
+
+        assertTrue(output.has(MemInfoItem.LINES));
+        assertTrue(output.get(MemInfoItem.LINES) instanceof JSONObject);
+        assertTrue(output.has(MemInfoItem.TEXT));
+        assertEquals("foo: 123 kB\nbar: 456 kB", output.get(MemInfoItem.TEXT));
+
+        JSONObject lines = output.getJSONObject(MemInfoItem.LINES);
+
+        assertEquals(2, lines.length());
+
+        assertEquals(123, lines.get("foo"));
+        assertEquals(456, lines.get("bar"));
+    }
+}
diff --git a/tests/src/com/android/loganalysis/item/ProcrankItemTest.java b/tests/src/com/android/loganalysis/item/ProcrankItemTest.java
index cfd5d40..7f5d309 100644
--- a/tests/src/com/android/loganalysis/item/ProcrankItemTest.java
+++ b/tests/src/com/android/loganalysis/item/ProcrankItemTest.java
@@ -25,6 +25,7 @@
  * Unit test for {@link ProcrankItem}.
  */
 public class ProcrankItemTest extends TestCase {
+
     /**
      * Test that {@link ProcrankItem#toJson()} returns correctly.
      */
@@ -32,12 +33,15 @@
         ProcrankItem item = new ProcrankItem();
         item.addProcrankLine(0, "process0", 1, 2, 3, 4);
         item.addProcrankLine(5, "process1", 6, 7, 8, 9);
+        item.setText("foo\nbar");
 
         // Convert to JSON string and back again
         JSONObject output = new JSONObject(item.toJson().toString());
 
         assertTrue(output.has(ProcrankItem.LINES));
         assertTrue(output.get(ProcrankItem.LINES) instanceof JSONArray);
+        assertTrue(output.has(ProcrankItem.TEXT));
+        assertEquals("foo\nbar", output.get(ProcrankItem.TEXT));
 
         JSONArray lines = output.getJSONArray(ProcrankItem.LINES);
 
diff --git a/tests/src/com/android/loganalysis/item/SystemPropsItemTest.java b/tests/src/com/android/loganalysis/item/SystemPropsItemTest.java
new file mode 100644
index 0000000..b9b6675
--- /dev/null
+++ b/tests/src/com/android/loganalysis/item/SystemPropsItemTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.loganalysis.item;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * Unit test for {@link SystemPropsItem}.
+ */
+public class SystemPropsItemTest extends TestCase {
+
+    /**
+     * Test that {@link SystemPropsItem#toJson()} returns correctly.
+     */
+    public void testToJson() throws JSONException {
+        SystemPropsItem item = new SystemPropsItem();
+        item.put("foo", "123");
+        item.put("bar", "456");
+        item.setText("[foo]: [123]\n[bar]: [456]");
+
+        // Convert to JSON string and back again
+        JSONObject output = new JSONObject(item.toJson().toString());
+
+        assertTrue(output.has(SystemPropsItem.LINES));
+        assertTrue(output.get(SystemPropsItem.LINES) instanceof JSONObject);
+        assertTrue(output.has(SystemPropsItem.TEXT));
+        assertEquals("[foo]: [123]\n[bar]: [456]", output.get(SystemPropsItem.TEXT));
+
+        JSONObject lines = output.getJSONObject(SystemPropsItem.LINES);
+
+        assertEquals(2, lines.length());
+
+        assertEquals("123", lines.get("foo"));
+        assertEquals("456", lines.get("bar"));
+    }
+}
diff --git a/tests/src/com/android/loganalysis/item/TopItemTest.java b/tests/src/com/android/loganalysis/item/TopItemTest.java
new file mode 100644
index 0000000..2df01d0
--- /dev/null
+++ b/tests/src/com/android/loganalysis/item/TopItemTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.loganalysis.item;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * Unit test for {@link TopItem}.
+ */
+public class TopItemTest extends TestCase {
+
+    /**
+     * Test that {@link TopItem#toJson()} returns correctly.
+     */
+    public void testToJson() throws JSONException {
+        TopItem item = new TopItem();
+        item.setText("User 20%, System 20%, IOW 5%, IRQ 3%");
+
+        // Convert to JSON string and back again
+        JSONObject output = new JSONObject(item.toJson().toString());
+
+        assertTrue(output.has(TopItem.TEXT));
+        assertEquals("User 20%, System 20%, IOW 5%, IRQ 3%", output.get(TopItem.TEXT));
+    }
+}
diff --git a/tests/src/com/android/loganalysis/parser/MemInfoParserTest.java b/tests/src/com/android/loganalysis/parser/MemInfoParserTest.java
index 2069d12..775a096 100644
--- a/tests/src/com/android/loganalysis/parser/MemInfoParserTest.java
+++ b/tests/src/com/android/loganalysis/parser/MemInfoParserTest.java
@@ -16,6 +16,7 @@
 package com.android.loganalysis.parser;
 
 import com.android.loganalysis.item.MemInfoItem;
+import com.android.loganalysis.util.ArrayUtil;
 
 import junit.framework.TestCase;
 
@@ -34,13 +35,14 @@
                 "Cached:            86204 kB",
                 "SwapCached:            0 kB");
         MemInfoParser parser = new MemInfoParser();
-        MemInfoItem output = parser.parse(inputBlock);
+        MemInfoItem item = parser.parse(inputBlock);
 
-        assertEquals(5, output.size());
-        assertEquals((Integer)353332, output.get("MemTotal"));
-        assertEquals((Integer)65420, output.get("MemFree"));
-        assertEquals((Integer)20800, output.get("Buffers"));
-        assertEquals((Integer)86204, output.get("Cached"));
-        assertEquals((Integer)0, output.get("SwapCached"));
+        assertEquals(5, item.size());
+        assertEquals((Integer)353332, item.get("MemTotal"));
+        assertEquals((Integer)65420, item.get("MemFree"));
+        assertEquals((Integer)20800, item.get("Buffers"));
+        assertEquals((Integer)86204, item.get("Cached"));
+        assertEquals((Integer)0, item.get("SwapCached"));
+        assertEquals(ArrayUtil.join("\n", inputBlock), item.getText());
     }
 }
diff --git a/tests/src/com/android/loganalysis/parser/MonkeyLogParserTest.java b/tests/src/com/android/loganalysis/parser/MonkeyLogParserTest.java
index a096da3..e29d84b 100644
--- a/tests/src/com/android/loganalysis/parser/MonkeyLogParserTest.java
+++ b/tests/src/com/android/loganalysis/parser/MonkeyLogParserTest.java
@@ -39,7 +39,7 @@
     /**
      * Test that a monkey can be parsed if there are no crashes.
      */
-    public void testParse_success() throws ParseException {
+    public void testParse_success() {
         List<String> lines = Arrays.asList(
                 "# Wednesday, 04/25/2012 01:37:12 AM - device uptime = 242.13: Monkey command used for this test:",
                 "adb shell monkey -p com.google.android.browser  -c android.intent.category.SAMPLE_CODE -c android.intent.category.CAR_DOCK -c android.intent.category.LAUNCHER -c android.intent.category.MONKEY -c android.intent.category.INFO  --ignore-security-exceptions --throttle 100  -s 528 -v -v -v 10000 ",
@@ -104,7 +104,7 @@
     /**
      * Test that a monkey can be parsed if there is an ANR.
      */
-    public void testParse_anr() throws ParseException {
+    public void testParse_anr() {
         List<String> lines = Arrays.asList(
                 "# Tuesday, 04/24/2012 05:23:30 PM - device uptime = 216.48: Monkey command used for this test:",
                 "adb shell monkey -p com.google.android.youtube  -c android.intent.category.SAMPLE_CODE -c android.intent.category.CAR_DOCK -c android.intent.category.LAUNCHER -c android.intent.category.MONKEY -c android.intent.category.INFO  --ignore-security-exceptions --throttle 100  -s 993 -v -v -v 10000 ",
@@ -211,7 +211,7 @@
     /**
      * Test that a monkey can be parsed if there is a Java crash.
      */
-    public void testParse_java_crash() throws ParseException {
+    public void testParse_java_crash() {
         List<String> lines = Arrays.asList(
                 "# Tuesday, 04/24/2012 05:05:50 PM - device uptime = 232.65: Monkey command used for this test:",
                 "adb shell monkey -p com.google.android.apps.maps  -c android.intent.category.SAMPLE_CODE -c android.intent.category.CAR_DOCK -c android.intent.category.LAUNCHER -c android.intent.category.MONKEY -c android.intent.category.INFO  --ignore-security-exceptions --throttle 100  -s 501 -v -v -v 10000 ",
@@ -282,7 +282,7 @@
     /**
      * Test that a monkey can be parsed if there is a native crash.
      */
-    public void testParse_native_crash() throws ParseException {
+    public void testParse_native_crash() {
         List<String> lines = Arrays.asList(
                 "# Tuesday, 04/24/2012 05:05:50 PM - device uptime = 232.65: Monkey command used for this test:",
                 "adb shell monkey -p com.google.android.apps.maps  -c android.intent.category.SAMPLE_CODE -c android.intent.category.CAR_DOCK -c android.intent.category.LAUNCHER -c android.intent.category.MONKEY -c android.intent.category.INFO  --ignore-security-exceptions --throttle 100  -s 501 -v -v -v 10000 ",
@@ -375,7 +375,7 @@
     /**
      * Test that a monkey can be parsed if there are no activities to run.
      */
-    public void testParse_no_activities() throws ParseException {
+    public void testParse_no_activities() {
         List<String> lines = Arrays.asList(
                 "# Wednesday, 04/25/2012 01:37:12 AM - device uptime = 242.13: Monkey command used for this test:",
                 "adb shell monkey -p com.google.android.browser  -c android.intent.category.SAMPLE_CODE -c android.intent.category.CAR_DOCK -c android.intent.category.LAUNCHER -c android.intent.category.MONKEY -c android.intent.category.INFO  --ignore-security-exceptions --throttle 100  -s 528 -v -v -v 10000 ",
@@ -420,7 +420,7 @@
     /**
      * Test that the other date format can be parsed.
      */
-    public void testAlternateDateFormat() throws ParseException {
+    public void testAlternateDateFormat() {
         List<String> lines = Arrays.asList(
                 "# Tue Apr 24 17:05:50 PST 2012 - device uptime = 232.65: Monkey command used for this test:",
                 "adb shell monkey -p com.google.android.apps.maps  -c android.intent.category.SAMPLE_CODE -c android.intent.category.CAR_DOCK -c android.intent.category.LAUNCHER -c android.intent.category.MONKEY -c android.intent.category.INFO  --ignore-security-exceptions --throttle 100  -s 501 -v -v -v 10000 ",
diff --git a/tests/src/com/android/loganalysis/parser/ProcrankParserTest.java b/tests/src/com/android/loganalysis/parser/ProcrankParserTest.java
index a6c66b7..0e8795a 100644
--- a/tests/src/com/android/loganalysis/parser/ProcrankParserTest.java
+++ b/tests/src/com/android/loganalysis/parser/ProcrankParserTest.java
@@ -16,6 +16,7 @@
 package com.android.loganalysis.parser;
 
 import com.android.loganalysis.item.ProcrankItem;
+import com.android.loganalysis.util.ArrayUtil;
 
 import junit.framework.TestCase;
 
@@ -53,6 +54,7 @@
         assertEquals((Integer) 33122, procrank.getPss(3247));
         assertEquals((Integer) 28360, procrank.getUss(334));
         assertEquals("android.process.acore", procrank.getProcessName(2072));
+        assertEquals(ArrayUtil.join("\n", inputBlock), procrank.getText());
     }
 }
 
diff --git a/tests/src/com/android/loganalysis/parser/TopParserTest.java b/tests/src/com/android/loganalysis/parser/TopParserTest.java
index 0f67849..a57f12b 100644
--- a/tests/src/com/android/loganalysis/parser/TopParserTest.java
+++ b/tests/src/com/android/loganalysis/parser/TopParserTest.java
@@ -16,6 +16,7 @@
 package com.android.loganalysis.parser;
 
 import com.android.loganalysis.item.TopItem;
+import com.android.loganalysis.util.ArrayUtil;
 
 import junit.framework.TestCase;
 
@@ -48,6 +49,7 @@
         assertEquals(5, item.getIrq());
         assertEquals(25, item.getSirq());
         assertEquals(1000, item.getTotal());
+        assertEquals(ArrayUtil.join("\n", inputBlock), item.getText());
     }
 
     /**