Index: javatests/org/chromium/distiller/DomUtilTest.java |
diff --git a/javatests/org/chromium/distiller/DomUtilTest.java b/javatests/org/chromium/distiller/DomUtilTest.java |
index 4e21612db2e50e8169b058041870d822b0fbe39c..1d004a074afdf9a647d7269d06e56f83c5b5a28b 100644 |
--- a/javatests/org/chromium/distiller/DomUtilTest.java |
+++ b/javatests/org/chromium/distiller/DomUtilTest.java |
@@ -11,6 +11,7 @@ import com.google.gwt.dom.client.Document; |
import com.google.gwt.dom.client.Element; |
import com.google.gwt.dom.client.Node; |
+import java.util.ArrayList; |
import java.util.Map; |
import java.util.List; |
@@ -377,4 +378,52 @@ public class DomUtilTest extends DomDistillerJsTestCase { |
DomUtil.stripImageElements(mBody); |
assertEquals(expected, mBody.getInnerHTML()); |
} |
+ |
+ public void testJoin() { |
+ List<String> wordsToJoin = new ArrayList<String>(); |
+ wordsToJoin.add("some"); |
+ wordsToJoin.add("words"); |
+ wordsToJoin.add("to"); |
+ wordsToJoin.add("join"); |
+ String result = DomUtil.join(wordsToJoin.toArray(), " - "); |
+ String expected = "some - words - to - join"; |
+ assertEquals(expected, result); |
+ } |
+ |
+ public void testFormatDuration() { |
+ String result = DomUtil.formatDuration("P3Y6M4DT12H30M5S"); |
+ String expected = "3 year(s) 6 month(s) 4 day(s) " + |
+ "12 hour(s) 30 minute(s) 5 second(s)"; |
+ assertEquals(expected,result); |
+ |
+ result = DomUtil.formatDuration("P23DT23H"); |
+ expected = "23 day(s) 23 hour(s)"; |
+ assertEquals(expected, result); |
+ |
+ result = DomUtil.formatDuration("P4Y"); |
+ expected = "4 year(s)"; |
+ assertEquals(expected, result); |
+ |
+ result = DomUtil.formatDuration("PT36H"); |
+ expected = "36 hour(s)"; |
+ assertEquals(expected, result); |
+ |
+ result = DomUtil.formatDuration("PT15M"); |
+ expected = "15 minute(s)"; |
+ assertEquals(expected, result); |
+ |
+ result = DomUtil.formatDuration("P23T23M"); |
+ expected = ""; |
+ assertEquals(expected,result); |
+ |
+ result = DomUtil.formatDuration("PT15"); |
+ expected = ""; |
+ assertEquals(expected, result); |
+ |
+ result = DomUtil.formatDuration("20M"); |
+ expected = ""; |
+ assertEquals(expected, result); |
+ } |
+ |
+ |
} |