org.htmlparser.tests.tagTests
Class LinkTagTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.htmlparser.tests.ParserTestCase
              extended byorg.htmlparser.tests.tagTests.LinkTagTest
All Implemented Interfaces:
junit.framework.Test

public class LinkTagTest
extends ParserTestCase


Field Summary
 
Fields inherited from class org.htmlparser.tests.ParserTestCase
mLexer, node, nodeCount, parser
 
Constructor Summary
LinkTagTest(java.lang.String name)
           
 
Method Summary
 void _testLinkWithJSP()
          Bug report by Cory Seefurth
 void testAccessKey()
           
 void testBadImageInLinkBug()
           
 void testBaseRefLink()
           
 void testBrokenLink()
          Test suggested by Cedric Rosa A really bad link tag sends parser into infinite loop
 void testCharacterReferenceInLink()
          See bug #982175 False Positives on ® entity
 void testErroneousLinkBug()
           
 void testErroneousLinkBugFromYahoo()
          Test case based on a report by Raghavender Srimantula, of the parser giving out of memory exceptions.
 void testErroneousLinkBugFromYahoo2()
          Test case based on a report by Raghavender Srimantula, of the parser giving out of memory exceptions.
 void testExtractLinkInvertedCommasBug2()
          This is the reproduction of a bug which produces multiple text copies.
 void testFreshMeatBug()
          A bug in the freshmeat page - really bad html tag - <A>Revision<\a> Reported by Mazlan Mat Note: Actually, this is completely legal HTML - Derrick
 void testFTPLink()
           
 void testIrcIsNotAHTTPLink()
          Bug #784767 irc://server/channel urls are HTTPLike?
 void testJavascriptLink()
           
 void testLinkContainsEqualTo()
          This is an attempt to reproduce bug 677874 reported by James Moliere.
 void testLinkDataContents()
           
 void testLinkNodeBug()
          The bug being reproduced is this :
<BODY aLink=#ff0000 bgColor=#ffffff link=#0000cc onload=setfocus() text=#000000
vLink=#551a8b> The above line is incorrectly parsed in that, the BODY tag is not identified.
 void testLinkNodeBug2()
          The bug being reproduced is this :
<BODY aLink=#ff0000 bgColor=#ffffff link=#0000cc onload=setfocus() text=#000000
vLink=#551a8b> The above line is incorrectly parsed in that, the BODY tag is not identified.
 void testLinkNodeBug3()
          The bug being reproduced is this :
When a url ends with a slash, and the link begins with a slash,the parser puts two slashes This bug was submitted by Roget Kjensrud Creation date: (6/17/2001 4:01:06 PM)
 void testLinkNodeBug4()
          The bug being reproduced is this :
Simple url without index.html, doesent get appended to link This bug was submitted by Roget Kjensrud Creation date: (6/17/2001 4:01:06 PM)
 void testLinkNodeBug5()
           
 void testLinkNodeBugNullPointerException()
          This bug occurs when there is a null pointer exception thrown while scanning a tag using LinkScanner.
 void testLinkNodeMailtoBug()
          This bug occurs when there is a null pointer exception thrown while scanning a tag using LinkScanner.
 void testLinkNodeSingleQuoteBug()
          This bug occurs when there is a null pointer exception thrown while scanning a tag using LinkScanner.
 void testLinkSpacesBug()
          Bug pointed out by Sam Joseph (sam@neurogrid.net) Links with spaces in them will get their spaces absorbed
 void testLinkTag()
          The bug being reproduced is this :
<BODY aLink=#ff0000 bgColor=#ffffff link=#0000cc onload=setfocus() text=#000000
vLink=#551a8b> The above line is incorrectly parsed in that, the BODY tag is not identified.
 void testLinkTagBug()
          The bug being reproduced is this :
