Author: sback
Date: 2007-08-26 16:10:49 +0000 (Sun, 26 Aug 2007)
New Revision: 14885

Modified:
   trunk/freenet/test/freenet/support/HTMLNodeTest.java
Log:
Some tests added to improve the code coverage

Modified: trunk/freenet/test/freenet/support/HTMLNodeTest.java
===================================================================
--- trunk/freenet/test/freenet/support/HTMLNodeTest.java        2007-08-26 
15:34:33 UTC (rev 14884)
+++ trunk/freenet/test/freenet/support/HTMLNodeTest.java        2007-08-26 
16:10:49 UTC (rev 14885)
@@ -332,6 +332,21 @@
        }

        /**
+        * Tests HTMLNode(String,String[],String[],String) 
+        * constructor trying to create a node that has
+        * different length for attributes names array and
+        * attributes values array. It should raise an
+        * IllegalArgument exception
+        */
+       public void testHTMLNode_attributeArrays_differentLengths() {
+               String[] methodAttributesNameArray = {SAMPLE_ATTRIBUTE_NAME,
+                               SAMPLE_ATTRIBUTE_NAME};
+               String[] methodAttributesValueArray = {SAMPLE_ATTRIBUTE_VALUE,
+                               SAMPLE_ATTRIBUTE_VALUE,SAMPLE_ATTRIBUTE_VALUE};
+               testHTMLNodeArray_null(methodAttributesNameArray, 
methodAttributesValueArray);
+       }
+       
+       /**
         * Tests if the passed arrays raise an IllegalArgumentException
         * using them to create a new HTMLNode (i.e. one of the name or value
         * must be null)
@@ -467,6 +482,19 @@
        }

        /**
+        * Tests generate() method with a
+        * HTMLNode that has "%" as name.
+        * The expected output is just the HTMLNode content
+        */
+       public void testGenerate_fromHTMLNode_percentName() {
+               HTMLNode methodHTMLNode = new HTMLNode("%",
+                               SAMPLE_ATTRIBUTE_NAME,SAMPLE_ATTRIBUTE_VALUE,
+                               SAMPLE_NODE_CONTENT);
+               assertEquals(SAMPLE_NODE_CONTENT,
+                               methodHTMLNode.generate());
+       }
+       
+       /**
         * Tests HTMLDoctype.generate() method
         * comparing the result with the expected
         * String. It is useful for regression tests.


Reply via email to