1   /**
2    * 
3    */
4   package com.quiotix.html.parser.test;
5   
6   import com.quiotix.html.parser.HtmlDocument;
7   
8   import junit.framework.TestCase;
9   
10  /**
11   * @author timp
12   * @since 19 Nov 2007
13   *
14   */
15  public class HtmlDocumentTest extends TestCase {
16  
17      /**
18       * @param name
19       */
20      public HtmlDocumentTest(String name) {
21          super(name);
22      }
23  
24      /** 
25       * {@inheritDoc}
26       * @see junit.framework.TestCase#setUp()
27       */
28      protected void setUp() throws Exception {
29          super.setUp();
30      }
31  
32      /** 
33       * {@inheritDoc}
34       * @see junit.framework.TestCase#tearDown()
35       */
36      protected void tearDown() throws Exception {
37          super.tearDown();
38      }
39  
40      /**
41       * Test method for {@link com.quiotix.html.parser.HtmlDocument#HtmlDocument(com.quiotix.html.parser.HtmlDocument.ElementSequence)}.
42       */
43      public void testHtmlDocument() {
44          
45      }
46  
47      /**
48       * Test method for {@link com.quiotix.html.parser.HtmlDocument#accept(com.quiotix.html.parser.HtmlVisitor)}.
49       */
50      public void testAccept() {
51          
52      }
53  
54      /**
55       * Test method for {@link com.quiotix.html.parser.HtmlDocument.Attribute#Attribute(String)}.
56       */
57      public void testAttribute() { 
58          HtmlDocument.Attribute a = new HtmlDocument.Attribute("Att");
59          assertEquals("Att", a.name);
60          assertNull(a.value);
61          assertFalse(a.hasValue);
62          assertEquals(3,a.getLength());
63          assertEquals("Att", a.toString());
64          assertEquals("", a.getValue());
65          
66          a.setValue(null);
67          
68          assertEquals("Att", a.name);
69          assertNull(a.value);
70          assertFalse(a.hasValue);
71          assertEquals(3,a.getLength());
72          assertEquals("Att", a.toString());
73          assertEquals("", a.getValue());
74          
75          a.setValue("1");
76          
77          assertEquals("Att", a.name);
78          assertEquals("1",a.value);
79          assertTrue(a.hasValue);
80          assertEquals(5,a.getLength());
81          assertEquals("Att=1", a.toString());
82          assertEquals("1", a.getValue());
83  
84          a.setValue(null);
85          
86          assertEquals("Att", a.name);
87          assertNull(a.value);
88          assertFalse(a.hasValue);
89          assertEquals(3,a.getLength());
90          assertEquals("Att", a.toString());
91          assertEquals("", a.getValue());
92  
93          a.setValue("'1'");
94          
95          assertEquals("Att", a.name);
96          assertEquals("'1'",a.value);
97          assertTrue(a.hasValue);
98          assertEquals(7,a.getLength());
99          assertEquals("Att='1'", a.toString());
100         assertEquals("1", a.getValue());
101         
102         a.setValue("\"1\"");
103         
104         assertEquals("Att", a.name);
105         assertEquals("\"1\"",a.value);
106         assertTrue(a.hasValue);
107         assertEquals(7,a.getLength());
108         assertEquals("Att=\"1\"", a.toString());
109         assertEquals("1", a.getValue());
110         
111     }
112     
113     
114 }