<BODY aLink=#ff0000 bgColor=#ffffff link=#0000cc onload=setfocus() text=#000000
vLink=#551a8b> The above line is incorrectly parsed in that, the BODY tag is not identified.
 void testMailToIsNotAHTTPLink()
          Test mail link.
 void testMailtoLink()
           
 void testMultipleLineBug()
          Bug reported by Raj Sharma,5-Apr-2002, upon parsing http://www.samachar.com, the entire page could not be picked up.
 void testNotFTPLink()
           
 void testNotJavascriptLink()
           
 void testNotMailtoLink()
           
 void testNullTagBug()
          The bug being reproduced is this :
<A HREF=>Something<A>
vLink=#551a8b> The above line is incorrectly parsed in that, the BODY tag is not identified.
 void testPlainText()
          See bug #813838 links not parsed correctly
 void testQueryLink()
          This is a reproduction of bug 617228, reported by Stephen J.
 void testRelativeLinkNotHTMLBug()
           
 void testRelativeLinkScan()
           
 void testRelativeLinkScan2()
           
 void testRelativeLinkScan3()
           
 void testRelativeTypeHttpLink()
           
 void testScan()
          Test scan with data which is of diff nodes type
 void testTagSymbolsInLinkText()
           
 void testToHTML()
           
 void testToPlainTextString()
           
 void testTypeFtp()
           
 void testTypeHttpLikeLink()
           
 void testTypeHttpLink()
           
 void testTypeHttps()
           
 void testTypeJavaScript()
           
 void testTypeNonHttp()
           
 
Methods inherited from class org.htmlparser.tests.ParserTestCase
assertHiddenIDTagPresent, assertNodeCount, assertNodeCount, assertSameType, assertStringEquals, assertSuperType, assertTagEquals, assertType, assertXmlEquals, createParser, createParser, createParser, createParser, failWithMessage, getParser, main, parse, parseAndAssertNodeCount, parseNodes, removeEscapeCharacters, setParser
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkTagTest

public LinkTagTest(java.lang.String name)
Method Detail

testLinkNodeBug

public void testLinkNodeBug()
                     throws ParserException
The bug being reproduced is this :
<BODY aLink=#ff0000 bgColor=#ffffff link=#0000cc onload=setfocus() text=#000000
vLink=#551a8b> The above line is incorrectly parsed in that, the BODY tag is not identified. Creation date: (6/17/2001 4:01:06 PM)

Throws:
ParserException

testLinkNodeBug2

public void testLinkNodeBug2()
                      throws ParserException
The bug being reproduced is this :
<BODY aLink=#ff0000 bgColor=#ffffff link=#0000cc onload=setfocus() text=#000000
vLink=#551a8b> The above line is incorrectly parsed in that, the BODY tag is not identified. Creation date: (6/17/2001 4:01:06 PM)

Throws:
ParserException

testLinkNodeBug3

public void testLinkNodeBug3()
                      throws ParserException
The bug being reproduced is this :
When a url ends with a slash, and the link begins with a slash,the parser puts two slashes This bug was submitted by Roget Kjensrud Creation date: (6/17/2001 4:01:06 PM)

Throws:
ParserException

testLinkNodeBug4

public void testLinkNodeBug4()
                      throws ParserException
The bug being reproduced is this :
Simple url without index.html, doesent get appended to link This bug was submitted by Roget Kjensrud Creation date: (6/17/2001 4:01:06 PM)

Throws:
ParserException

testLinkNodeBug5

public void testLinkNodeBug5()
                      throws ParserException
Throws:
ParserException

testLinkNodeBugNullPointerException

public void testLinkNodeBugNullPointerException()
                                         throws ParserException
This bug occurs when there is a null pointer exception thrown while scanning a tag using LinkScanner. Creation date: (7/1/2001 2:42:13 PM)

Throws:
ParserException

testLinkNodeMailtoBug

public void testLinkNodeMailtoBug()
                           throws ParserException
