click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From take...@apache.org
Subject svn commit: r768853 - /incubator/click/trunk/click/extras/test/org/apache/click/extras/control/HiddenListTest.java
Date Mon, 27 Apr 2009 01:50:58 GMT
Author: takezoe
Date: Mon Apr 27 01:50:57 2009
New Revision: 768853

URL: http://svn.apache.org/viewvc?rev=768853&view=rev
Log:
[CLK-491]UnitTest for HiddenList control.

Added:
    incubator/click/trunk/click/extras/test/org/apache/click/extras/control/HiddenListTest.java
  (with props)

Added: incubator/click/trunk/click/extras/test/org/apache/click/extras/control/HiddenListTest.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/extras/test/org/apache/click/extras/control/HiddenListTest.java?rev=768853&view=auto
==============================================================================
--- incubator/click/trunk/click/extras/test/org/apache/click/extras/control/HiddenListTest.java
(added)
+++ incubator/click/trunk/click/extras/test/org/apache/click/extras/control/HiddenListTest.java
Mon Apr 27 01:50:57 2009
@@ -0,0 +1,63 @@
+package org.apache.click.extras.control;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.click.util.HtmlStringBuffer;
+
+import junit.framework.TestCase;
+
+public class HiddenListTest extends TestCase {
+
+    public void testRender() {
+        HiddenList hiddenList = new HiddenList("hiddenList");
+        hiddenList.addValue("A");
+        hiddenList.addValue("B");
+        hiddenList.addValue("C");
+        
+        HtmlStringBuffer buffer = new HtmlStringBuffer();
+        hiddenList.render(buffer);
+        
+        assertEquals(
+                "<input type=\"hidden\" name=\"hiddenList\" id=\"hiddenList_1\" value=\"A\"/>"
+
+                "<input type=\"hidden\" name=\"hiddenList\" id=\"hiddenList_2\" value=\"B\"/>"
+ 
+                "<input type=\"hidden\" name=\"hiddenList\" id=\"hiddenList_3\" value=\"C\"/>",

+                buffer.toString());
+    }
+
+    public void testIsHidden() {
+        HiddenList hiddenList = new HiddenList("hiddenList");
+        assertTrue(hiddenList.isHidden());
+    }
+
+    public void testGetValueObject() {
+        HiddenList hiddenList = new HiddenList("hiddenList");
+        hiddenList.addValue("A");
+        hiddenList.addValue("B");
+        hiddenList.addValue("C");
+        
+        List valueObject = (List) hiddenList.getValueObject();
+        assertEquals(3, valueObject.size());
+        assertEquals("A", valueObject.get(0));
+        assertEquals("B", valueObject.get(1));
+        assertEquals("C", valueObject.get(2));
+    }
+
+    public void testSetValueObject() {
+        HiddenList hiddenList = new HiddenList("hiddenList");
+        
+        List valueObject = new ArrayList();
+        valueObject.add("A");
+        valueObject.add("B");
+        valueObject.add("C");
+        
+        hiddenList.setValueObject(valueObject);
+        
+        List values = hiddenList.getValues();
+        assertEquals(3, values.size());
+        assertEquals("A", values.get(0));
+        assertEquals("B", values.get(1));
+        assertEquals("C", values.get(2));
+    }
+
+}

Propchange: incubator/click/trunk/click/extras/test/org/apache/click/extras/control/HiddenListTest.java
------------------------------------------------------------------------------
    charset = utf-8

Propchange: incubator/click/trunk/click/extras/test/org/apache/click/extras/control/HiddenListTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/x-java



Mime
View raw message