commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject [4/8] [text] TEXT-58: Migrating AggregateTranslatorTest to new paradigm
Date Mon, 23 Jan 2017 01:28:06 GMT
TEXT-58: Migrating AggregateTranslatorTest to new paradigm


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/ae4dc082
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/ae4dc082
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/ae4dc082

Branch: refs/heads/master
Commit: ae4dc0820de1f848a3c85cfe41cf886bebea0680
Parents: bdfa830
Author: Rob Tompkins <chtompki@gmail.com>
Authored: Sat Jan 21 11:12:00 2017 -0500
Committer: Rob Tompkins <chtompki@gmail.com>
Committed: Sat Jan 21 11:12:00 2017 -0500

----------------------------------------------------------------------
 .../commons/text/translate/AggregateTranslatorTest.java | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/ae4dc082/src/test/java/org/apache/commons/text/translate/AggregateTranslatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/translate/AggregateTranslatorTest.java
b/src/test/java/org/apache/commons/text/translate/AggregateTranslatorTest.java
index 5335396..f1a4639 100644
--- a/src/test/java/org/apache/commons/text/translate/AggregateTranslatorTest.java
+++ b/src/test/java/org/apache/commons/text/translate/AggregateTranslatorTest.java
@@ -20,11 +20,13 @@ import org.junit.Test;
 
 import java.io.IOException;
 import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
 
 import static org.junit.Assert.assertEquals;
 
 /**
- * Unit tests for {@link org.apache.commons.text.translate.AggregateTranslator}.
+ * Unit tests for {@link AggregateTranslator}.
  */
 public class AggregateTranslatorTest {
 
@@ -44,8 +46,12 @@ public class AggregateTranslatorTest {
 
     @Test
     public void testNonNull() throws IOException{
-        final CharSequenceTranslator translator1 = new LookupTranslator(new CharSequence[][]
{ { "one", "two" } });
-        final CharSequenceTranslator translator2 = new LookupTranslator(new CharSequence[][]
{ { "three", "four" } });
+        final Map<CharSequence, CharSequence> oneTwoMap = new HashMap<>();
+        oneTwoMap.put("one", "two");
+        final Map<CharSequence, CharSequence> threeFourMap = new HashMap<>();
+        threeFourMap.put("three", "four");
+        final CharSequenceTranslator translator1 = new LookupTranslator(oneTwoMap);
+        final CharSequenceTranslator translator2 = new LookupTranslator(threeFourMap);
         final AggregateTranslator subject = new AggregateTranslator(translator1, translator2);
         final StringWriter out1 = new StringWriter();
         final int result1 = subject.translate(new StringBuffer("one"), 0, out1);


Mime
View raw message