This bug occurs when there is a null pointer exception thrown while scanning a tag using LinkScanner. Creation date: (7/1/2001 2:42:13 PM)

Throws:
ParserException

testLinkNodeSingleQuoteBug

public void testLinkNodeSingleQuoteBug()
                                throws ParserException
This bug occurs when there is a null pointer exception thrown while scanning a tag using LinkScanner. Creation date: (7/1/2001 2:42:13 PM)

Throws:
ParserException

testLinkTag

public void testLinkTag()
                 throws ParserException
The bug being reproduced is this :
<BODY aLink=#ff0000 bgColor=#ffffff link=#0000cc onload=setfocus() text=#000000
vLink=#551a8b> The above line is incorrectly parsed in that, the BODY tag is not identified. Creation date: (6/17/2001 4:01:06 PM)

Throws:
ParserException

testLinkTagBug

public void testLinkTagBug()
                    throws ParserException
The bug being reproduced is this :
<BODY aLink=#ff0000 bgColor=#ffffff link=#0000cc onload=setfocus() text=#000000
vLink=#551a8b> The above line is incorrectly parsed in that, the BODY tag is not identified. Creation date: (6/17/2001 4:01:06 PM)

Throws:
ParserException

testNullTagBug

public void testNullTagBug()
                    throws ParserException
The bug being reproduced is this :
<A HREF=>Something<A>
vLink=#551a8b> The above line is incorrectly parsed in that, the BODY tag is not identified. Creation date: (6/17/2001 4:01:06 PM)

Throws:
ParserException

testToPlainTextString

public void testToPlainTextString()
                           throws ParserException
Throws:
ParserException

testToHTML

public void testToHTML()
                throws ParserException
Throws:
ParserException

testTypeHttps

public void testTypeHttps()
                   throws ParserException
Throws:
ParserException

testTypeFtp

public void testTypeFtp()
                 throws ParserException
Throws:
ParserException

testTypeJavaScript

public void testTypeJavaScript()
                        throws ParserException
Throws:
ParserException

testTypeHttpLink

public void testTypeHttpLink()
                      throws ParserException
Throws:
ParserException

testRelativeTypeHttpLink

public void testRelativeTypeHttpLink()
                              throws ParserException
Throws:
ParserException

testTypeNonHttp

public void testTypeNonHttp()
                     throws ParserException
Throws:
ParserException

testTypeHttpLikeLink

public void testTypeHttpLikeLink()
                          throws ParserException
Throws:
ParserException

testMailToIsNotAHTTPLink

public void testMailToIsNotAHTTPLink()
                              throws ParserException
Test mail link. Bug #738504 MailLink != HTTPLink

Throws:
ParserException

testIrcIsNotAHTTPLink

public void testIrcIsNotAHTTPLink()
                           throws ParserException
Bug #784767 irc://server/channel urls are HTTPLike?

Throws:
ParserException

testAccessKey

public void testAccessKey()
                   throws ParserException
Throws:
ParserException

testErroneousLinkBug

public void testErroneousLinkBug()
                          throws ParserException
Throws:
ParserException

testErroneousLinkBugFromYahoo2

public void testErroneousLinkBugFromYahoo2()
                                    throws ParserException
Test case based on a report by Raghavender Srimantula, of the parser giving out of memory exceptions. Found to occur on the following piece of html
   
 
 

Throws:
ParserException

testErroneousLinkBugFromYahoo

public void testErroneousLinkBugFromYahoo()
                                   throws ParserException
Test case based on a report by Raghavender Srimantula, of the parser giving out of memory exceptions. Found to occur on the following piece of html
 This is test
 
 

Throws:
ParserException

testExtractLinkInvertedCommasBug2

public void testExtractLinkInvertedCommasBug2()
                                       throws ParserException
This is the reproduction of a bug which produces multiple text copies.

Throws:
ParserException

testLinkSpacesBug

public void testLinkSpacesBug()
                       throws ParserException
