KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > htmlparser > tests > parserHelperTests > CompositeTagScannerHelperTest


1 // HTMLParser Library $Name: v1_5_20050313 $ - A java-based parser for HTML
2
// http://sourceforge.org/projects/htmlparser
3
// Copyright (C) 2004 Somik Raha
4
//
5
// Revision Control Information
6
//
7
// $Source: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/parserHelperTests/CompositeTagScannerHelperTest.java,v $
8
// $Author: derrickoswald $
9
// $Date: 2004/07/02 00:49:30 $
10
// $Revision: 1.31 $
11
//
12
// This library is free software; you can redistribute it and/or
13
// modify it under the terms of the GNU Lesser General Public
14
// License as published by the Free Software Foundation; either
15
// version 2.1 of the License, or (at your option) any later version.
16
//
17
// This library is distributed in the hope that it will be useful,
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
// Lesser General Public License for more details.
21
//
22
// You should have received a copy of the GNU Lesser General Public
23
// License along with this library; if not, write to the Free Software
24
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
//
26

27 package org.htmlparser.tests.parserHelperTests;
28
29 import org.htmlparser.Tag;
30 import org.htmlparser.tests.ParserTestCase;
31 import org.htmlparser.util.ParserException;
32
33 /**
34  * @author Somik Raha
35  *
36  * To change the template for this generated type comment go to
37  * Window>Preferences>Java>Code Generation>Code and Comments
38  */

39 public class CompositeTagScannerHelperTest extends ParserTestCase {
40
41     static
42     {
43         System.setProperty ("org.htmlparser.tests.parserHelperTests.CompositeTagScannerHelperTest", "CompositeTagScannerHelperTest");
44     }
45
46     public CompositeTagScannerHelperTest(String JavaDoc name) {
47         super(name);
48     }
49
50     protected void setUp() {
51     }
52
53     public void testIsXmlEndTagForRealXml () throws ParserException
54     {
55         String JavaDoc html = "<something/>";
56         createParser (html);
57         parseAndAssertNodeCount (1);
58         assertTrue("should be a tag", node[0] instanceof Tag);
59         assertTrue("should be an xml end tag", ((Tag)node[0]).isEmptyXmlTag ());
60     }
61
62     public void testIsXmlEndTagForFalseMatches () throws ParserException
63     {
64         String JavaDoc html = "<a HREF=http://someurl.com/>";
65         createParser (html);
66         parseAndAssertNodeCount (1);
67         assertTrue("should be a tag", node[0] instanceof Tag);
68         assertTrue("should not be an xml end tag", !((Tag)node[0]).isEmptyXmlTag ());
69     }
70 }
71
Popular Tags