commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r789566 - in /commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/translate: ./ LookupTranslatorTest.java
Date Tue, 30 Jun 2009 05:46:09 GMT
Author: bayard
Date: Tue Jun 30 05:46:08 2009
New Revision: 789566

URL: http://svn.apache.org/viewvc?rev=789566&view=rev
Log:
Adding a simple unit test for text translate. More needed, though StringEscapeUtils does do
a good job of hitting a high level of coverage for these classes already. It's easier to debug
when you have tighter testing. 

Added:
    commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/translate/
    commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/translate/LookupTranslatorTest.java
  (with props)

Added: commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/translate/LookupTranslatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/translate/LookupTranslatorTest.java?rev=789566&view=auto
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/translate/LookupTranslatorTest.java
(added)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/translate/LookupTranslatorTest.java
Tue Jun 30 05:46:08 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.commons.lang.text.translate;
+
+import junit.framework.TestCase;
+
+import java.io.StringWriter;
+import java.io.IOException;
+
+/**
+ * Unit tests for {@link org.apache.commons.lang.text.translate.LookupTranslator}.
+ */
+public class LookupTranslatorTest extends TestCase {
+
+    public void testBasicLookup() throws IOException {
+        String input = "one";
+        LookupTranslator lt = new LookupTranslator(new CharSequence[][] { { "one", "two"
} });
+        StringWriter out = new StringWriter();
+        int result = lt.translate("one", 0, out);
+        assertEquals("Incorrect codepoint consumption", 3, result);
+        assertEquals("Incorrect value", "two", out.toString());
+    }
+
+}

Propchange: commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/translate/LookupTranslatorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message