Bug pointed out by Sam Joseph (sam@neurogrid.net) Links with spaces in them will get their spaces absorbed

Throws:
ParserException

testMultipleLineBug

public void testMultipleLineBug()
                         throws ParserException
Bug reported by Raj Sharma,5-Apr-2002, upon parsing http://www.samachar.com, the entire page could not be picked up. The problem was occurring after parsing a particular link after which the parsing would not proceed. This link was spread over three lines. The bug has been reproduced and fixed.

Throws:
ParserException

testRelativeLinkScan

public void testRelativeLinkScan()
                          throws ParserException
Throws:
ParserException

testRelativeLinkScan2

public void testRelativeLinkScan2()
                           throws ParserException
Throws:
ParserException

testRelativeLinkScan3

public void testRelativeLinkScan3()
                           throws ParserException
Throws:
ParserException

testScan

public void testScan()
              throws ParserException
Test scan with data which is of diff nodes type

Throws:
ParserException

testFreshMeatBug

public void testFreshMeatBug()
                      throws ParserException
A bug in the freshmeat page - really bad html tag - <A>Revision<\a> Reported by Mazlan Mat Note: Actually, this is completely legal HTML - Derrick

Throws:
ParserException

testBrokenLink

public void testBrokenLink()
                    throws ParserException
Test suggested by Cedric Rosa A really bad link tag sends parser into infinite loop

Throws:
ParserException

testLinkDataContents

public void testLinkDataContents()
                          throws ParserException
Throws:
ParserException

testBaseRefLink

public void testBaseRefLink()
                     throws ParserException
Throws:
ParserException

testQueryLink

public void testQueryLink()
                   throws ParserException
This is a reproduction of bug 617228, reported by Stephen J. Harrington. When faced with a link like : <A HREF="/cgi-bin/view_search?query_text=postdate>20020701&txt_clr=White&bg_clr=Red&url=http://loc al host/Testing/Report 1.html">20020702 Report 1</A> parser is unable to handle the link correctly due to the greater than symbol being confused to be the end of the tag.

Throws:
ParserException

testNotMailtoLink

public void testNotMailtoLink()
                       throws ParserException
Throws:
ParserException

testMailtoLink

public void testMailtoLink()
                    throws ParserException
Throws:
ParserException

testJavascriptLink

public void testJavascriptLink()
                        throws ParserException
Throws:
ParserException

testNotJavascriptLink

public void testNotJavascriptLink()
                           throws ParserException
Throws:
ParserException

testFTPLink

public void testFTPLink()
                 throws ParserException
Throws:
ParserException

testNotFTPLink

public void testNotFTPLink()
                    throws ParserException
Throws:
ParserException

testRelativeLinkNotHTMLBug

public void testRelativeLinkNotHTMLBug()
                                throws ParserException
Throws:
ParserException

testBadImageInLinkBug

public void testBadImageInLinkBug()
                           throws ParserException
Throws:
ParserException

testLinkContainsEqualTo

public void testLinkContainsEqualTo()
                             throws java.lang.Exception
This is an attempt to reproduce bug 677874 reported by James Moliere. A link tag of the form Shoe bomber handed life sentence is not parsed correctly. The second '=' sign in the link causes the parser to treat it as a seperate attribute

Throws:
java.lang.Exception

_testLinkWithJSP

public void _testLinkWithJSP()
                      throws java.lang.Exception
Bug report by Cory Seefurth

Throws:
java.lang.Exception

testTagSymbolsInLinkText

public void testTagSymbolsInLinkText()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testPlainText

public void testPlainText()
                   throws java.lang.Exception
See bug #813838 links not parsed correctly

Throws:
java.lang.Exception

testCharacterReferenceInLink

public void testCharacterReferenceInLink()
                                  throws java.lang.Exception
See bug #982175 False Positives on ® entity

Throws:
java.lang.Exception